SET208D
* =======================================================
* Process ........: SET_208
* Function .......: SET208D
* Description ....: Hanlde processing of new departments
* that have been input in MS-Word document SET208D.DOC
*
* This function is called by SET208H to handle the
* processing of new department information that has
* been received in MS-Word document SET208D.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 *HEAVYUSAGE)
*
* Group of all fields in a department
*
GROUP_BY NAME(#DEPT_INFO) FIELDS(#DEPTMENT #DEPTDESC)
*
* Other locally defined fields
*
DEFINE FIELD(#INSTANCE) REFFLD(#STD_NUM)
*
* The Ms_word document allows up to 3 departments ...
*
BEGIN_LOOP USING(#INSTANCE) TO(3)
*
* Now extract boomkarked details from the MS-Word
* document ....
*
EXECUTE SUBROUTINE(GET_ALPHA) WITH_PARMS(DEPTMENT #INSTANCE #DEPTMENT *BLANKS)
EXECUTE SUBROUTINE(GET_ALPHA) WITH_PARMS(DEPTDESC #INSTANCE #DEPTDESC *BLANKS)
*
* If no values returned there is nothing to do as nothing
* was specified on this line of the document
*
IF COND('(#Deptment *ne *Blanks) or (#DeptDesc *ne *Blanks)')
*
* Issue standard messages that will be emailed back
* to the person who sent the document ....
*
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('===========================' *BLANKS *BLANKS)
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('Results for Department' #DEPTMENT *BLANKS)
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('===========================' *BLANKS *BLANKS)
*
* Now attempt to create the new department. Let the
* repository add all further messages, good or bad ...
*
INSERT FIELDS(#DEPT_INFO) TO_FILE(DEPTAB) IO_ERROR(*NEXT) VAL_ERROR(*NEXT)
*
* Issue an okay message for good ones
*
IF_STATUS IS(*OKAY)
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('Department' #DEPTDESC 'successfully created.')
ENDIF
*
ENDIF
*
END_LOOP
*
* Finished
*
RETURN
* =====================================================
* Get_Alpha : Locate an alphanumeric value
* =====================================================
SUBROUTINE NAME(GET_ALPHA) PARMS((#S_208NAME *RECEIVED) (#S_208INST *RECEIVED) (#S_208AVAL *RETURNED) (#S_208ADFT *RECEIVED))
DEFINE FIELD(#S_208ADFT) REFFLD(#S_208AVAL) DESC('Default alphanumerci value')
CHANGE FIELD(#S_208AVAL) TO(#S_208ADFT)
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)
MESSAGE MSGID(DCM9899) MSGF(DC@M01) MSGDTA(#S_208MSG)
ENDROUTINE
* =======================================================
* Process ........: SET_208
* Function .......: SET208D
* Description ....: Hanlde processing of new departments
* that have been input in MS-Word document SET208D.DOC
*
* This function is called by SET208H to handle the
* processing of new department information that has
* been received in MS-Word document SET208D.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 *HEAVYUSAGE)
*
* Group of all fields in a department
*
GROUP_BY NAME(#DEPT_INFO) FIELDS(#DEPTMENT #DEPTDESC)
*
* Other locally defined fields
*
DEFINE FIELD(#INSTANCE) REFFLD(#STD_NUM)
*
* The Ms_word document allows up to 3 departments ...
*
BEGIN_LOOP USING(#INSTANCE) TO(3)
*
* Now extract boomkarked details from the MS-Word
* document ....
*
EXECUTE SUBROUTINE(GET_ALPHA) WITH_PARMS(DEPTMENT #INSTANCE #DEPTMENT *BLANKS)
EXECUTE SUBROUTINE(GET_ALPHA) WITH_PARMS(DEPTDESC #INSTANCE #DEPTDESC *BLANKS)
*
* If no values returned there is nothing to do as nothing
* was specified on this line of the document
*
IF COND('(#Deptment *ne *Blanks) or (#DeptDesc *ne *Blanks)')
*
* Issue standard messages that will be emailed back
* to the person who sent the document ....
*
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('===========================' *BLANKS *BLANKS)
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('Results for Department' #DEPTMENT *BLANKS)
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('===========================' *BLANKS *BLANKS)
*
* Now attempt to create the new department. Let the
* repository add all further messages, good or bad ...
*
INSERT FIELDS(#DEPT_INFO) TO_FILE(DEPTAB) IO_ERROR(*NEXT) VAL_ERROR(*NEXT)
*
* Issue an okay message for good ones
*
IF_STATUS IS(*OKAY)
EXECUTE SUBROUTINE(MESSAGE) WITH_PARMS('Department' #DEPTDESC 'successfully created.')
ENDIF
*
ENDIF
*
END_LOOP
*
* Finished
*
RETURN
* =====================================================
* Get_Alpha : Locate an alphanumeric value
* =====================================================
SUBROUTINE NAME(GET_ALPHA) PARMS((#S_208NAME *RECEIVED) (#S_208INST *RECEIVED) (#S_208AVAL *RETURNED) (#S_208ADFT *RECEIVED))
DEFINE FIELD(#S_208ADFT) REFFLD(#S_208AVAL) DESC('Default alphanumerci value')
CHANGE FIELD(#S_208AVAL) TO(#S_208ADFT)
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)
MESSAGE MSGID(DCM9899) MSGF(DC@M01) MSGDTA(#S_208MSG)
ENDROUTINE