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

INT001 - 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([email protected]) MSGDTA(#MSGDTA)

#MSGDTA := 'Error Message: ' + #JSMMSG

MESSAGE MSGID(DCM9899) MSGF([email protected]) MSGDTA(#MSGDTA)

ENDIF

*

Def_List Name(#WL_MSGS) Fields(#JSMSTS #JSMMSG) Type(*WORKING) ENTRYS(*max)

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.