Function SET235S
* =======================================================
* Process ........: SET_235
* Function .......: SET235S
* Created on .....: 19/10/01 at 11:41:13
* Description ....: Receive and process salary amendments
* Version.........: 1
*
* Full Description:
*
* A .bat file is executed on a PC. The .bat file
* invokes the LANSA User Agent and uses it
* to send a .csv file on the PC to this function,
* via JSM.
*
* This function RECEIVEs the data from the . csv file
* The data is automatically mapped by the RECEIVE
* from the csv file into a working list.
* The function reads the working list and prints all
* details of the received employees on a report.
* This function then retrieves the report spool
* file and writes it to a single field list.
*
* It then SENDs this list back to the PC.
*
* The PC receives the report as a .csv file. The
* name of the .csv file is specified in the .bat file.
*
* Service used: HTTPCLIENT
*
* For the RECEIVE command.
* HANDLER: inbound csv (ISVL).
* no style sheets required
*
* For the SEND command.
* HANDLER: inbound csv (ISVL).
* no style sheets required
*
* Requires LANSA 9.1
*
* Disclaimer: The following material is supplied as an
* example only. No warranty is expressed or implied.
*
* ======================================================*
Function Options(*DIRECT)
*
Define Field(#KEYWORD) Reffld(#STD_TEXT)
Define Field(#KEYW_VAL1) Reffld(#STD_TEXTL)
Define Field(#KEYW_VAL2) Reffld(#STD_TEXTL)
*
Define Field(#S_235RPRT) Type(*CHAR) Length(134) Input_Atr(LC)
Define Field(#S_235MSG) Length(132) Reffld(#S_235RPRT)
Define Field(#S_235NFND) Length(080) Reffld(#S_235RPRT) Desc('Employee not found')
Define Field(#S_235EOR) Length(040) Reffld(#S_235RPRT) Desc('End of Report')
Change Field(#S_235EOR) To('''*** End of Report ***''')
Define Field(#S_235SPLF) Type(*CHAR) Length(010) Desc('Spool file name')
Define Field(#S_235POS) Type(*DEC) Length(003) Decimals(0) Desc('Scanstring position')
Override Field(#ADDRESS1) Colhdg('Street' 'Address')
*
* Working list coming in with employee
* numbers of the employees to be reported
* on
*
Def_List Name(#S_LSTRCV) Fields(#EMPNO) Type(*WORKING)
*
* Outoing working list holding the report of employee
* details
Def_List Name(#S_LSTSND) Fields(#S_235RPRT) Type(*WORKING)
*
* Report Specifications
*
Def_Report Formsize(*DEFAULT 132) Other_Ovr('SPLFNAME(SET235)')
Def_Head Name(#S_HDR01) Fields((#DATE *L001 *P002) (#TIME *L001 *P017) (#FUNCTION *L001 *P032) (#REP1PAGE *L001 *P112))
Def_Line Name(#S_LINEMP) Fields((#EMPNO *L001 *P001 *COL) (#SURNAME *L001 *P013 *COL) (#GIVENAME *L001 *P034 *COL) (#STARTDTE *L001 *P055 *COL) (#PHONEBUS *L001 *P066 *COL) (#PHONEHME *L001 *P088 *COL) (#ADDRESS1 *L001 *P108 *COL) (#ADDRESS2 *L002 *P108) (#ADDRESS3 *L003 *P108) (#POSTCODE *L004 *P108 *LAB)) Space_Bef(002) Identify(*NOID)
Def_Line Name(#S_LINSKL) Fields((#SKILCODE *L001 *P012) (#SKILDESC *L001 *P024) (#GRADE *L001 *P045) (#COMMENT *L001 *P047) (#DATEACQ *L001 *P068)) Identify(*NOID)
Def_Line Name(#S_LINMSG) Fields((#EMPNO *L001 *P003) (#S_235NFND *L001 *P013)) Space_Bef(003) Space_Aft(003) Identify(*NOID)
Def_Break Name(#S_BRKEND) Fields((#S_235EOR *L001 *P043 *NOID))
*
*
* Mainline
*
Change Field(#S_JSMSTS #S_JSMMSG) To(*BLANKS)
*
* Open the Java Services Manager
Use Builtin(JSM_OPEN) To_Get(#S_JSMSTS #S_JSMMSG)
Execute Subroutine(CHECK_STS)
*
* Load service
* SERVICE_LOAD SERVICE(HTTPCLIENT)
Execute Subroutine(START_CMD) With_Parms('SERVICE_LOAD')
Execute Subroutine(KEYWRD) With_Parms('SERVICE' 'HTTPCLIENT' *BLANKS)
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG)
Execute Subroutine(CHECK_STS)
*
* Build the RECEIVE command
* RECEIVE HANDLER(ISVL) SVHEAD(SET235S)
* SERVICE_LIST(EMPNO)
*
* HANDLER(ISVL) refers to the inbound csv handler
* Refer to the HTTPService.properties file that in the
* Properties directory of your JSM installation (for
* example /jsm/instance/properties/).
*
* SVHEAD can be used if the MODE is *NONE
* (or the MODE is unspecified)
* In this situation, SVHEAD contains the logical
* name that points to the field names of the columns
* in the .CSV file.
* The list of field names attached to the logical name
* is stored in the HTTPService.properties file. It
* contains entries in the form:
* sv.head.SET235S=EMPNO
*
* The reason for using this parameter is that there
* may be more fields in the .csv
* file than there are in the list. The presence of this
* parameter allows fields in the .csv file to map
* to fields in the list, and to be dropped when not
* required.
*
* SERVICE_LIST has the field names that define the
* working list #S_LSTRCV. This is the employee number
*
* MODE is not specified in this example and hence
* defaults to *NONE
* *NONE = the first line of the .csv file does not
* contain column heading data. (SVHEAD parameter
* may be used if map/drop of fields is required)
* *IGNORE = the first line of the .csv file does
* contain column heading data, but it is to be
* ignored. (i.e. skip the first line). The format of
* the .csv file must match the format of the list.
* *USE = The first line of the .csv file contains
* LANSA field names as column heading data.
* These field names will be used to map/drop
* fields if the format of the CSV file does not
* match the format of the list.
*
*
Execute Subroutine(START_CMD) With_Parms('RECEIVE')
Execute Subroutine(KEYWRD) With_Parms('HANDLER' 'ISVL' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('SVHEAD' 'SET235S' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('SERVICE_LIST' 'EMPNO' *BLANKS)
*
* Receive working list with the employee numbers
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG #S_LSTRCV)
Execute Subroutine(CHECK_STS)
*
* Read through the list, print the details for each
* employee
*
Execute Subroutine(SBR_REPORT)
*
* Retrieve the spool file into list #S_LSTSND
*
Execute Subroutine(SBR_RETRV) With_Parms('SET235')
*
* Build the SEND command
*
* Build the SEND command
* SEND HANDLER(ISVL)
* SERVICE_LIST(S_235RPRT)
*
* HANDLER(ISVL) refers to the inbound csv handler
* The same handler works ok with the SEND
* Refer to the HTTPService.properties file that in the
* Properties directory of your JSM installation (for
* example /jsm/instance/properties/).
*
* SERVICE_LIST has the field names that define the
* structure of working list #S_LSTSND.
* In this case this is a single field containing
* a line from the spool file.
*
Execute Subroutine(START_CMD) With_Parms('SEND')
Execute Subroutine(KEYWRD) With_Parms('HANDLER' 'ISVL' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('SERVICE_LIST' 'S_235RPRT' *BLANKS)
*
* SEND the response as a list/.csv file
* containing the report.
* Note how the list to be sent is specified in the To_Get
* parameters of the list.
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG #S_LSTSND)
Execute Subroutine(CHECK_STS)
*
* Close the Java Services Manager
Use Builtin(JSM_CLOSE) To_Get(#S_JSMSTS #S_JSMMSG)
Execute Subroutine(CHECK_STS)
*
Return
*
* Subroutine to Start building a new JSM command
*
Subroutine Name(START_CMD) Parms((#STD_TEXTS *RECEIVED))
Change Field(#S_JSMCMD) To(#STD_TEXTS)
Endroutine
*
* Subroutine to add a keyword to an existing JSM command
*
Subroutine Name(KEYWRD) Parms(#KEYWORD #KEYW_VAL1 #KEYW_VAL2)
Use Builtin(BCONCAT) With_Args(#S_JSMCMD #KEYWORD) To_Get(#S_JSMCMD)
Use Builtin(TCONCAT) With_Args(#S_JSMCMD '(' #KEYW_VAL1 #KEYW_VAL2 ')') To_Get(#S_JSMCMD)
Endroutine
*
* Check the status of the JSM command issued
*
Subroutine Name(CHECK_STS)
*
Define Field(#MSGDTA) Type(*CHAR) Length(132)
*
If Cond('#S_JSMSTS *NE OK')
*
Use Builtin(BCONCAT) With_Args('Error Status Code: ' #S_JSMSTS) To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Use Builtin(BCONCAT) With_Args('Error Message: ' #S_JSMMSG) To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Use Builtin(BCONCAT) With_Args(*FUNCTION 'ended in error. Review previous messages.') To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Use Builtin(JSM_CLOSE) To_Get(#S_JSMSTS #S_JSMMSG)
Abort Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Endif
*
Endroutine
*
* Subroutine Report on Employee details
*
Subroutine Name(SBR_REPORT)
Selectlist Named(#S_LSTRCV)
Change Field(#GIVENAME #SURNAME) To(*NULL)
Fetch Fields(#S_LINEMP) From_File(PSLMST) With_Key(#EMPNO)
If_Status Is_Not(*OKAY)
Change Field(#S_235NFND) To('''Employee not found''')
Print Line(#S_LINMSG)
Else
Print Line(#S_LINEMP)
Select Fields(#S_LINSKL) From_File(PSLSKL) With_Key(#EMPNO)
Print Line(#S_LINSKL)
Endselect
Endif
Endselect
Endprint
Endroutine
*
* Subroutine Retrieve the spool file
* into list #S_LSTSND
*
Subroutine Name(SBR_RETRV) Parms(#S_235SPLF)
*
* Create the holding file SPOOLDTA in QTEMP
*
Exec_Os400 Command('CRTPF QTEMP/SPOOLDTA RCDLEN(200) AUT(*ALL)') If_Error(*NEXT)
*
Use Builtin(CLR_MESSAGES)
*
* Copy the spool file
* - Because the same web server instance job
* may be used by multiple users, the report spool file
* is created belonging to a job QPRTJOB, (not
* the web server instance job actually running.)
* and user #USER - the current user making use
* of the web server job (not the user profile of the web
* server instance job that is shown by WRKACTJOB).
*
* To get the report spool file created by this session,
* we specify #User (which is the current user profile
* using the job) and QPRTJOB. An unseen identifier
* is used when the CPYSPLF is performed which
* ensures that only spool files created during the
* current session are searched.
*
Exec_Os400 Command('CPYSPLF FILE(#S_235SPLF) TOFILE(QTEMP/SPOOLDTA) SPLNBR(*LAST) CTLCHAR(*NONE) JOB(#USER/QPRTJOB)') If_Error(*RETURN)
*
*
* Now read the spool file data and add to returned
* spool file details
*
Use Builtin(ACCESS_FILE) With_Args(OPEN SPOOLDTA QTEMP) To_Get(#S_RETCDA2)
Use Builtin(ACCESS_FILE) With_Args(READ SPOOLDTA QTEMP) To_Get(#S_RETCDA2 #S_235MSG)
Dowhile Cond('#S_RETCDA2 = OK')
* Remove any commas from the string, since JSM
* handles commas by truncating leading spaces and adding
* quotes.
Use Builtin(SCANSTRING) With_Args(#S_235MSG ',') To_Get(#S_235POS)
Dowhile Cond('#S_235POS *GT 0')
Substring Field(#BLANKS) Into_Field(#S_235MSG #S_235POS 1)
Use Builtin(SCANSTRING) With_Args(#S_235MSG ',') To_Get(#S_235POS)
Endwhile
* Put double quotes around the line to protect leading
* spaces during JSM transfer.
Use Builtin(CONCAT) With_Args('"' #S_235MSG '"') To_Get(#S_235RPRT)
*
Add_Entry To_List(#S_LSTSND)
Use Builtin(ACCESS_FILE) With_Args(READ SPOOLDTA QTEMP) To_Get(#S_RETCDA2 #S_235MSG)
Endwhile
Use Builtin(ACCESS_FILE) With_Args(CLOSE SPOOLDTA QTEMP) To_Get(#S_RETCDA2)
*
* Delete the spool file
*
Exec_Os400 Command('DLTSPLF FILE(#S_235SPLF) SPLNBR(*LAST) JOB(#USER/QPRTJOB)') If_Error(*NEXT)
*
Endroutine
* =======================================================
* Process ........: SET_235
* Function .......: SET235S
* Created on .....: 19/10/01 at 11:41:13
* Description ....: Receive and process salary amendments
* Version.........: 1
*
* Full Description:
*
* A .bat file is executed on a PC. The .bat file
* invokes the LANSA User Agent and uses it
* to send a .csv file on the PC to this function,
* via JSM.
*
* This function RECEIVEs the data from the . csv file
* The data is automatically mapped by the RECEIVE
* from the csv file into a working list.
* The function reads the working list and prints all
* details of the received employees on a report.
* This function then retrieves the report spool
* file and writes it to a single field list.
*
* It then SENDs this list back to the PC.
*
* The PC receives the report as a .csv file. The
* name of the .csv file is specified in the .bat file.
*
* Service used: HTTPCLIENT
*
* For the RECEIVE command.
* HANDLER: inbound csv (ISVL).
* no style sheets required
*
* For the SEND command.
* HANDLER: inbound csv (ISVL).
* no style sheets required
*
* Requires LANSA 9.1
*
* Disclaimer: The following material is supplied as an
* example only. No warranty is expressed or implied.
*
* ======================================================*
Function Options(*DIRECT)
*
Define Field(#KEYWORD) Reffld(#STD_TEXT)
Define Field(#KEYW_VAL1) Reffld(#STD_TEXTL)
Define Field(#KEYW_VAL2) Reffld(#STD_TEXTL)
*
Define Field(#S_235RPRT) Type(*CHAR) Length(134) Input_Atr(LC)
Define Field(#S_235MSG) Length(132) Reffld(#S_235RPRT)
Define Field(#S_235NFND) Length(080) Reffld(#S_235RPRT) Desc('Employee not found')
Define Field(#S_235EOR) Length(040) Reffld(#S_235RPRT) Desc('End of Report')
Change Field(#S_235EOR) To('''*** End of Report ***''')
Define Field(#S_235SPLF) Type(*CHAR) Length(010) Desc('Spool file name')
Define Field(#S_235POS) Type(*DEC) Length(003) Decimals(0) Desc('Scanstring position')
Override Field(#ADDRESS1) Colhdg('Street' 'Address')
*
* Working list coming in with employee
* numbers of the employees to be reported
* on
*
Def_List Name(#S_LSTRCV) Fields(#EMPNO) Type(*WORKING)
*
* Outoing working list holding the report of employee
* details
Def_List Name(#S_LSTSND) Fields(#S_235RPRT) Type(*WORKING)
*
* Report Specifications
*
Def_Report Formsize(*DEFAULT 132) Other_Ovr('SPLFNAME(SET235)')
Def_Head Name(#S_HDR01) Fields((#DATE *L001 *P002) (#TIME *L001 *P017) (#FUNCTION *L001 *P032) (#REP1PAGE *L001 *P112))
Def_Line Name(#S_LINEMP) Fields((#EMPNO *L001 *P001 *COL) (#SURNAME *L001 *P013 *COL) (#GIVENAME *L001 *P034 *COL) (#STARTDTE *L001 *P055 *COL) (#PHONEBUS *L001 *P066 *COL) (#PHONEHME *L001 *P088 *COL) (#ADDRESS1 *L001 *P108 *COL) (#ADDRESS2 *L002 *P108) (#ADDRESS3 *L003 *P108) (#POSTCODE *L004 *P108 *LAB)) Space_Bef(002) Identify(*NOID)
Def_Line Name(#S_LINSKL) Fields((#SKILCODE *L001 *P012) (#SKILDESC *L001 *P024) (#GRADE *L001 *P045) (#COMMENT *L001 *P047) (#DATEACQ *L001 *P068)) Identify(*NOID)
Def_Line Name(#S_LINMSG) Fields((#EMPNO *L001 *P003) (#S_235NFND *L001 *P013)) Space_Bef(003) Space_Aft(003) Identify(*NOID)
Def_Break Name(#S_BRKEND) Fields((#S_235EOR *L001 *P043 *NOID))
*
*
* Mainline
*
Change Field(#S_JSMSTS #S_JSMMSG) To(*BLANKS)
*
* Open the Java Services Manager
Use Builtin(JSM_OPEN) To_Get(#S_JSMSTS #S_JSMMSG)
Execute Subroutine(CHECK_STS)
*
* Load service
* SERVICE_LOAD SERVICE(HTTPCLIENT)
Execute Subroutine(START_CMD) With_Parms('SERVICE_LOAD')
Execute Subroutine(KEYWRD) With_Parms('SERVICE' 'HTTPCLIENT' *BLANKS)
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG)
Execute Subroutine(CHECK_STS)
*
* Build the RECEIVE command
* RECEIVE HANDLER(ISVL) SVHEAD(SET235S)
* SERVICE_LIST(EMPNO)
*
* HANDLER(ISVL) refers to the inbound csv handler
* Refer to the HTTPService.properties file that in the
* Properties directory of your JSM installation (for
* example /jsm/instance/properties/).
*
* SVHEAD can be used if the MODE is *NONE
* (or the MODE is unspecified)
* In this situation, SVHEAD contains the logical
* name that points to the field names of the columns
* in the .CSV file.
* The list of field names attached to the logical name
* is stored in the HTTPService.properties file. It
* contains entries in the form:
* sv.head.SET235S=EMPNO
*
* The reason for using this parameter is that there
* may be more fields in the .csv
* file than there are in the list. The presence of this
* parameter allows fields in the .csv file to map
* to fields in the list, and to be dropped when not
* required.
*
* SERVICE_LIST has the field names that define the
* working list #S_LSTRCV. This is the employee number
*
* MODE is not specified in this example and hence
* defaults to *NONE
* *NONE = the first line of the .csv file does not
* contain column heading data. (SVHEAD parameter
* may be used if map/drop of fields is required)
* *IGNORE = the first line of the .csv file does
* contain column heading data, but it is to be
* ignored. (i.e. skip the first line). The format of
* the .csv file must match the format of the list.
* *USE = The first line of the .csv file contains
* LANSA field names as column heading data.
* These field names will be used to map/drop
* fields if the format of the CSV file does not
* match the format of the list.
*
*
Execute Subroutine(START_CMD) With_Parms('RECEIVE')
Execute Subroutine(KEYWRD) With_Parms('HANDLER' 'ISVL' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('SVHEAD' 'SET235S' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('SERVICE_LIST' 'EMPNO' *BLANKS)
*
* Receive working list with the employee numbers
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG #S_LSTRCV)
Execute Subroutine(CHECK_STS)
*
* Read through the list, print the details for each
* employee
*
Execute Subroutine(SBR_REPORT)
*
* Retrieve the spool file into list #S_LSTSND
*
Execute Subroutine(SBR_RETRV) With_Parms('SET235')
*
* Build the SEND command
*
* Build the SEND command
* SEND HANDLER(ISVL)
* SERVICE_LIST(S_235RPRT)
*
* HANDLER(ISVL) refers to the inbound csv handler
* The same handler works ok with the SEND
* Refer to the HTTPService.properties file that in the
* Properties directory of your JSM installation (for
* example /jsm/instance/properties/).
*
* SERVICE_LIST has the field names that define the
* structure of working list #S_LSTSND.
* In this case this is a single field containing
* a line from the spool file.
*
Execute Subroutine(START_CMD) With_Parms('SEND')
Execute Subroutine(KEYWRD) With_Parms('HANDLER' 'ISVL' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('SERVICE_LIST' 'S_235RPRT' *BLANKS)
*
* SEND the response as a list/.csv file
* containing the report.
* Note how the list to be sent is specified in the To_Get
* parameters of the list.
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG #S_LSTSND)
Execute Subroutine(CHECK_STS)
*
* Close the Java Services Manager
Use Builtin(JSM_CLOSE) To_Get(#S_JSMSTS #S_JSMMSG)
Execute Subroutine(CHECK_STS)
*
Return
*
* Subroutine to Start building a new JSM command
*
Subroutine Name(START_CMD) Parms((#STD_TEXTS *RECEIVED))
Change Field(#S_JSMCMD) To(#STD_TEXTS)
Endroutine
*
* Subroutine to add a keyword to an existing JSM command
*
Subroutine Name(KEYWRD) Parms(#KEYWORD #KEYW_VAL1 #KEYW_VAL2)
Use Builtin(BCONCAT) With_Args(#S_JSMCMD #KEYWORD) To_Get(#S_JSMCMD)
Use Builtin(TCONCAT) With_Args(#S_JSMCMD '(' #KEYW_VAL1 #KEYW_VAL2 ')') To_Get(#S_JSMCMD)
Endroutine
*
* Check the status of the JSM command issued
*
Subroutine Name(CHECK_STS)
*
Define Field(#MSGDTA) Type(*CHAR) Length(132)
*
If Cond('#S_JSMSTS *NE OK')
*
Use Builtin(BCONCAT) With_Args('Error Status Code: ' #S_JSMSTS) To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Use Builtin(BCONCAT) With_Args('Error Message: ' #S_JSMMSG) To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Use Builtin(BCONCAT) With_Args(*FUNCTION 'ended in error. Review previous messages.') To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Use Builtin(JSM_CLOSE) To_Get(#S_JSMSTS #S_JSMMSG)
Abort Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Endif
*
Endroutine
*
* Subroutine Report on Employee details
*
Subroutine Name(SBR_REPORT)
Selectlist Named(#S_LSTRCV)
Change Field(#GIVENAME #SURNAME) To(*NULL)
Fetch Fields(#S_LINEMP) From_File(PSLMST) With_Key(#EMPNO)
If_Status Is_Not(*OKAY)
Change Field(#S_235NFND) To('''Employee not found''')
Print Line(#S_LINMSG)
Else
Print Line(#S_LINEMP)
Select Fields(#S_LINSKL) From_File(PSLSKL) With_Key(#EMPNO)
Print Line(#S_LINSKL)
Endselect
Endif
Endselect
Endprint
Endroutine
*
* Subroutine Retrieve the spool file
* into list #S_LSTSND
*
Subroutine Name(SBR_RETRV) Parms(#S_235SPLF)
*
* Create the holding file SPOOLDTA in QTEMP
*
Exec_Os400 Command('CRTPF QTEMP/SPOOLDTA RCDLEN(200) AUT(*ALL)') If_Error(*NEXT)
*
Use Builtin(CLR_MESSAGES)
*
* Copy the spool file
* - Because the same web server instance job
* may be used by multiple users, the report spool file
* is created belonging to a job QPRTJOB, (not
* the web server instance job actually running.)
* and user #USER - the current user making use
* of the web server job (not the user profile of the web
* server instance job that is shown by WRKACTJOB).
*
* To get the report spool file created by this session,
* we specify #User (which is the current user profile
* using the job) and QPRTJOB. An unseen identifier
* is used when the CPYSPLF is performed which
* ensures that only spool files created during the
* current session are searched.
*
Exec_Os400 Command('CPYSPLF FILE(#S_235SPLF) TOFILE(QTEMP/SPOOLDTA) SPLNBR(*LAST) CTLCHAR(*NONE) JOB(#USER/QPRTJOB)') If_Error(*RETURN)
*
*
* Now read the spool file data and add to returned
* spool file details
*
Use Builtin(ACCESS_FILE) With_Args(OPEN SPOOLDTA QTEMP) To_Get(#S_RETCDA2)
Use Builtin(ACCESS_FILE) With_Args(READ SPOOLDTA QTEMP) To_Get(#S_RETCDA2 #S_235MSG)
Dowhile Cond('#S_RETCDA2 = OK')
* Remove any commas from the string, since JSM
* handles commas by truncating leading spaces and adding
* quotes.
Use Builtin(SCANSTRING) With_Args(#S_235MSG ',') To_Get(#S_235POS)
Dowhile Cond('#S_235POS *GT 0')
Substring Field(#BLANKS) Into_Field(#S_235MSG #S_235POS 1)
Use Builtin(SCANSTRING) With_Args(#S_235MSG ',') To_Get(#S_235POS)
Endwhile
* Put double quotes around the line to protect leading
* spaces during JSM transfer.
Use Builtin(CONCAT) With_Args('"' #S_235MSG '"') To_Get(#S_235RPRT)
*
Add_Entry To_List(#S_LSTSND)
Use Builtin(ACCESS_FILE) With_Args(READ SPOOLDTA QTEMP) To_Get(#S_RETCDA2 #S_235MSG)
Endwhile
Use Builtin(ACCESS_FILE) With_Args(CLOSE SPOOLDTA QTEMP) To_Get(#S_RETCDA2)
*
* Delete the spool file
*
Exec_Os400 Command('DLTSPLF FILE(#S_235SPLF) SPLNBR(*LAST) JOB(#USER/QPRTJOB)') If_Error(*NEXT)
*
Endroutine