SET208Q
* =======================================================
* Process ........: SET_208
* Function .......: SET208Q
* Description ....: Handle Employee Query
*
* This function is called by SET208H to handle the
* processing of an employee query request that has been
* received in MS-Word document SET208Q.DOC
*
* Disclaimer: The following material is supplied as
* sample material only. No warranty concerning the
* material or its use in any way whatsoever is
* expressed or implied.
*
* =======================================================
FUNCTION OPTIONS(*DIRECT *LIGHTUSAGE)
*
* Define the report Lines
*
DEF_REPORT FORMSIZE(*DEFAULT 132) OTHER_OVR('SPLFNAME(SET208Q)')
DEF_HEAD NAME(#HEAD01) FIELDS((#DATE *L001 *P002) (#TIME *L001 *P016) (#FUNCTION *L002 *P002) (#REP1PAGE *L003 *P002))
DEF_LINE NAME(#DETAIL01) FIELDS((#EMPNO *L001 *P001 *COL) (#SURNAME *L001 *P013 *COL) (#GIVENAME *L001 *P034 *COL) (#STARTDTE *L001 *P055 *COL) (#PHONEBUS *L001 *P066 *COL) (#PHONEHME *L001 *P088 *COL) (#ADDRESS1 *L001 *P108 *COL) (#ADDRESS2 *L002 *P108) (#ADDRESS3 *L003 *P108) (#POSTCODE *L004 *P108 *LAB)) SPACE_BEF(002) SPACE_AFT(000) IDENTIFY(*NOID)
DEF_LINE NAME(#DETAIL02) FIELDS((#SKILCODE *L001 *P012) (#SKILDESC *L001 *P024) (#GRADE *L001 *P045) (#COMMENT *L001 *P047) (#DATEACQ *L001 *P068)) SPACE_BEF(001) SPACE_AFT(000) IDENTIFY(*NOID)
DEF_LINE NAME(#MESSAGE) FIELDS((#S_208MSG *NOID)) SPACE_BEF(3) SPACE_AFT(3)
*
* Locally defined fields
*
DEFINE FIELD(#INSTANCE) REFFLD(#STD_NUM)
*
* Initialize fields
*
CHANGE FIELD(#S_208SPLF) TO(*Blanks)
*
* Up to 10 employee numbers can be specified
*
BEGIN_LOOP USING(#INSTANCE) TO(10)
*
* Get the employee number
*
EXECUTE SUBROUTINE(GET_ALPHA) WITH_PARMS(E #INSTANCE #EMPNO)
USE BUILTIN(UPPERCASE) WITH_ARGS(#EMPNO) TO_GET(#EMPNO)
*
* If an employee number was specified
*
IF COND('#Empno *ne *Blanks')
*
* Indicate that a spool file has been produced
*
CHANGE FIELD(#S_208SPLF) TO(SET208Q)
*
* Lookup the employee details
*
FETCH FIELDS(*ALL) FROM_FILE(PSLMST) WITH_KEY(#EMPNO)
*
* Handle not found
*
IF_STATUS IS_NOT(*OKAY)
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('*** Employee with number' #EMPNO 'could not be found ***')
ELSE
*
* else print the employee details
*
PRINT LINE(#DETAIL01)
*
* Now report on all skills
*
SELECT FIELDS(*ALL) FROM_FILE(PSLSKL) WITH_KEY(#EMPNO)
FETCH FIELDS(#SKILDESC) FROM_FILE(SKLTAB) WITH_KEY(#SKILCODE) KEEP_LAST(50)
PRINT LINE(#DETAIL02)
ENDSELECT
*
ENDIF
ENDIF
END_LOOP
*
* Finished. Give the spool file name back to SET208H
* which will manage sending the details back to S_208FMF
* on the Windows NT/2000 server system.
*
ENDPRINT
EXCHANGE FIELDS(#S_208SPLF)
RETURN
* =====================================================
* Get_Alpha : Locate an alphanumeric value
* =====================================================
SUBROUTINE NAME(GET_ALPHA) PARMS((#S_208NAME *RECEIVED) (#S_208INST *RECEIVED) (#S_208AVAL *BOTH))
CHANGE FIELD(#S_208OPER) TO(LOCATE)
EXCHANGE FIELDS(#S_208OPER #S_208NAME #S_208INST)
CALL PROCESS(*DIRECT) FUNCTION(SET208L)
ENDROUTINE
* =====================================================
* MESSAGE : Dynamically build a text message
* =====================================================
SUBROUTINE NAME(MESSAGE) PARMS((#TEXT01 *RECEIVED) (#TEXT02 *RECEIVED) (#TEXT03 *RECEIVED))
DEFINE FIELD(#TEXT01) REFFLD(#S_208MSG)
DEFINE FIELD(#TEXT02) REFFLD(#TEXT01)
DEFINE FIELD(#TEXT03) REFFLD(#TEXT01)
USE BUILTIN(BCONCAT) WITH_ARGS(#TEXT01 #TEXT02 #TEXT03) TO_GET(#S_208MSG)
PRINT LINE(#MESSAGE)
ENDROUTINE
* =======================================================
* Process ........: SET_208
* Function .......: SET208Q
* Description ....: Handle Employee Query
*
* This function is called by SET208H to handle the
* processing of an employee query request that has been
* received in MS-Word document SET208Q.DOC
*
* Disclaimer: The following material is supplied as
* sample material only. No warranty concerning the
* material or its use in any way whatsoever is
* expressed or implied.
*
* =======================================================
FUNCTION OPTIONS(*DIRECT *LIGHTUSAGE)
*
* Define the report Lines
*
DEF_REPORT FORMSIZE(*DEFAULT 132) OTHER_OVR('SPLFNAME(SET208Q)')
DEF_HEAD NAME(#HEAD01) FIELDS((#DATE *L001 *P002) (#TIME *L001 *P016) (#FUNCTION *L002 *P002) (#REP1PAGE *L003 *P002))
DEF_LINE NAME(#DETAIL01) FIELDS((#EMPNO *L001 *P001 *COL) (#SURNAME *L001 *P013 *COL) (#GIVENAME *L001 *P034 *COL) (#STARTDTE *L001 *P055 *COL) (#PHONEBUS *L001 *P066 *COL) (#PHONEHME *L001 *P088 *COL) (#ADDRESS1 *L001 *P108 *COL) (#ADDRESS2 *L002 *P108) (#ADDRESS3 *L003 *P108) (#POSTCODE *L004 *P108 *LAB)) SPACE_BEF(002) SPACE_AFT(000) IDENTIFY(*NOID)
DEF_LINE NAME(#DETAIL02) FIELDS((#SKILCODE *L001 *P012) (#SKILDESC *L001 *P024) (#GRADE *L001 *P045) (#COMMENT *L001 *P047) (#DATEACQ *L001 *P068)) SPACE_BEF(001) SPACE_AFT(000) IDENTIFY(*NOID)
DEF_LINE NAME(#MESSAGE) FIELDS((#S_208MSG *NOID)) SPACE_BEF(3) SPACE_AFT(3)
*
* Locally defined fields
*
DEFINE FIELD(#INSTANCE) REFFLD(#STD_NUM)
*
* Initialize fields
*
CHANGE FIELD(#S_208SPLF) TO(*Blanks)
*
* Up to 10 employee numbers can be specified
*
BEGIN_LOOP USING(#INSTANCE) TO(10)
*
* Get the employee number
*
EXECUTE SUBROUTINE(GET_ALPHA) WITH_PARMS(E #INSTANCE #EMPNO)
USE BUILTIN(UPPERCASE) WITH_ARGS(#EMPNO) TO_GET(#EMPNO)
*
* If an employee number was specified
*
IF COND('#Empno *ne *Blanks')
*
* Indicate that a spool file has been produced
*
CHANGE FIELD(#S_208SPLF) TO(SET208Q)
*
* Lookup the employee details
*
FETCH FIELDS(*ALL) FROM_FILE(PSLMST) WITH_KEY(#EMPNO)
*
* Handle not found
*
IF_STATUS IS_NOT(*OKAY)
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('*** Employee with number' #EMPNO 'could not be found ***')
ELSE
*
* else print the employee details
*
PRINT LINE(#DETAIL01)
*
* Now report on all skills
*
SELECT FIELDS(*ALL) FROM_FILE(PSLSKL) WITH_KEY(#EMPNO)
FETCH FIELDS(#SKILDESC) FROM_FILE(SKLTAB) WITH_KEY(#SKILCODE) KEEP_LAST(50)
PRINT LINE(#DETAIL02)
ENDSELECT
*
ENDIF
ENDIF
END_LOOP
*
* Finished. Give the spool file name back to SET208H
* which will manage sending the details back to S_208FMF
* on the Windows NT/2000 server system.
*
ENDPRINT
EXCHANGE FIELDS(#S_208SPLF)
RETURN
* =====================================================
* Get_Alpha : Locate an alphanumeric value
* =====================================================
SUBROUTINE NAME(GET_ALPHA) PARMS((#S_208NAME *RECEIVED) (#S_208INST *RECEIVED) (#S_208AVAL *BOTH))
CHANGE FIELD(#S_208OPER) TO(LOCATE)
EXCHANGE FIELDS(#S_208OPER #S_208NAME #S_208INST)
CALL PROCESS(*DIRECT) FUNCTION(SET208L)
ENDROUTINE
* =====================================================
* MESSAGE : Dynamically build a text message
* =====================================================
SUBROUTINE NAME(MESSAGE) PARMS((#TEXT01 *RECEIVED) (#TEXT02 *RECEIVED) (#TEXT03 *RECEIVED))
DEFINE FIELD(#TEXT01) REFFLD(#S_208MSG)
DEFINE FIELD(#TEXT02) REFFLD(#TEXT01)
DEFINE FIELD(#TEXT03) REFFLD(#TEXT01)
USE BUILTIN(BCONCAT) WITH_ARGS(#TEXT01 #TEXT02 #TEXT03) TO_GET(#S_208MSG)
PRINT LINE(#MESSAGE)
ENDROUTINE