RDML for SET214G

LANSA

RDML for SET214G
* =======================================================
* Process ........: SET_214
* Function .......: SET214G
* Created on .....: 19/11/01 at 13:24:10
*
* Full Description:
*
* This 5250 function requests some basic
* Order information. The information is validated
* and then and passed on to SET214R to use JSM and
* send the information to the web service SET216S to
* create the Order.
* Refer to SET214R and SET216S for details on how to use
* JSM to do two way XML transactions.
*
* A host selection is required. The selected host is the
* the host where the status of the order is looked up.
* If you select the lansa host, a dummy program
* will send back a response with order details status.
*
* Disclaimer: The following material is supplied as an
* example only. No warranty is expressed or implied.
*
* ======================================================*
Function Options(*DIRECT)
*
* Lansa host name and port
Define Field(#LANSAHOST) Reffld(#S_214HOST) Input_Atr(LC) Default('demo.lansa.com.au')
*
Override Field(#S_214HOST) Label('Your Host:Port')
*
* Conditions to verify the chosen transaction service
Def_Cond Name(*LANSAHOST) Cond('(#S_214HOST = *BLANKS) or (#s_214host = demo.lansa.com.au)')
*
* Browselist to select product and quantity to create the
* order detail records. The selected product and quantity
* are added to the OUT_LIST working list and exchanged
Def_List Name(#INP_LIST) Fields(#S_214PROD (#S_214QTY *INPUT))
*
* Working list with product and quantity values required
* to create the order detail records
Def_List Name(#OUT_LIST) Fields(#S_214PROD #S_214QTY) Counter(#LISTCOUNT) Type(*WORKING)
*
Define Field(#BERRCOUNT) Reffld(#LISTCOUNT)
Def_Cond Name(*NO_ERRORS) Cond('#s_214ERRO = *blanks')
*
* Incoming working list with validation errors if they
* occurred
Def_List Name(#INERR_LST) Fields(#S_214ERRO) Type(*WORKING)
*
* Group of fields in the request command
Group_By Name(#PANELDATA) Fields((#STD_INSTR *L3 *P2 *NOID *OUTPUT) (#STD_INST2 *L8 *P2 *NOID *OUTPUT) (#S_214CUST *L10 *P2) (#S_214SADD *L11 *P2) (#S_214BADD *L12 *P2) (#S_214HOST *L5 *P2))
* Group of Order fields displayed when the Order was
* successfully created
Group_By Name(#ORDER_PNL) Fields((#STD_INSTR *L3 *P2 *NOID) (#S_214CUST *L8 *P20) (#S_214ORDN *L6 *P20) (#S_214COST *L10 *P20) (#S_214SDAT *L12 *P20) (#S_214STAT *L14 *P20))
*
* Group of fields to store order information going out:
* S_214BADD - billing address
* S_214SADD - Shipment address
* S_214CUST - customer name
*
* And coming back in (provided no validation errors
* occurred):
* 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)
*
Clr_List Named(#INP_LIST)
*
* Prefill the input list with hard coded products and
* quantities
Execute Subroutine(PREFIL_LST) With_Parms('Modem' 100)
Execute Subroutine(PREFIL_LST) With_Parms('Network Card' 100)
Execute Subroutine(PREFIL_LST) With_Parms('Sound Card' 100)
*
* Open the Java service manager. The open and close of
* JSM are handled by the function SETJSMO across all
* examples.
Execute Subroutine(OP_CL_JSM) With_Parms(OPEN)
*
Change Field(#STD_INSTR) To('''Specify Transaction Server Host and Port. Blank out to use a LANSA Host.''')
*
* Change the host field to the value of the SET system
* variable S_HOSTURL. This variable is used across the
* SET collection to hold the value of the host location.
* Depending on whether you have executed other SET
* examples, this variable might or might not have a value
* If it has a value, concatenate it with the host port
* value held in a system variable with the same
* functionality as S_HOSTURL
Execute Subroutine(SET_HOST)
* Loop until F12
Begin_Loop
*
Clr_List Named(#OUT_LIST)
*
Change Field(#STD_INST2) To('''Type Customer Name, Shipment and Billing Address and quantity for each product''')
*
* Request Customer name, Shipment and billing address and
* product quantities
Request Fields(#PANELDATA) Identify(*LABEL) Browselist(#INP_LIST) Exit_Key(*YES CLS) Menu_Key(*YES CLS) Prompt_Key(*NO)
*
* Select the entries of the input browselist and add them
* to the exchange working list
Selectlist Named(#INP_LIST)
Continue If('#S_214QTY *EQ *ZEROS')
Add_Entry To_List(#OUT_LIST)
Endselect
*
* If no quantity was typed in, redisplay request screen
Continue If('#LISTCOUNT = 0')
*
* Set the exchanged fields with the host value and the
* URI (Uniform Resource I). The URI value is a symbolic
* name resolved in file DC@W29 to a process and function
* name and partition identifier for the service to run.
If Cond(*LANSAHOST)
Change Field(#S_214HOST) To(#LANSAHOST)
Change Field(#S_214URI) To('ALICKS DUMMY PROGRAM')
Else
Change Field(#S_214URI) To(SET216_ORDER_SERVICE)
Endif
*
* Call the interface program to send the requested data
* and receive back the order details
Clr_List Named(#INERR_LST)
Exchange Fields(#OUT_DATA)
Call Process(*DIRECT) Function(SET214R) Exit_Used(*NEXT) Menu_Used(*NEXT) Pass_Lst(#OUT_LIST #INERR_LST)
*
* Verify whether any validation error occurred when
* creating the orders.
Change Field(#S_214ERRO) To(*BLANKS)
Selectlist Named(#INERR_LST)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#S_214ERRO)
Endselect
*
* If no errors occurred, display the order details.
* Otherwise display the errors in a browselist.
If Cond(*NO_ERRORS)
Change Field(#STD_INSTR) To('''Here are the order details. Press Enter to place another Order.''')
Display Fields(#ORDER_PNL) Exit_Key(*YES CLS) Menu_Key(*YES CLS) Prompt_Key(*NO)
Change Field(#STD_INSTR) To('''Specify Transaction Server Host and Port. Blank out to use a LANSA Host.''')
Else
Change Field(#STD_INSTR) To('''Validation errors occured. Review error messages and correct the errors.''')
Endif
*
End_Loop
*
* Close JSM
CLS: Execute Subroutine(OP_CL_JSM) With_Parms(CLOSE)
Return
*
Subroutine Name(SET_HOST)
Change Field(#S_214HOST) To(*S_HOSTURL)
If Cond('#s_214host *ne *blanks')
Use Builtin(TCONCAT) With_Args(#S_214HOST ':' *S_HOSTPORT) To_Get(#S_214HOST)
Endif
Endroutine
*
Subroutine Name(PREFIL_LST) Parms(#S_214PROD #S_214QTY)
* Prefill the browselist with product names
Add_Entry To_List(#INP_LIST)
Endroutine
*
* Call SETJSMO to issue a JSM open or close
*
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
*