RDML for SET214R

LANSA

RDML for SET214R
* =======================================================
* Process ........: SET_214
* Function .......: SET214R
* Created on .....: 19/10/01 at 11:41:13
* Description ....: Function Skeleton
* Version.........: 1
*
* Full Description:
*
* This function is called by SET214G and SET214W.
* 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 (which is where
* the order is created).
*
* #INERR_LST would have the validation errors if any
* occur.
*
* Service used: HTTPCLIENT
*
* For the SEND command.
* HANDLER: outbound xml (OXML).
* XSL: set214_order_request_out
*
* For the RECEIVE command.
* HANDLER: inbound xml (IXML).
* XSL: set214_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 #INERR_LST)
*
Define Field(#KEYWORD) Reffld(#STD_TEXT)
Define Field(#KEYW_VAL1) Reffld(#STD_TEXTL)
Define Field(#KEYW_VAL2) Reffld(#STD_TEXTL)
*
* Run the service in the lansa demo site.
Def_Cond Name(*LANSAHOST) Cond('#s_214uri = set214srv')
* Working list with product and quantity values required
* to create the order detail records
Def_List Name(#OUT_LIST) Fields(#S_214PROD #S_214QTY) Type(*WORKING)
*
* Group of fields to store order information going out:
* S_214BADD - billing address
* S_214SADD - Shipment address
* S_214CUST - customer name
*
* And coming back from the transaction server
* S_214ORDN - order number
* S_214COST - total cost of the order
* S_214SDAT - Shipment date
* S_214STAT - order status
Group_By Name(#OUT_DATA) Fields(#S_214BADD #S_214SADD #S_214CUST #S_214HOST #S_214URI #S_214ORDN #S_214COST #S_214SDAT #S_214STAT)
*
* Working list with validation errors coming back
* if any occurred.
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(set214_order_request_out) is a reference to the
* style sheet used to transform the XML going out.
* set214_order_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
* set214_order_request_outbound.xsl
*
* HOST is the value entered in either User Interfaces. It
* is the Transaction server host.
*
* 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. The working list name is
* specified as the third return value in the JSM command
* Built In function.
Execute Subroutine(START_CMD) With_Parms('SEND')
Execute Subroutine(KEYWRD) With_Parms('HANDLER' 'OXML' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('XSL' 'set214_order_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_214PROD,S_214QTY' *BLANKS)
*
* SEND order information. 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 SET216_ORDER_SERVICE, should be
* SET_216/SET216S
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(set214_order_response_in) is a reference to the
* style sheet used to transform the XML going out.
* set214_order_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
* set214_order_response_inbound.xsl
*
* SERVICE_LIST has the field names that define he
* working list #INERR_LIST. If any validation errors
* occur while creating an Order in the they 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 or defined
* in this function.
Execute Subroutine(START_CMD) With_Parms('RECEIVE')
Execute Subroutine(KEYWRD) With_Parms('HANDLER' 'IXML' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('XSL' 'set214_order_response_in' *BLANKS)
Execute Subroutine(KEYWRD) With_Parms('SERVICE_LIST' 'S_214ERRO' *BLANKS)
*
* Receive the order information back. Note that only the
* working list is specified. Fields that don't have
* multiple occurrances are mapped back into the function
* automatically.
Use Builtin(JSM_COMMAND) With_Args(#S_JSMCMD) To_Get(#S_JSMSTS #S_JSMMSG #INERR_LST)
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 list and
* status fields.
Exchange Fields(#OUT_DATA #INERR_LST)
Return
*
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
*
Subroutine Name(OP_CL_JSM) Parms((#W_ACTION *RECEIVED))
Define Field(#W_ACTION) Type(*CHAR) Length(005)
Group_By Name(#S_EXCHFLD) Fields(#S_JSMSTS #S_JSMMSG #W_ACTION)
Exchange Fields(#S_EXCHFLD)
Call Process(*DIRECT) Function(SETJSMO) Exit_Used(*NEXT) Menu_Used(*NEXT)
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
*