JSMLR04 LANSA File List

LANSA Integrator

JSMLR04 LANSA File List

 

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(#BNDFILSTR) TYPE(*CHAR) LENGTH(10)

DEFINE     FIELD(#BNDFILNME) TYPE(*CHAR) LENGTH(10)

DEFINE     FIELD(#BNDFILLIB) TYPE(*CHAR) LENGTH(10)

DEFINE     FIELD(#BNDFILDSC) TYPE(*CHAR) LENGTH(40)

DEFINE     FIELD(#BNDFILFIL) TYPE(*CHAR) LENGTH(10)

**********

DEF_LIST   NAME(#MAPLST) FIELDS((#BNDMAPS) (#BNDMAPL)) TYPE(*WORKING)

**********

DEF_LIST   NAME(#FILLST) FIELDS((#BNDFILNME) (#BNDFILLIB) (#BNDFILDSC) (#BNDFILFIL)) TYPE(*WORKING) ENTRYS(2000)

**********

DEF_LIST   NAME(#FILTABLE) FIELDS((#BNDFILNME) (#BNDFILLIB) (#BNDFILDSC)) TYPE(*WORKING) ENTRYS(2000)

**********

********** 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

**********

CHANGE     FIELD(#JSMCMD) TO('SERVICE_LOAD SERVICE(RFIDataSourceService) SERVICE_LIST(BNDMAPS,BNDMAPL) 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)

**********

********** Add files

**********

USE        BUILTIN(GET_PHYSICAL_LIST) WITH_ARGS(#BNDFILSTR) TO_GET(#FILLST)

**********

SELECTLIST NAMED(#FILLST)

**********

ADD_ENTRY  TO_LIST(#FILTABLE)

**********

ENDSELECT

**********

CHANGE     FIELD(#JSMCMD) TO('PUT OBJECT(*TABLE) NAME(FILE_LIST) SERVICE_LIST(BNDFILNME,BNDFILLIB,BNDFILDSC)')

USE        BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG #FILTABLE)

EXECUTE    SUBROUTINE(CHECK) WITH_PARMS(#JSMSTS #JSMMSG)

**********

********** 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(BNDFILDSC)

CHANGE     FIELD(#BNDMAPL) TO(FILE_DESC)

ADD_ENTRY  TO_LIST(#MAPLST)

**********

ENDROUTINE