Step 7. Using a CSV without Column Headings

INT003 - Using the LANSA User Agent

In this step, you will modify the CSV file to remove the column headings. The RDMLX will need to be modified to change the SVMODE keyword on the RECEIVE command to *NONE. i.e. the CSV file has no column headings. In Step 6, you modified the received working list definition to match the columns in the CSV file, so no other changes are needed to receive the CSV file. In fact, since your function only requires the first two fields, the working list could be defined as containing EMPNO and SALARY only.

You will add a SVHEAD keyword to the SEND command with a value of iiiFN03. This will look up a project entry you will add to the HTTPService properties file for the header row to be added to the sent CSV file.

1.  Start Notepadand open the file iii_employee_new_salary.csv created at the beginning of this exercise. The file might appear as follows:

        EMPNO,SALARY,STARTDTER,DEPTMENT,SECTION

        A1004,53400,910521,ADM,01

        A1005,53500,950102,ADM,01

        A1006,53600,891201,MKT,02

 

2.  Remove the first row in the file that contains the column heading data. The file might appear as follows:

        A1004,53400,910521,ADM,01

        A1005,53500,950102,ADM,01

        A1006,53600,891201,MKT,02

 

3.  Using the File menu, select Save to save the file with the modified contents then close it.

4.  Edit function iiiFN03.

     Locate the definition of the working list used to receive the data from the User Agent. The working list is called #S_RECEIVE and it might appear as follows:

DEF_LIST NAME(#S_RECEIVE) FIELDS(#EMPNO #SALARY #STARTDTER #DEPTMENT #SECTION) TYPE(*WORKING)

 

5.  Locate the commands that execute the KEYWRD subroutine to build the RECEIVE command.
Change the value of the SVMODE keyword to *IGNORE.

     The RDMLX might appear as follows:

CHANGE FIELD(#JSMXCMD) TO(RECEIVE)

EXECUTE SUBROUTINE(KEYWRD) WITH_PARMS(#JSMXCMD HANDLER InboundSeparatedValue)

EXECUTE SUBROUTINE(KEYWRD) WITH_PARMS(#JSMXCMD SVMODE '*IGNORE') 

USE BUILTIN(JSMX_COMMAND) WITH_ARGS(#JSMXHDLE1 #JSMXCMD) TO_GET(#JSMSTS #JSMMSG #S_RECEIVE)

EXECUTE SUBROUTINE(CHECK_STS)

 

6.  Locate the execute KEYWRD subroutine code for the SEND command. Add a SVHEAD keyword with a value of iiiFN03. Your code should look like the following:

* BUILD THE JSM COMMAND

#JSMXCMD := SEND

EXECUTE SUBROUTINE(KEYWRD) WITH_PARMS(#JSMXCMD HANDLER InboundSeparatedValue)

EXECUTE SUBROUTINE(KEYWRD) WITH_PARMS(#JSMXCMD SVHEAD iiiFN03)

USE BUILTIN(JSMX_COMMAND) WITH_ARGS(#JSMXHDLE1 #JSMXCMD) TO_GET(#JSMSTS #JSMMSG #S_SEND)

EXECUTE SUBROUTINE(CHECK_STS) WITH_PARMS(#JSMXCMD)

 

7.  Compile function iiiFN03.

8.  In this step you will add a section to the HTTPSERVICE properties file for your Project. This section will define the column headings to be used for the sent CSV file.

a.  Open your iii Training project in Integrator Studio.

  On the Project tab, select the Server you are using for training and right click to Open Server.

b.  The server instance will open on the right hand side:

c.  Open the properties level, and scroll down to HTTPService.properties. Select this and right click to Retrieve Section.

d.  The following dialog box will be shown, since you do not have an HTTPService.properties section defined for your project at this point. Select OK and an entry HTTPService.properties will be created under Integrator / Properties on the left hand side. i.e. in your project.

e.  Select Integrator / Properties / HTTPService.properties and right click to Open With /Properties Editor.

f.  The Properties Editor will open. Add an entry which defines column headings for separated variables files, as shown in the screen shot. Save your changes and close the properties editor.

sv.head.iiiFN03=EMPNO,GIVENAME,SURNAME,SALARY,ERRORS

g.  Select HTTPService.properties in your project and right click to select Publish Section.

h.  Select Yes in the Confirm dialog. This will add a section at the end of the HTTPService.properties file for your project.

i.  On the right hand side (the JSM server instance) right click to select Properties / HTTPService.properties to Open the JSM server HTTPService properties file. Scroll to the end to view the entry you have just added.

8.  Use the instructions in the previous step to test the function. The response should look like the following:

.