RDML for SET215R

LANSA

RDML for SET215R
* =======================================================
* Process ........: SET_215
* Function .......: SET215R
* Created on .....: 19/10/01 at 11:41:13
* Description ....: Function Skeleton
* Version.........: 1
*
* Full Description:
*
* This function is called by SET215G and SET215W.
* It is exchanged the group of fields #OUT_DATA
* and receives two working lists:
*
* #OUT_LIST has information about the order that will
* be created. It also has fields with information about
* the host where the service will run and hence where
* the order is created.
*
* #INERR_LST is passed to the service in order to
* have the validation errors returned if any occur.
*
* Service used: HTTPCLIENT
*
* For the SEND command.
* HANDLER: outbound xml (OXML).
* XSL: set215_order_request_out
*
* For the RECEIVE command.
* HANDLER: inbound xml (IXML).
* XSL: set215_order_response_in
*
* Disclaimer: The following material is supplied as an
* example only. No warranty is expressed or implied.
*
* ======================================================*
Function Options(*DIRECT) Rcv_List(#OUT_LIST #IN_LIST)
*
Define Field(#KEYWORD) Reffld(#STD_TEXT)
Define Field(#KEYW_VAL1) Reffld(#STD_TEXTL)
Define Field(#KEYW_VAL2) Reffld(#STD_TEXTL)
*
* Working list with order numbers going out.
Def_List Name(#OUT_LIST) Fields(#S_214ORDN) Counter(#LISTCOUNT) Type(*WORKING)
* Working list with order status details returned from
* the service. Note that all the information is returned
* in ONE list, including the errors. Hence, if one order
* had orginated more than one error, the list could be
* visualized like this:
* <order n> <status> <cost> <Shipment date> <error 1>
* <order n> <status> <cost> <Shipment date> <error 2>
* <order n> <status> <cost> <Shipment date> <error 3>
* <order n+1> <status> <cost> <Shipment date> <error 1>
* etc
Def_List Name(#IN_LIST) Fields(#S_214ORDN #S_214STAT #S_214COST #S_214SDAT #S_214IOST #S_214ERRO) Type(*WORKING)
*
* Run the service in the lansa demo site.
Def_Cond Name(*LANSAHOST) Cond('#S_214URI = SET215SRV')
*
* Group of fields to exchange with host related
* information
Group_By Name(#OUT_DATA) Fields(#S_214HOST #S_214URI)
*
* Working list with incoming errors
Def_List Name(#INERR_LST) Fields(#S_214ERRO) Type(*WORKING)
Change Field(#S_JSMSTS #S_JSMMSG) To(*BLANKS)
*
* Load HTTPCLIENT service
Execute Subroutine(START_CMD) With_Parms('SERVICE_LOAD')
Execute Subroutine(KEYWRD) With_Parms('SERVICE' 'HTTPCLIENT' *BLANKS)
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG)
Execute Subroutine(CHECK_STS)
*
* Build the SEND command
*
* HANDLER(OXML) refers to the outbound xml handler
* Refer to the HTTPService.properties file that in the
* Properties directory of your JSM installation (for
* example /jsm/instance/properties/).
*
* XSL(set215_orderstatus_request_out) is a reference to
* the style sheet used to transform the XML going out.
* set215_orderstatus_request_out is a symbolic name.
* The JSM will look up the symbolic name in the
* HTTPCLIENT services' properties file and convert it to
* a real value. In this case the real value is
* set215_orderstatus_request_outbound.xsl
*
* HOST is the value entered in either User Interfaces. It
* is the Host of the transaction server.
*
* URI is the symbolic name looked up in file DC@W29. It
* resolves to the transaction server host, the name of
* the process/function service and partition idl.
*
* SERVICE_LIST has the names of the fields that define
* the working list #OUT_LIST.
Execute Subroutine(START_CMD) With_Parms('SEND')
Execute Subroutine(KEYWRD) With_Parms('HANDLER' 'OXML' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('XSL' 'set215_orderstatus_request_out' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('HOST' #S_214HOST *BLANKS)
Execute Subroutine(KEYWRD) With_Parms(METHOD '*POST' *BLANKS)
*
If Cond(*LANSAHOST)
Execute Subroutine(KEYWRD) With_Parms('URI' '/cgi-bin/' #S_214URI)
Else
Execute Subroutine(KEYWRD) With_Parms('URI' '/cgi-bin/jsmdirect?' #S_214URI)
Endif
*
Execute Subroutine(KEYWRD) With_Parms('SERVICE_LIST' 'S_214ORDN' *BLANKS)
*
* SEND order numbers.The receiver process/function
* of this SEND is a value looked up in file DC@W29 with
* the value specified in the URI parameter.
* If you chose your host, the value in the DC@W29 record
* for the key SET217_ORDERSTATUS_SERVICE, should be
* SET_217/SET217S
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG #OUT_LIST)
Execute Subroutine(CHECK_STS)
*
* Build the RECEIVE command
*
* HANDLER(IXML) refers to the inbound xml handler
* Refer to the HTTPService.properties file that in the
* Properties directory of your JSM installation (for
* example /jsm/instance/properties/).
*
* XSL(set215_orderstatus_response_in) is a reference to
* the style sheet used to transform the XML going out.
* set215_orderstatus_response_in is a symbolic name.
* The JSM will look up the symbolic name in the
* HTTPCLIENT services' properties file and convert it to
* a real value. In this case the real value is
* set215_orderstatus_response_inbound
*
* SERVICE_LIST has the field names that define he
* working list #IN_LIST. If any validation errors
* occured while attempting to create the Order will have
* been added into this working list. There are other
* fields that are also returned by the service that are
* automatically mapped into the function provided they
* are nominated in the style sheet and used
* in this function.
Execute Subroutine(START_CMD) With_Parms('RECEIVE')
Execute Subroutine(KEYWRD) With_Parms('HANDLER' 'IXML' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('XSL' 'set215_orderstatus_response_in' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('SERVICE_LIST' 'S_214ORDN,S_214STAT,S_214COST,' 'S_214SDAT,S_214IOST,S_214ERRO')
*
* Receive the Order Status information
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG #IN_LIST)
Execute Subroutine(CHECK_STS)
*
* Unload service
Execute Subroutine(START_CMD) With_Parms('SERVICE_UNLOAD')
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG)
Execute Subroutine(CHECK_STS)
*
* Return to caller exchanging back the working lists
Exchange Fields(#OUT_LIST #IN_LIST)
Return
*
* SUBROUTINES
*
Subroutine Name(START_CMD) Parms((#STD_TEXTS *RECEIVED))
Change Field(#S_JSMCMD) To(#STD_TEXTS)
Endroutine
*
Subroutine Name(KEYWRD) Parms(#KEYWORD #KEYW_VAL1 #KEYW_VAL2)
Use Builtin(BCONCAT) With_Args(#S_JSMCMD #KEYWORD) To_Get(#S_JSMCMD)
Use Builtin(TCONCAT) With_Args(#S_JSMCMD '(' #KEYW_VAL1 #KEYW_VAL2 ')') To_Get(#S_JSMCMD)
Endroutine
* Check the status of the JSM command issued
Subroutine Name(CHECK_STS)
*
Define Field(#MSGDTA) Type(*CHAR) Length(132)
*
If Cond('#S_JSMSTS *NE OK')
*
Use Builtin(BCONCAT) With_Args('Error Status Code: ' #S_JSMSTS) To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Use Builtin(BCONCAT) With_Args('Error Message: ' #S_JSMMSG) To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Use Builtin(BCONCAT) With_Args(*FUNCTION 'ended in error. Review previous messages.') To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Execute Subroutine(OP_CL_JSM) With_Parms(ABORT)
*
Endif
*
Endroutine
*
* Handle JSM open and close commands
Subroutine Name(OP_CL_JSM) Parms((#W_ACTION *RECEIVED))
Define Field(#W_ACTION) Type(*CHAR) Length(005)
Group_By Name(#S214O_FLD) Fields(#S_JSMSTS #S_JSMMSG #W_ACTION)
Exchange Fields(#S214O_FLD)
Call Process(*DIRECT) Function(SETJSMO) Exit_Used(*NEXT) Menu_Used(*NEXT)
Endroutine

*