5.34.13 Example RDML function

The following RDML function example illustrates how to use the example XML content.

********** Beginning of RDML commands **********
DEFINE     FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(20)
DEFINE     FIELD(#JSMCMD) TYPE(*CHAR) LENGTH(256)
DEFINE     FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(256)
**********
DEFINE     FIELD(#ID) TYPE(*CHAR) LENGTH(5)
DEFINE     FIELD(#FNAME) TYPE(*CHAR) LENGTH(20)
DEFINE     FIELD(#SNAME) TYPE(*CHAR) LENGTH(30)
**********
DEF_LIST   NAME(#TBLLST) FIELDS((#ID) (#FNAME) (#SNAME)) TYPE(*WORKING)
**********
USE        BUILTIN(JSM_OPEN) TO_GET(#JSMSTS #JSMMSG)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
USE        BUILTIN(JSM_COMMAND) WITH_ARGS('SERVICE_LOAD SERVICE(PDFDOCUMENTSERVICE)') TO_GET(#JSMSTS #JSMMSG)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
CHANGE     FIELD(#JSMCMD) TO('''CREATE DOCUMENT(report.pdf) CONTENT(report.xml) PASSWORD(password)''')
USE        BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
USE        BUILTIN(JSM_COMMAND) WITH_ARGS('ADD CONTENT(TOP)') TO_GET(#JSMSTS #JSMMSG)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
BEGIN_LOOP TO(2)
**********
CLR_LIST   NAMED(#TBLLST)
**********
CHANGE     FIELD(#ID) TO(A1001)
CHANGE     FIELD(#FNAME) TO('''Greg''')
CHANGE     FIELD(#SNAME) TO('''Turner''')
ADD_ENTRY  TO_LIST(#TBLLST)
**********
CHANGE     FIELD(#ID) TO(A1002)
CHANGE     FIELD(#FNAME) TO('''John''')
CHANGE     FIELD(#SNAME) TO('''Smith''')
ADD_ENTRY  TO_LIST(#TBLLST)
**********
CHANGE     FIELD(#ID) TO(A1003)
CHANGE     FIELD(#FNAME) TO('''Jack''')
CHANGE     FIELD(#SNAME) TO('''Brown''')
ADD_ENTRY  TO_LIST(#TBLLST)
**********
CHANGE     FIELD(#ID) TO(A1004)
CHANGE     FIELD(#FNAME) TO('''Billy''')
CHANGE     FIELD(#SNAME) TO('''Moylan''')
ADD_ENTRY  TO_LIST(#TBLLST)
CHANGE     FIELD(#JSMCMD) TO('ADD CONTENT(TABLE) SERVICE_LIST(ID,FNAME,SNAME)')
USE        BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG #TBLLST)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
END_LOOP
**********
USE        BUILTIN(JSM_COMMAND) WITH_ARGS('ADD CONTENT(GRAPHIC) TEMPLATE(LOGO)') TO_GET(#JSMSTS #JSMMSG)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
USE        BUILTIN(JSM_COMMAND) WITH_ARGS('ADD CONTENT(DETAIL)') TO_GET(#JSMSTS #JSMMSG)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
USE        BUILTIN(JSM_COMMAND) WITH_ARGS('ADD CONTENT(BOTTOM)') TO_GET(#JSMSTS #JSMMSG)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
USE        BUILTIN(JSM_COMMAND) WITH_ARGS('CLOSE') TO_GET(#JSMSTS #JSMMSG)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
USE        BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)
EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** SUB ROUTINES
**********
SUBROUTINE NAME(CHECK) PARMS((#JSMSTS *RECEIVED) (#JSMMSG *RECEIVED))
**********
IF         COND('#JSMSTS *NE OK')
DISPLAY    FIELDS((#JSMSTS) (#JSMMSG))
**********
USE        BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)
**********
MENU       MSGTXT('Java service error has occured')
**********
**********
ENDIF
**********
ENDROUTINE
********** End of RDML commands **********