RFIDataSourceServiceの例

LANSA Integrator

RFIDataSourceServiceの例


このLANSAファンクションは、クライアントのRFIExampleプログラム例のホスト・プログラムです。

********** Beginning of RDML commands **********               

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(#EMPNO) TYPE(*CHAR) LENGTH(5)                 

DEFINE     FIELD(#SURNAME) TYPE(*CHAR) LENGTH(20)              

DEFINE     FIELD(#GIVENAME) TYPE(*CHAR) LENGTH(20)             

DEFINE     FIELD(#ADDRESS1) TYPE(*CHAR) LENGTH(25)             

DEFINE     FIELD(#ADDRESS2) TYPE(*CHAR) LENGTH(25)             

DEFINE     FIELD(#ADDRESS3) TYPE(*CHAR) LENGTH(25)             

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

DEFINE     FIELD(#DATEACQR) TYPE(*DEC) LENGTH(6) DECIMALS(0)      

DEFINE     FIELD(#GRADE) TYPE(*CHAR) LENGTH(1)                    

DEFINE     FIELD(#COMMENT) TYPE(*CHAR) LENGTH(20)                 

DEF_LIST   NAME(#SKILL) FIELDS((#SKILCODE) (#DATEACQR) (#GRADE) (#

           COMMENT)) TYPE(*WORKING)                               

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

DEFINE     FIELD(#LNAME) TYPE(*CHAR) LENGTH(30)                   

DEF_LIST   NAME(#MAPLST) FIELDS((#SNAME) (#LNAME)) TYPE(*WORKING) 

DEF_LIST   NAME(#FLDLST) FIELDS((#SNAME)) TYPE(*WORKING)          

DEFINE     FIELD(#SOURCE) TYPE(*CHAR) LENGTH(50)        

********** Build 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(SNAME,LNAME) BIND(*FIELD)')            

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

           #JSMMSG #MAPLST)                                        

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

********** Check for inbound data source                           

USE        BUILTIN(JSM_COMMAND) WITH_ARGS('CHECK OBJECT(*DATASOURCE)') 

           TO_GET(#JSMSTS #JSMMSG)                                

IF         COND('#JSMSTS *EQ OK')                                  

********** Get employee id from data source                        

CHANGE     FIELD(#JSMCMD) TO('GET OBJECT(*FIELD) NAME(EMPNO) SERVI 

           CE_LIST(SNAME)')                                        

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

           #JSMMSG #FLDLST)                                        

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

CHANGE     FIELD(#JSMCMD) TO('GET OBJECT(*TABLE) NAME(SKILLS) SERV 

           ICE_LIST(SKILCODE,DATEACQR,GRADE,COMMENT)')             

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

           #JSMMSG #SKILL)                                         

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

ENDIF                                                              

********** Create data source                                      

USE        BUILTIN(JSM_COMMAND) WITH_ARGS('CREATE DATASOURCE(EMPLOYEE) 

           ') TO_GET(#JSMSTS #JSMMSG)                              

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

********** Add skills to data source                               

EXECUTE    SUBROUTINE(SKILL)                                       

CHANGE     FIELD(#JSMCMD) TO('PUT OBJECT(*TABLE) NAME(SKILLS) SERV 

           ICE_LIST(SKILCODE,DATEACQR,GRADE,COMMENT)')             

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

           #JSMMSG #SKILL)                                         

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

********** Add fields to data source                               

CHANGE     FIELD(#EMPNO) TO(A1001)                                 

CHANGE     FIELD(#GIVENAME) TO(JOANNE)                              

CHANGE     FIELD(#SURNAME) TO(JONES)                             

EXECUTE    SUBROUTINE(FIELDS)                                      

CHANGE     FIELD(#JSMCMD) TO('PUT OBJECT(*FIELD) SERVICE_LIST(SNAM 

           E)')                                                    

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

           #JSMMSG #FLDLST)                                        

********** Send data source to client                              

USE        BUILTIN(JSM_COMMAND) WITH_ARGS('SEND OBJECT(*DATASOURCE 

           )') TO_GET(#JSMSTS #JSMMSG)                             

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

********** 'Close service'                                         

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')                                 

********** Close service and send the HTTP response               

USE        BUILTIN(JSM_CLOSE) TO_GET(#JSMSTS #JSMMSG) 

ENDIF                                                 

ENDROUTINE                                            

SUBROUTINE NAME(FIELDS)                               

CHANGE     FIELD(#SNAME) TO(EMPNO)                    

ADD_ENTRY  TO_LIST(#FLDLST)                           

CHANGE     FIELD(#SNAME) TO(GIVENAME)                 

ADD_ENTRY  TO_LIST(#FLDLST)                           

CHANGE     FIELD(#SNAME) TO(SURNAME)     

ADD_ENTRY  TO_LIST(#FLDLST)              

ENDROUTINE                               

SUBROUTINE NAME(BLDMAP)                  

CHANGE     FIELD(#SNAME) TO(EMPNO)       

CHANGE     FIELD(#LNAME) TO(EMPLOYEE_ID) 

ADD_ENTRY  TO_LIST(#MAPLST)              

CHANGE     FIELD(#SNAME) TO(SURNAME)     

CHANGE     FIELD(#LNAME) TO(*BLANK)     

ADD_ENTRY  TO_LIST(#MAPLST)             

CHANGE     FIELD(#SNAME) TO(GIVENAME)   

CHANGE     FIELD(#LNAME) TO(FIRST_NAME) 

ADD_ENTRY  TO_LIST(#MAPLST)             

CHANGE     FIELD(#SNAME) TO(SKILCODE)   

CHANGE     FIELD(#LNAME) TO(SKILL)      

ADD_ENTRY  TO_LIST(#MAPLST)             

CHANGE     FIELD(#SNAME) TO(DATEACQR)   

CHANGE     FIELD(#LNAME) TO(ACQUIRED)   

ADD_ENTRY  TO_LIST(#MAPLST)         

CHANGE     FIELD(#SNAME) TO(GRADE)  

CHANGE     FIELD(#LNAME) TO(*BLANK) 

ADD_ENTRY  TO_LIST(#MAPLST)         

CHANGE     FIELD(#SNAME) TO(COMMENT)

CHANGE     FIELD(#LNAME) TO(*BLANK) 

ADD_ENTRY  TO_LIST(#MAPLST)         

ENDROUTINE                          

SUBROUTINE NAME(SKILL)              

CHANGE     FIELD(#SKILCODE) TO(RPG)                   

CHANGE     FIELD(#DATEACQR) TO(991202)                

CHANGE     FIELD(#GRADE) TO(A)                        

CHANGE     FIELD(#COMMENT) TO('Good knowledge')       

ADD_ENTRY  TO_LIST(#SKILL)                            

CHANGE     FIELD(#SKILCODE) TO(CL)                    

CHANGE     FIELD(#DATEACQR) TO(981102)                

CHANGE     FIELD(#GRADE) TO(B)                        

CHANGE     FIELD(#COMMENT) TO('Improvement required') 

ADD_ENTRY  TO_LIST(#SKILL)                            

ENDROUTINE

********** End of RDML commands **********