In this step you will create a processing sequence to do the following:
- Assign – assign variable = OK
- While – loop while variable = OK
- Activity – Get single email from server via POP3
- Transform – Extract Employee file to CSV
- Assign &TONAME = 'Personnel Dept LANSA'
- Activity – text substitute – build email body
- Activity – Send email response via SMTP
First, you will create a text skeleton which will later be used by a text substitute action to create the response email body text.
- Open Notepad and create the response text skeleton shown below:

Save this to the IBM i IFS as:
- Notepad will automatically add a txt filename extension
- This tutorial path can be found under Administration & Housekeeping / System settings / Tutorial files
- The value %%PARM.TONAME%% and %%PARM.DEPARTMENT%% will be replaced by the Text Substitute action you will include in the processing sequence.
|
- On the Navigator panel select Definitions / Processing sequences. Click the
button to create a new Processing Sequence. The Processing sequence editor will open immediately. - Start defining the processing sequence by selecting the Palette tab (top left) and dragging and dropping the Assign processing directive onto the Details tab. Assign the value 'OK' to a variable &FLAG_WHILE. This will be used to control the While loop.

- Next, drop a While loop into the processing sequence following the Assign activity. Set the condition to &FLAG_WHILE = 'OK'. The loop will later be terminated by an If condition.

The While will be highlighted as an error since there is nothing inside the loop at the moment. - Select the Activities tab (top left) and drop the MAIL_RECEIVE activity into the processing sequence. Locate MAIL_RECEIVE in the Email group.
This must be within the While loop. You can adjust it to the correct level if necessary, using the
buttons. - Select the Configurations tab (top left)
- Drop the iiiTUT_POP3 – Tutorial POP3 configuration into the Inbound POP3 Mail configuration ID. You defined this in Step 2.
- Set the Subject of email to a value of &DEPARTMENT. The email subject line will contain a department code such as "1700" which will be used to select employees from the file and output to the CSV file.
- In the FROMADDRESS parameter, type &RCVFROM.
See below:
-
your processing sequence.
Ignore the error and warning messages. You will complete the processing sequence definition in the following steps. - Once again select the Palette tab (top left) and drop an If directive after the EMAIL_RECEIVE activity. Set the condition to
&RCVFROM *NE ''. (i.e. RCVFROM is not equal blank) RCVFROM is returned by MAIL_RECEIVE. It will be blank if no email is found.
Your processing sequence should now look like the following:

- Select the Transformations tab (top left)
- Drop the iiiTUTMAP02 which you created earlier at the end of the processing sequence. Make sure it is positioned within the If loop and adjust if necessary using the promote/demote buttons.
- Select the Configurations tab (top left). Drop the Database configuration iiiTUTDEMO which you created earlier into the EARTHSourceConnection parameter.
- Select the Variables tab (top left) and drop the DEPARTMENT variable into the Department_InSourceParameter. We used this variable for the Subject line on the MAIL_RECEIVE activity.
Set the TextfileTargetFilename to
/LANSA_Composer_licpgmlib/lic/Tutorial/_SentEmail/iii_EmployeeInfo.csv
Your processing sequence should now look like the following:

- Save your processing sequence.
Select the Palette tab (top left) and drop an Assign directive at the end of the processing sequence. This will be used to set a value to a variable TONAME which will be merged into the response email text. Complete the expression:
&TONAME = 'Personnel Administrator'
Your processing sequence should now look like the following:

- Select the Activities tab (top left) and drop the TEXT_SUBSTITUTE activity at the end of the processing sequence, as shown below:

Complete the Path & filename of skeleton as:
'/LANSA_Composer_licpgmlib/lic/Tutorial/_emailSkeletons/iii_EmployeeInfo.txt'
Complete the Path & filename for expanded text as:
'/LANSA_Composer_licpgmlib/lic/Tutorial/_SentEmail/iii_EmployeeInfo.txt'
- Select the Activities tab (top left) and drop the MAIL_SEND activity at the end of the processing sequence.
- Select the Configurations tab (top left) and drop your iii_INQ_EMP SMTP email details configuration into the SMTP Mail details configuration ID parameter
- Drop the iiiSMTPID Tutorial SMTP configuration into the SMTP mail server configuration parameter.
Set the Body text path and filename to:
/LANSA_Composer_licpgmlib/lic/Tutorial/_SentEmail/iii_EmployeeInfo.txt
Set the Path and filename for email attachments to:
/LANSA_Composer_licpgmlib/lic/Tutorial/_SentEmail/iii_EmployeeInfo.csv
- In the TOADDRESS parameter, type &RCVFROM
- In the SMTPSUBJECT parameter, type Employee List Request
Your processing sequence should now look like the following:
- Save your processing sequence.
- Select the Palette tab (top left) and drop an Else processing directive into the processing sequence. Then drop a Terminate below the Else. Use the Promote / Demote buttons if necessary to position these correctly. Your Processing sequence should now look like the following:

- Use the
button to save your processing sequence. Review the Version History tab for the Processing Sequence iiiTUTSEQ06. This will contain the versions saved during this exercise.
| You can View any of these versions. Restore would make the selected version the current version. |

- Use your email account to send an email request. In the subject line, enter a department code (for example 1700, 2300 or 1200 ). Send it to the second email account which you specified as the FROMADDRESS in the EMAIL_RECEIVE activity.
- Use the
button to open the run dialogue and then click the Run button to run it. If your processing sequence is correct, your log will look like the following:

- Check the inbox for your email account which you specified in your iii_INQ_EMP SMTP Email Configuration. You should have a response email with the file iii_EmployeeInfo.csv attached. Open this in Excel and check that it contains the expected list of employees.

- Send a number of email requests for different departments (for example, ADM, FLT, AUD) and run your processing sequence again. Check your email account inbox, which should contain a response for each request, with a CSV file attachment containing employees for the requested department.
You have now completed this exercise.