JSMLR05 LANSAファイル情報
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(#BNDFILNME) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#BNDFILLIB) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#BNDFLDNME) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#BNDFLDSTS) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#BNDFLDTYP) TYPE(*CHAR) LENGTH(1)
DEFINE FIELD(#BNDFLDLEN) TYPE(*DEC) LENGTH(3) DECIMALS(0)
DEFINE FIELD(#BNDFLDDEC) TYPE(*DEC) LENGTH(3) DECIMALS(0)
DEFINE FIELD(#BNDFLDREF) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#BNDFLDDSC) TYPE(*CHAR) LENGTH(40)
DEFINE FIELD(#BNDLGLNME) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#BNDLGLDSC) TYPE(*CHAR) LENGTH(40)
**********
DEFINE FIELD(#BNDHDR1) TYPE(*CHAR) LENGTH(5)
DEFINE FIELD(#BNDHDR2) TYPE(*CHAR) LENGTH(5)
DEFINE FIELD(#BNDHDRFIL) TYPE(*CHAR) LENGTH(90)
DEFINE FIELD(#BNDLGLFIL) TYPE(*CHAR) LENGTH(40)
DEFINE FIELD(#BNDDTL1) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#BNDDTLFIL) TYPE(*CHAR) LENGTH(40)
**********
DEF_LIST NAME(#MAPLST) FIELDS((#BNDMAPS) (#BNDMAPL)) TYPE(*WORKING)
**********
DEF_LIST NAME(#HDRLST) FIELDS((#BNDHDR1) (#BNDHDR2) (#BNDHDRFIL)) TYPE(*WORKING) ENTRYS(100)
**********
DEF_LIST NAME(#HDRLGL) FIELDS((#BNDHDR1) (#BNDHDR2) (#BNDLGLNME)(#BNDLGLDSC) (#BNDLGLFIL)) TYPE(*WORKING) ENTRYS(100)
**********
DEF_LIST NAME(#DTLLST) FIELDS((#BNDDTL1) (#BNDDTLFIL)) TYPE(*WORKING) ENTRYS(1000)
**********
DEF_LIST NAME(#FLDTABLE) FIELDS((#BNDFILNME) (#BNDFILLIB) (#BNDFLDSTS) (#BNDFLDNME) (#BNDFLDTYP) (#BNDFLDLEN) (#BNDFLDDEC) (#BNDFLDREF) (#BNDFLDDSC)) TYPE(*WORKING) ENTRYS(1000)
**********
DEF_LIST NAME(#KEYTABLE) FIELDS((#BNDFILNME) (#BNDFILLIB) (#BNDFLDNME)) TYPE(*WORKING) ENTRYS(100)
**********
DEF_LIST NAME(#LGLTABLE) FIELDS((#BNDFILNME) (#BNDFILLIB) (#BNDLGLNME) (#BNDLGLDSC)) TYPE(*WORKING) ENTRYS(500)
**********
********** 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 FILNAME and FILLIB
**********
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 datasource
**********
USE BUILTIN(JSM_COMMAND) WITH_ARGS('CREATE DATASOURCE(REPOSITORY)') TO_GET(#JSMSTS #JSMMSG)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** Select fields
**********
USE BUILTIN(GET_FILE_INFO) WITH_ARGS(#BNDFILNME #BNDFILLIB 'FIELDS') TO_GET(#BNDRTNCDE #HDRLST #DTLLST)
**********
IF COND('#BNDRTNCDE *EQ OK')
**********
SELECTLIST NAMED(#DTLLST)
**********
CHANGE FIELD(#BNDFLDNME) TO(#BNDDTL1)
CHANGE FIELD(#BNDFLDLEN) TO(*ZERO)
CHANGE FIELD(#BNDFLDDEC) TO(*ZERO)
CHANGE FIELD(#BNDFLDREF) TO(*BLANK)
CHANGE FIELD(#BNDFLDTYP) TO(*BLANK)
CHANGE FIELD(#BNDFLDDSC) TO(*BLANK)
**********
USE BUILTIN(GET_FIELD) WITH_ARGS(#BNDFLDNME) TO_GET(#BNDRTNCDE #BNDFLDTYP #BNDFLDLEN #BNDFLDDEC #BNDFLDREF #BNDFLDDSC)
**********
********** OK - Defined in repository
********** ER - Defined in function
********** Sample job log message
********** Field named STATE not found in the data dictionary
**********
CHANGE FIELD(#BNDFLDSTS) TO(#BNDRTNCDE)
**********
ADD_ENTRY TO_LIST(#FLDTABLE)
**********
ENDSELECT
**********
ENDIF
**********
CHANGE FIELD(#JSMCMD) TO('PUT OBJECT(*TABLE) NAME(FILE_FIELD_LIST) SERVICE_LIST(BNDFILNME,BNDFILLIB,BNDFLDSTS,BNDFLDNME,BNDFLDTYP,BNDFLDLEN,BNDFLDDEC,BNDFLDREF,BNDFLDDSC)')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG #FLDTABLE)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
********** Select keys
**********
CLR_LIST NAMED(#HDRLST)
CLR_LIST NAMED(#DTLLST)
**********
USE BUILTIN(GET_FILE_INFO) WITH_ARGS(#BNDFILNME #BNDFILLIB 'PHYKEYS') TO_GET(#BNDRTNCDE #HDRLST #DTLLST)
**********
IF COND('#BNDRTNCDE *EQ OK')
**********
SELECTLIST NAMED(#DTLLST)
**********
CHANGE FIELD(#BNDFLDNME) TO(#BNDDTL1)
ADD_ENTRY TO_LIST(#KEYTABLE)
**********
ENDSELECT
**********
CHANGE FIELD(#JSMCMD) TO('PUT OBJECT(*TABLE) NAME(FILE_KEY_LIST) SERVICE_LIST(BNDFILNME,BNDFILLIB,BNDFLDNME)')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG #KEYTABLE)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
ENDIF
**********
********** Select logical
**********
CLR_LIST NAMED(#HDRLST)
CLR_LIST NAMED(#DTLLST)
**********
USE BUILTIN(GET_FILE_INFO) WITH_ARGS(#BNDFILNME #BNDFILLIB 'LGLVIEWS') TO_GET(#BNDRTNCDE #HDRLGL #DTLLST)
**********
IF COND('#BNDRTNCDE *EQ OK')
**********
SELECTLIST NAMED(#HDRLGL)
**********
ADD_ENTRY TO_LIST(#LGLTABLE)
**********
ENDSELECT
**********
CHANGE FIELD(#JSMCMD) TO('PUT OBJECT(*TABLE) NAME(LOGICAL_LIST) SERVICE_LIST(BNDFILNME,BNDFILLIB,BNDLGLNME,BNDLGLDSC)')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG #LGLTABLE)
EXECUTE SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)
**********
ENDIF
**********
********** Send datasource
**********
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(BNDFILNME)
CHANGE FIELD(#BNDMAPL) TO(FILE_NAME)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFILLIB)
CHANGE FIELD(#BNDMAPL) TO(FILE_LIBRARY)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFLDSTS)
CHANGE FIELD(#BNDMAPL) TO(FIELD_STATUS)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFLDNME)
CHANGE FIELD(#BNDMAPL) TO(FIELD_NAME)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFLDTYP)
CHANGE FIELD(#BNDMAPL) TO(FIELD_TYPE)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFLDLEN)
CHANGE FIELD(#BNDMAPL) TO(FIELD_LENGTH)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFLDDEC)
CHANGE FIELD(#BNDMAPL) TO(FIELD_DECIMAL)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFLDREF)
CHANGE FIELD(#BNDMAPL) TO(FIELD_REF)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDFLDDSC)
CHANGE FIELD(#BNDMAPL) TO(FIELD_DESC)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDLGLNME)
CHANGE FIELD(#BNDMAPL) TO(LOGICAL_NAME)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDLGLLIB)
CHANGE FIELD(#BNDMAPL) TO(LOGICAL_LIBRARY)
ADD_ENTRY TO_LIST(#MAPLST)
**********
CHANGE FIELD(#BNDMAPS) TO(BNDLGLDSC)
CHANGE FIELD(#BNDMAPL) TO(LOGICAL_DESC)
ADD_ENTRY TO_LIST(#MAPLST)
**********
ENDROUTINE