SET219B

LANSA

SET219B
* =======================================================
* Process ........: SET_219
* Function .......: SET219B
* Created on .....: 7th November, 2001
* Description ....: Called example -> Perform Calculation
* Version.........: 1
* Full Description:
* This function is called by SET219A. As arguments it
* receives 2 numbers and a name. The sum of the numbers
* and the reversal of the name are returned to SET219A.
*
* While the processing involved here is trivial, SET219A
* and SET219B together demonstrate the essentials of
* parameter passing between RDML functions running on
* different systems.
*
* =======================================================
* ============== D E F I N I T I O N S ================
* =======================================================
Function Options(*LIGHTUSAGE *DIRECT)
*
* Temporary fields
*
Define Field(#TEMP_N1) Reffld(#STD_NUM) Desc('Temporary number 1')
Define Field(#TEMP_N2) Reffld(#STD_NUM) Desc('Temporary number 2')
Define Field(#TEMP_NAME) Reffld(#STD_TEXTS) Desc('Temporary Name')
*
* =======================================================
* ================ M A I N L O G I C ===============
* =======================================================
*
* Get the values passed in by SET219A. The arguments were
* passed with the symbolic names NUMBER1, NUMBER and NAME
* The associated values are mapped into fields #TEMP_N1,
* #TEMP_N2 and #TEMP_NAME respectively
*
Execute Subroutine(GET_NUMBER) With_Parms(NUMBER1 *BLANKS 1 #TEMP_N1)
Execute Subroutine(GET_NUMBER) With_Parms(NUMBER2 *BLANKS 1 #TEMP_N2)
Execute Subroutine(GET_ALPHA) With_Parms(NAME *BLANKS 1 #TEMP_NAME)
*
* Now clear the argument / return value list
*
Execute Subroutine(CLEAR_ARGS)
*
* Do the required "calculations", issue some messages
* and set up the values to be returned to SET219A
*
Change Field(#STD_NUM) To('#TEMP_N1 + #TEMP_N2')
Execute Subroutine(SET_NUMBER) With_Parms(RESULT *BLANKS 1 #STD_NUM)
Message Msgtxt('The addition was performed')
*
Use Builtin(REVERSE) With_Args(#TEMP_NAME) To_Get(#TEMP_NAME)
Execute Subroutine(SET_ALPHA) With_Parms(NAME *BLANKS 1 #TEMP_NAME)
Message Msgtxt('The name was reversed')
*
* Finished ... return control to SET219A
*
Return
*
* =======================================================
* ======== 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 SET_NUMBER to pass a numeric value
* -------------------------------------------------------
Subroutine Name(SET_NUMBER) Parms((#S_219NAM1 *RECEIVED) (#S_219NAM2 *RECEIVED) (#S_219NAMI *RECEIVED) (#S_219NVAL *RECEIVED))
Execute Subroutine(CALL_219Y) With_Parms(SETNUM)
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
* -------------------------------------------------------
* 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