SET219D

LANSA

SET219D
* =======================================================
* Process ........: SET_219
* Function .......: SET219D
* Created on .....: 7th November, 2001
* Description ....: Called example -> Get Employee Detail
* Version.........: 1
* Full Description:
* This function is called by SET219C. As arguments it
* receives the employee number. It returns details of
* the employee and their associated skills.
*
* =======================================================
* ============== D E F I N I T I O N S ================
* =======================================================
Function Options(*LIGHTUSAGE *DIRECT)
Define Field(#SKILTOTAL) Reffld(#STD_NUM)
* =======================================================
* ================ M A I N L O G I C ===============
* =======================================================
*
* Get the employee number passed in by SET219C.
*
Execute Subroutine(GET_ALPHA) With_Parms(EMPNO *BLANKS 1 #EMPNO)
*
* Clear the argument / return values list
*
Execute Subroutine(CLEAR_ARGS)
*
* Get the employee details and skills and return them
*
Fetch Fields(#SURNAME #GIVENAME #SALARY #POSTCODE #DEPTMENT #SECTION) From_File(PSLMST) With_Key(#EMPNO)
*
* Return the standard I/O status with the name STATUS
*
Execute Subroutine(SET_ALPHA) With_Parms(STATUS *BLANKS 1 #IO$STS)
*
* If the employee was not found send back a message only
*
If_Status Is_Not(*OKAY)
Message Msgtxt('Employee details could not be found')
Else
*
* else, if found send back the basic details
*
Execute Subroutine(SET_ALPHA) With_Parms(SURNAME *BLANKS 1 #SURNAME)
Execute Subroutine(SET_ALPHA) With_Parms(GIVENAME *BLANKS 1 #GIVENAME)
Fetch Fields(#DEPTDESC) From_File(DEPTAB) With_Key(#DEPTMENT)
Execute Subroutine(SET_ALPHA) With_Parms(DEPTDESC *BLANKS 1 #DEPTDESC)
Fetch Fields(#SECDESC) From_File(SECTAB) With_Key(#DEPTMENT #SECTION)
Execute Subroutine(SET_ALPHA) With_Parms(SECDESC *BLANKS 1 #SECDESC)
Execute Subroutine(SET_NUMBER) With_Parms(SALARY *BLANKS 1 #SALARY)
Execute Subroutine(SET_NUMBER) With_Parms(POSTCODE *BLANKS 1 #POSTCODE)
*
* and then send back some skill details
*
Change Field(#SKILTOTAL) To(0)
Select Fields(#SKILCODE #GRADEDES) From_File(PSLSKL) With_Key(#EMPNO)
Change Field(#SKILTOTAL) To('#SKILTOTAL + 1')
Fetch Fields(#SKILDESC) From_File(SKLTAB) With_Key(#SKILCODE)
Execute Subroutine(SET_ALPHA) With_Parms(SKILLIST SKILDESC #SKILTOTAL #SKILDESC)
Execute Subroutine(SET_ALPHA) With_Parms(SKILLIST GRADEDES #SKILTOTAL #GRADEDES)
Endselect
*
* and also a count of how many skills were returned
*
Execute Subroutine(SET_NUMBER) With_Parms(SKILTOTAL *BLANKS 1 #SKILTOTAL)
*
Endif
*
* 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
* -------------------------------------------------------
* 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