JSMLR03 LANSA Function Information
FUNCTION OPTIONS(*DIRECT)
**********
DEFINE FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(20)
DEFINE FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(255)
DEFINE FIELD(#JSMCMD) TYPE(*CHAR) LENGTH(255)
**********
DEFINE FIELD(#BNDMAPS) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#BNDMAPL) TYPE(*CHAR) LENGTH(30)
DEFINE FIELD(#BNDRTNCDE) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#BNDPRONME) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#BNDFUNNME) TYPE(*CHAR) LENGTH(7)
DEFINE FIELD(#BNDFLDNME) TYPE(*CHAR) LENGTH(10) DECIMALS(0)
DEFINE FIELD(#BNDFLDFIL) TYPE(*CHAR) LENGTH(122)
**********
DEF_LIST NAME(#MAPLST) FIELDS((#BNDMAPS) (#BNDMAPL)) TYPE(*WORKING)
**********
DEF_LIST NAME(#FLDLST) FIELDS((#BNDFLDNME) (#BNDFLDFIL)) TYPE(*WORKING) ENTRYS(9999)
**********
DEF_LIST NAME(#FLDTABLE) FIELDS((#BNDPRONME) (#BNDFUNNME) (#BNDFLDNME)) TYPE(*WORKING) ENTRYS(9999)
**********
********** Build field/column map
**********
EXECUTE SUBROUTINE(BLDMAP)
**********
********** Open service
**********
USE BUILTIN(JSM_OPEN) TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** Load service - Receive PRONAME and FUNNAME
**********
CHANGE FIELD(#JSMCMD) TO('SERVICE_LOAD SERVICE(RFIDataSourceService) SERVICE_LIST(BNDMAPS,BNDMAPL) BIND(*FIELD) TRACE(*NO)')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG #MAPLST)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** Create data source
**********
USE BUILTIN(JSM_COMMAND) WITH_ARGS('CREATE DATASOURCE(REPOSITORY)') TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** Get function fields
**********
USE BUILTIN(GET_FUNCTION_INFO) WITH_ARGS(#BNDPRONME #BNDFUNNME 'FIELDS') TO_GET(#BNDRTNCDE #FLDLST)
**********
IF COND('#BNDRTNCDE *EQ OK')
**********
SELECTLIST NAMED(#FLDLST)
**********
ADD_ENTRY TO_LIST(#FLDTABLE)
**********
ENDSELECT
**********
CHANGE FIELD(#JSMCMD) TO('PUT OBJECT(*TABLE) NAME(FUNCTION_FIELD_LIST) SERVICE_LIST(BNDPRONME,BNDFUNNME,BNDFLDNME)')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG #FLDTABLE)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
ENDIF
**********
********** Send data source
**********
USE BUILTIN(JSM_COMMAND) WITH_ARGS('SEND OBJECT(*DATASOURCE)') TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** Close service and send the HTTP response
**********
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')
**********
********** Close service
**********
USE BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG)
**********
ENDIF
**********
ENDROUTINE
**********
SUBROUTINE NAME(BLDMAP)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDPRONME)
CHANGE FIELD(#BNDMAPL) TO(PROCESS_NAME)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFUNNME)
CHANGE FIELD(#BNDMAPL) TO(FUNCTION_NAME)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFLDNME)
CHANGE FIELD(#BNDMAPL) TO(FIELD_NAME)
ADD_ENTRY TO_LIST(#MAPLST)
**********
ENDROUTINE