Micropatterns to condition the processing according to dates
These micropatterns condition the execution of the processing that is associated to a function or subfunction level or a COBOL 99 level according to tests on dates. You can insert them in the code of a Program, Screen, Server, or Macro.
Date comparison
The DCF and DCD micropatterns condition the execution of the processing to the verification of a comparison between two dates. If the comparison is true (if the first date is greater than the second date for example), then the processing is executed. The DCF micropattern applies to a function or subfunction level. The DCD micropattern applies to a COBOL 99 level.
*!DCD "xy ffnn-date1 ope ffnn-date2"
- *! is the required start tag of the micropattern. The
* must be entered in column 7, reserved for the comments in the COBOL code, and the
! must be entered in column 8.Note: If you press CTRL + space bar in the PDP COBOL editor, the content assist facility displays the list of the micropatterns that are adapted to the entity and to the position in the COBOL code (WORKING-STORAGE SECTION or PROCEDURE DIVISION). The micropatterns that are used only to retrieve the Pacbase data are not included in the list. Each micropattern in the list is documented. If you double-click one of them, the start tag and the identifier of the micropattern are inserted in the code. You must then complete its declaration.
- DCD (or DCF) is the micropattern identifier.
- " " must frame the operands.
- x is the format of date1 (optional). If you do not specify it, it will be extracted from the repository if the Data Element has a date format.
- y is the format of date2 (optional). If you do not specify it, it will be extracted from the repository if the Data Element has a date format.
- ffnn-date1 and ffnn-date2 are the two dates of the comparison.
- ope is the comparison type, among the following types: >, <, >=, <=, NOT>, NOT<, NOT=.
NEXT SENTENCE ELSE GO TO Fffss-FN.
ffss is the function or subfunction that the micropattern applies to.
Date validity
The DVF and DVD micropatterns condition the execution of the processing to the validity of a date. If the date is valid, then the processing is executed. The DVF micropattern applies to a function or subfunction level. The DVD micropattern applies to a COBOL 99 level.
*!DVD "x ffnn-date1"
- *! is the required start tag of the micropattern. The
* must be entered in column 7, reserved for the comments in the COBOL code, and the
! must be entered in column 8.Note: If you press CTRL + space bar in the PDP COBOL editor, the content assist facility displays the list of the micropatterns that are adapted to the entity and to the position in the COBOL code (WORKING-STORAGE SECTION or PROCEDURE DIVISION). The micropatterns that are used only to retrieve the Pacbase data are not included in the list. Each micropattern in the list is documented. If you double-click one of them, the start tag and the identifier of the micropattern are inserted in the code. You must then complete its declaration.
- DVD (or DVF) is the micropattern identifier.
- " " must frame the operands.
- x is the format of date1 (optional). If you do not specify it, it will be extracted from the repository if the Data Element has a date format.
- ffnn-date1 is the date Data Element to validate.
When the Program, Screen, or Server is generated again, the micropattern is recognized. The F95ER subfunction is generated for the errors.
- For the DVD micropattern, the following line
is generated:
IF EN-PRE=’1’ - For the DVF micropattern, the following lines
are generated:
IF EN-PRE=’1’ NEXT SENTENCE ELSE GO TO Fffss-FNffss is the function or subfunction that the micropattern applies to.
Date invalidity
The DIF and DID micropatterns condition the execution of the processing to the invalidity of a date. If the date is invalid, then the processing is executed. The DIF micropattern applies to a function or subfunction level. The DID micropattern applies to a COBOL 99 level.
*!DID "x ffnn-date1"
- *! is the required start tag of the micropattern. The
* must be entered in column 7, reserved for the comments in the COBOL code, and the
! must be entered in column 8.Note: If you press CTRL + space bar in the PDP COBOL editor, the content assist facility displays the list of the micropatterns that are adapted to the entity and to the position in the COBOL code (WORKING-STORAGE SECTION or PROCEDURE DIVISION). The micropatterns that are used only to retrieve the Pacbase data are not included in the list. Each micropattern in the list is documented. If you double-click one of them, the start tag and the identifier of the micropattern are inserted in the code. You must then complete its declaration.
- DID (or DIF) is the micropattern identifier.
- " " must frame the operands.
- x is the format of date1 (optional). If you do not specify it, it will be extracted from the repository if the Data Element has a date format.
- ffnn-date1 is the date Data Element to validate.
When the Program, Screen, or Server is generated again, the micropattern is recognized. The F95ER subfunction is generated for the errors.
- For the DID micropattern, the following line
is generated:
IF EN-PRE>’1’ - For the DIF micropattern, the following lines
are generated:
IF EN-PRE>’1’ NEXT SENTENCE ELSE GO TO Fffss-FNffss is the function or subfunction that the micropattern applies to.
Indenting the generated lines of a micropattern
You can indent the generated lines of a micropattern by entering indent=nn (where nn is a number) anywhere in the micropattern declaration line. The new indentation is effective after a new generation.
The indentation applies to the first generated line of the micropattern. The position difference, if any, with the next generated lines is kept relatively to the first newly indented line. For example, the initial indentation of the first generated line is 11. If you enter indent=20 and generate again, the new indentation of the first line becomes 20. So, the first line starts in position 21. The position of the next lines is moved to the right by 9 positions to keep the initial position difference.
- They cannot exceed column 72.
- They must start in the margin B of the COBOL code if they are in the PROCEDURE DIVISION or are generated from a WI, WE, or WS micropattern.
- The 01 and 77 levels of the lines that are generated from the WF micropattern must be in the margin A of the COBOL code.
If at least one generated line cannot be indented with the requested indentation, all the generated lines are set with the default indentation. The indent=nn indication is then ignored and the Invalid indentation value warning is displayed in the PDP COBOL editor and in the Problems view.