Step 2 Add a Working list to save Status and Messages to the CHECK_STS Subroutine

LANSA Integrator

Step 2. Add a Working list to save Status and Messages to the CHECK_STS Subroutine

INT002 - Getting Started with Basic JSM Operations

In this step, you will define a working list to store the status and message after executing each JSM statement to the CHECK_STS subroutine to indicate the function status as the JSM performs different operations.

1.  Since this is an RDMLX function, it cannot use a DISPLAY command or browse list. In the next step you will create an RDML function to call iiiFN01 and receive a working list containing messages. Define a working list  WL_MSGS containing fields JSMSTS and JSMMSG, at the end of the CHECK_STS subroutine and add entries to it.

     The RDMLX code might appear as follows:

SUBROUTINE NAME(CHECK_STS) PARMS(#W_HDLE)

*
DEFINE FIELD(#MSGDTA) TYPE(*CHAR) LENGTH(132)
DEFINE FIELD(#W_HDLE) TYPE(*CHAR) LENGTH(4)
*
IF COND('#JSMSTS *NE OK')
*
#MSGDTA := 'Error Status Code: ' + #JSMSTS
MESSAGE MSGID(DCM9899) MSGF(DC@M01) MSGDTA(#MSGDTA)
#MSGDTA := 'Error Message: ' + #JSMMSG
MESSAGE MSGID(DCM9899) MSGF(DC@M01) MSGDTA(#MSGDTA)
ENDIF
*
DEF_LIST NAME(#WL_MSGS) FIELDS(#JSMSTS #JSMMSG) TYPE(*WORKING)
ADD_ENTRY TO_LIST(#WL_MSGS)
ENDROUTINE
 

2.  In order to be able to call function iiiFN01 and pass and receive a working list, change the 'Function' command as follows

FUNCTION OPTIONS(*DIRECT) RCV_LIST(#WL_MSGS)

3.  Save and compile function iiiFN01.