JSMDirectの例
「開く/閉じる場合の例」のサービスをロードします。このファンクションがJSMDirectによって呼び出されるとSERVICE_LOADコマンドは修正され、すべてのPOSTデータを渡します。JSM_CLOSEにより、最後のJSMRESPONSE byteArrayがJSMDirectに送り返されてSTDOUTに書き込まれます。
********** Beginning of RDML commands **********
FUNCTION OPTIONS(*DIRECT)
**********
DEFINE FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(20)
DEFINE FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(255)
**********
********** 'Open service'
**********
USE BUILTIN(JSM_OPEN) TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** 'JSMDirect will modify the SERVICE_LOAD command
********** and pass the POST data on with the command
**********
USE BUILTIN(JSM_COMMAND) WITH_ARGS('SERVICE_LOAD SERVICE(EX
AMPLE1)') TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** 'Closing the JSM, will cause last JSMRESPONSE byteArray
********** to be sent back to JSMDirect cgi-bin program'
**********
USE BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
**********
********** SUB ROUTINES
**********
SUBROUTINE NAME(CHECK) PARMS((#JSMSTS *RECEIVED) (#JSMMSG *RECEIVE
D))
**********
IF COND('#JSMSTS *NE OK')
**********
********** 'Closing the JSM, will cause any JSMRESPONSE byteArray
********** to be sent back to JSMDirect cgi-bin program'
**********
USE BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)
**********
RETURN
**********
ENDIF
**********
ENDROUTINE