TO SYSDATE-SLASH-1.
MOVE TWA-IPL-DATE-DD
TO SYSDATE-DD.
MOVE SLASH
TO SYSDATE-SLASH-2.
MOVE TWA-IPL-DATE-CC
TO SYSDATE-CC.
MOVE TWA-IPL-DATE-YY
TO SYSDATE-YY.
MOVE 'XX:XX:XX'
TO PATTERN-MASK.
MOVE TWA-TIME
TO DE-EDITED-DATA.
PERFORM CB200-INSERT-PATTERN THRU CB299-EXIT.
MOVE SCREEN-FIELD
TO SYSTIME.
IF VAC01-EMPNUM NUMERIC
MOVE '999-99-9999'
TO PATTERN-MASK
MOVE SPACES
TO DE-EDITED-DATA
MOVE VAC01-EMPNUM
TO DE-EDITED-VALUE
PERFORM CB200-INSERT-PATTERN THRU CB299-EXIT
MOVE SCREEN-FIELD
TO SEMPNUM
MOVE VAC01-EMPNUM
TO SEMPNUM-N
ELSE
MOVE ALL '*' TO SEMPNUM
MOVE ZERO TO VAC01-EMPNUM
MOVE 91A TO ERROR-NUMBER
MOVE E TO SEMPNUME
PERFORM CA100-LOAD-ERR-CODE-TBL THRU CA199-EXIT.
MOVE SIF01-FIRST-NAME
TO SFIRST.
MOVE SIF01-LAST-NAME
TO SLAST-N.
MOVE VAC01-DATE-HIRED-MM
TO SDATE-H-MM.
MOVE SLASH
TO SDATE-H-SLASH-1.
MOVE VAC01-DATE-HIRED-DD
TO SDATE-H-DD.
MOVE SLASH
TO SDATE-H-SLASH-2.
MOVE VAC01-DATE-HIRED-YY
TO SDATE-H-YY.
COMPUTE SEARNED-N
EQUAL VAC01-EARNED-VACATION
MOVE SEARNED-N
TO SEARNED-ED.
COMPUTE STAKEN-N
EQUAL VAC01-TAKEN-VACATION
MOVE STAKEN-N
TO STAKEN-ED.
COMPUTE SEARN07-N
EQUAL VAC01-EARNED-SICK-DAYS
MOVE SEARN07-N
TO SEARN07-ED.
COMPUTE STAKE08-N
EQUAL VAC01-TAKEN-SICK-DAYS
MOVE STAKE08-N
TO STAKE08-ED.
COMPUTE SEARN09-N
EQUAL VAC01-EARNED-COMP-DAYS
MOVE SEARN09-N
TO SEARN09-ED.
COMPUTE STAKE10-N
EQUAL VAC01-TAKEN-COMP-DAYS
MOVE STAKE10-N
TO STAKE10-ED.
MOVE VAC01-COMMENT (001)
TO SCOMMEN (001).
MOVE VAC01-COMMENT (002)
TO SCOMMEN (002).
MOVE VAC01-COMMENT (003)
TO SCOMMEN (003).
* * * DEFAULT ALGORITHM %COMP STARTS HERE
MOVE PFKIL-SEG1
TO TWA-SERRMSG-MSG (1).
MOVE 'Press PF13 for Hardcopy'
TO TWA-SERRMSG-MSG (2).
MOVE 'Press PF16 to Copy field to buffer'
TO TWA-SERRMSG-MSG (3).
MOVE PFKIL-SEG4
TO TWA-SERRMSG-MSG (4).
MOVE 'Press PF2 for field-level HELP
TO TWA-SERRMSG-MSG (5).
* * * DEFAULT ALGORITHM %COMP ENDS HERE
BB299-EXIT.
EXIT.
```**
The BB200 routine moves all the database "source" fields from the record to the screen in preparation to be displayed. (cont.)
It is performed in the SEE and NXT Functions and in the New Transaction phase for the CHG and DEL Functions and when a (cont.)
duplicate record is found for the ADD Function. The coding in this routine is generated by the MMPCREAT process from (cont.)
the Developer's specifications in MSKDEF for "Source/Target" fields for the corresponding screen fields. Notice that (cont.)
dates are automatically "rearranged" and do not need to be in the same format (MMDDYY, YYMMDD, etc.) on the file as on (cont.)
the screen. Notice also that numeric fields are moved to the Cobol edit pattern fields having the -ED suffix. Also, (cont.)
notice that the Pattern Edited field is "moved" by performing the CB200 routine to insert the (cont.)
pattern.
The %COMP insertion point allows you to add your own Customization to move data to the screen for display. You can (cont.)
compute values or move literals or variables from the TWA, etc. You can perform the CB200 routine to insert a pattern, (cont.)
if you like. This allows you to dynamically establish the pattern. A handy example of how this might be used is in U.S. (cont.)
and foreign postal (zip) codes. You could set the pattern according to which country the address was in. Notice the (cont.)
Default logic for %COMP. The default code moves the "PF Key" message to the bottom of the screen. If you overrode the (cont.)
default in %PFKEYM you should probably also override this message.
| ```
**
****************************************************************
* BB400 *
* CHECK IF IT IS OK TO ALLOW RECORD TO BE DELETED *
****************************************************************
BB400-EDIT-FOR-DELETE.
* * * DEFAULT ALGORITHM %DELEDIT STARTS HERE
* * * NO STANDARD DEFAULT CODE FOR THIS INSERTION POINT
* * * DEFAULT ALGORITHM %DELEDIT ENDS HERE
* * * DATA RULE VAC01 RULDELT STARTS HERE
IF (NOT TWA-MSK-PF5-HIT)
IF VAC01-EMPNUM LESS THAN NINETEEN
MOVE '91J' TO ERROR-NUMBER
PERFORM CA100-LOAD-ERR-CODE-TBL THRU CA199-EXIT.
* * * DATA RULE VAC01 RULDELT ENDS HERE
BB499-EXIT.
EXIT.
```**
The BB400 routine is performed in the Continuation Mode for DEL Functions only. The insertion point %DELEDIT is here, (cont.)
it allows you to insert any type of logic you desire to validate that it is okay for this record to be deleted. The (cont.)
most common use is to read a subordinate file to see if there are records on it; ie: reading the Invoice file before (cont.)
deleting the Customer Master record.
This is also where the RULDELT logic (deletion rule) is inserted. This logic was stored in the dictionary by the (cont.)
database administrator and is "triggered" just before the specified element is to be deleted. Refer to the "Database (cont.)
Administration" chapter of this manual for more about *Business Rules* and *Deletion Rules.*
If you detect a condition which should prevent the deletion then you must set the FATAL-ERR flag to F, just as in all other edits.
| ```
**
****************************************************************
* BB500 *
* CHECK IF IT IS OK TO ALLOW RECORD TO BE ADDED/UPDATED *
****************************************************************
BB500-SCREEN-EDIT.
IF FATAL-ERR = E
MOVE F TO FATAL-ERR.
MOVE SYSTIME
TO SCREEN-FIELD
MOVE 'XX:XX:XX'
TO PATTERN-MASK
PERFORM CB500-EDIT-PATTERN THRU CB599-EXIT.
IF PATTERN-ERROR EQUAL E
MOVE E TO SYSTIMEE
PERFORM CA100-LOAD-ERR-CODE-TBL THRU CA199-EXIT
ELSE
MOVE SCREEN-FIELD
TO SYSTIME.
MOVE SEMPNUM
TO SCREEN-FIELD
MOVE '999-99-9999'
TO PATTERN-MASK
PERFORM CB500-EDIT-PATTERN THRU CB599-EXIT.
IF PATTERN-ERROR EQUAL E
MOVE E TO SEMPNUME
PERFORM CA100-LOAD-ERR-CODE-TBL THRU CA199-EXIT
ELSE
MOVE SCREEN-FIELD
TO SEMPNUM.
* * * DEFAULT ALGORITHM %EDIT STARTS HERE
* * * NO STANDARD DEFAULT CODE FOR THIS INSERTION POINT
* * * DEFAULT ALGORITHM %EDIT ENDS HERE
SKIP2
* * * DEFAULT ALGORITHM %EDIT2 STARTS HERE
* * * NO STANDARD DEFAULT CODE FOR THIS INSERTION POINT
* * * DEFAULT ALGORITHM %EDIT2 ENDS HERE
BB599-EXIT.
EXIT.
```**
The BB500 routine is performed to edit and validate screen data before any update or add to the database. In it you (cont.)
will notice some code has been inserted to edit the Pattern edited employee number and time-of-day fields. You can (cont.)
insert your own edit routines here using the %EDIT insertion point. The %EDIT2 insertion point is also found here. It (cont.)
is for edits which you wish to do only if all prior edits have been passed successfully. That allows you to bypass (cont.)
expensive, I/O intensive validations when errors have already been detected which will prevent the (cont.)
update.
| ```
**
****************************************************************
*************
* BB600
* MOVE APPROPRIATE DATA FIELDS FROM SCREEN TO RECORD
*
***************************************************
**************************
BB600-BUILD-REC.
IF NOT (ADD-FUNCTION)
GO TO BB610-MOVE-SCREEN-TO-DB.
* * * DEFAULT ALGORITHM %ADDINIT STARTS HERE
MOVE SPACES TO TWA-DB-DATA.
* * * DEFAULT ALGORITHM %ADDINIT ENDS HERE
BB610-MOVE-SCREEN-TO-DB.
MOVE '999-99-9999'
TO PATTERN-MASK.
MOVE SEMPNUM

next: genmmp21.md.txt