SET219E

LANSA

SET219E
* =======================================================
* Process ........: SET_219
* Function .......: SET219E
* Created on .....: 7th November, 2001
* Description ....: Caller example -> Display Employee
* Version.........: 1
*
* Full Description:
*
* This function is a simple example of how SET219Y can
* be used to manage calls to functions on remote systems.
*
* In this case SET219E requests that you input a full or
* partial employee name. It then calls SET219F on the
* specified remote server to return a list of all the
* employees whose names match the rqeuested value.
*
* =======================================================
* ============== D E F I N I T I O N S ================
* =======================================================
Function Options(*LIGHTUSAGE *DIRECT)
Define Field(#SERVERURL) Reffld(#S_219HOST)
Def_List Name(#EMPLIST) Fields(#EMPNO #SURNAME #GIVENAME #POSTCODE)
* =======================================================
* ================ M A I N L O G I C ===============
* =======================================================
Execute Subroutine(EMPLOYEES)
Execute Subroutine(CLOSE)
Exchange Fields(#SERVERURL)
Menu
* =======================================================
* ======= U N I Q U E S U B R O U T I N E S ========
* =======================================================
Subroutine Name(EMPLOYEES)
Define Field(#RQSURNAME) Reffld(#SURNAME)
*
* Default the server value
*
If_Null Field(#SERVERURL)
Use Builtin(TCONCAT) With_Args(*S_HOSTURL ':' *S_HOSTPORT) To_Get(#SERVERURL)
Endif
*
* Loop until terminated by menu/cancel key
*
Begin_Loop
*
* Ask for the server URL name and employee surname
*
Request Fields(#SERVERURL #RQSURNAME) Identify(*LABEL) Browselist(#EMPLIST) Exit_Key(*NO) Menu_Key(*YES *RETURN) Prompt_Key(*NO) Cursor_Loc(*atfield #RQSURNAME)
*
* Clear any existing argument details
*
Execute Subroutine(CLEAR_ARGS)
*
* Set up the full or partial name to pass to SET219F
*
Execute Subroutine(SET_ALPHA) With_Parms(SURNAME *BLANKS 1 #RQSURNAME)
*
* Call SET219F on the remote server system
*
Execute Subroutine(CALL) With_Parms(SET219F #SERVERURL)
*
* Fill browselist #EMPLIST from the symbolic list
* returned by SET219F
*
Clr_List Named(#EMPLIST)
Execute Subroutine(GET_NUMBER) With_Parms(LISTCOUNT *BLANKS 1 #LISTCOUNT)
Begin_Loop Using(#STD_NUM) To(#LISTCOUNT)
Execute Subroutine(GET_ALPHA) With_Parms(EMPLIST EMPNO #STD_NUM #EMPNO)
Execute Subroutine(GET_ALPHA) With_Parms(EMPLIST SURNAME #STD_NUM #SURNAME)
Execute Subroutine(GET_ALPHA) With_Parms(EMPLIST GIVENAME #STD_NUM #GIVENAME)
Execute Subroutine(GET_NUMBER) With_Parms(EMPLIST POSTCODE #STD_NUM #POSTCODE)
Add_Entry To_List(#EMPLIST)
End_Loop
*
* Loop around to show the results and get the next name
*
End_Loop
*
Endroutine
*
* =======================================================
* ======== C O M M O N S U B R O U T I N E S =========
* =======================================================
* This set of subroutines are simple interfaces to RDML
* function SET219Y. They can be copied from this function
* and used in other similar functions unchanged.
* =======================================================
*
* -------------------------------------------------------
* Use CLEAR_Args to clear the current set of values
* -------------------------------------------------------
Subroutine Name(CLEAR_ARGS)
Execute Subroutine(CALL_219Y) With_Parms(CLEAR)
Endroutine
* -------------------------------------------------------
* Use SET_ALPHA to pass an alphanumeric value
* -------------------------------------------------------
Subroutine Name(SET_ALPHA) Parms((#S_219NAM1 *RECEIVED) (#S_219NAM2 *RECEIVED) (#S_219NAMI *RECEIVED) (#S_219AVAL *RECEIVED))
Execute Subroutine(CALL_219Y) With_Parms(SETALP)
Endroutine
* -------------------------------------------------------
* Use GET_ALPHA to return an alphanumeric value
* -------------------------------------------------------
Subroutine Name(GET_ALPHA) Parms((#S_219NAM1 *RECEIVED) (#S_219NAM2 *RECEIVED) (#S_219NAMI *RECEIVED) #S_219AVAL)
Execute Subroutine(CALL_219Y) With_Parms(GETALP)
Endroutine
* -------------------------------------------------------
* Use GET_NUMBER to return an alphanumeric value
* -------------------------------------------------------
Subroutine Name(GET_NUMBER) Parms((#S_219NAM1 *RECEIVED) (#S_219NAM2 *RECEIVED) (#S_219NAMI *RECEIVED) #S_219NVAL)
Execute Subroutine(CALL_219Y) With_Parms(GETNUM)
Endroutine
* -------------------------------------------------------
* Use CALL to call a function
* -------------------------------------------------------
Subroutine Name(CALL) Parms((#S_219FUNC *RECEIVED) (#S_219HOST *RECEIVED))
Define Field(#W_219HOST) Reffld(#S_219HOST)
Use Builtin(UPPERCASE) With_Args(#S_219HOST) To_Get(#W_219HOST)
If Cond('#W_219HOST = LOCAL')
Call Process(*DIRECT) Function(#S_219FUNC) Exit_Used(*NEXT) Menu_Used(*NEXT) If_Error(*NEXT)
Else
Execute Subroutine(CALL_219Y) With_Parms(CLIENTCALL)
Endif
Endroutine
* -------------------------------------------------------
* Use CLOSE to close down SET219Y
* -------------------------------------------------------
Subroutine Name(CLOSE)
Execute Subroutine(CALL_219Y) With_Parms(CLOSE)
Endroutine
* -------------------------------------------------------
* CALL_219Y is used to consolidate calls to SET219Y
* -------------------------------------------------------
Subroutine Name(CALL_219Y) Parms((#S_219OPER *RECEIVED))
Exchange Fields(#S_219OPER #S_219NAM1 #S_219NAM2 #S_219NAMI #S_219AVAL #S_219NVAL #S_219HOST #S_219FUNC)
Call Process(*DIRECT) Function(SET219Y)
Endroutine