Batch micropatterns
These micropatterns are specific to the generation of batch Programs. They perform the opening, reading, and writing of files with a sequential, an indexed-sequential, or a dynamic organization.
The generated statements are adapted to the type of COBOL code and to the characteristics of the Data Structure call.
So for example, the same read micropattern can generate READ AT END, READ INVALID KEY, CALL GETSEQ GETRAN, or RETURN AT END.
Input format
You can indicate these micropatterns in the COBOL code of a Program with the PDP COBOL editor, or in the code of a Macro with the PDP Macro editor.
*!MP "XXXX"
where:- *! 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.
- MP is the micropattern identifier (OPE for example).
- " " must frame the operands.
- xxxx are the operands of this micropattern.
OPE micropattern
This micropattern generates the opening of the file that is indicated in the operands.
*!OPE "DS"
where DS is
the Data Structure indicated in the Program -CD Lines tab. OPEN USE DS-FILE
where
:- USE is the use of the Data Structure in the Program (INPUT, OUTPUT, I-O or EXTEND).
- DS is the Data Structure.
CLO micropattern
This micropattern generates the closing of the file that is indicated in the operands.
*!CLO "DS"
where DS is
the Data Structure indicated in the Program -CD Lines tab. OPEN DS-FILE
R micropattern
This micropattern generates the reading of the file that is indicated in the operands.
It uses the IK variable. This variable takes on a value other than zero when the generated statement ends abnormally (end of file or error on the key for example). You must determine the action to take, according to the value of this variable.
*!R "DS"
where DS is
the Data Structure that is indicated in the Program -CD
Lines tab. MOVE 0 TO IK
READ DS-FILE
AT END MOVE 1 TO IK
MOVE 0 TO IK
READ DS-FILE NEXT
AT END MOVE 1 TO IK
RN micropatterns
This micropattern generates the reading of the next record of the file that is indicated in the operands.
It uses the IK variable. This variable takes on a value other than zero when the generated statement ends abnormally (end of file or error on the key for example). You must determine the action to take, according to the value of this variable.
*!RN "DS"
where DS is
a Data Structure. MOVE 0 TO IK
READ DS-FILE NEXT
AT END MOVE 1 TO IK
W micropattern
This micropattern generates the writing of the file that is indicated in the operands.
It uses the IK variable. This variable takes on a value other than zero when the generated statement ends abnormally (end of file or error on the key for example). You must determine the action to take, according to the value of this variable.
*!W "SEGM"
where SEGM is
the Segment indicated in the Program -CD Lines tab. MOVE 0 TO IK
RELEASE SEGM
MOVE 0 TO IK
WRITE SEGM
INVALID KEY MOVE 1 TO IK
RW micropattern
This micropattern generates the rewriting of the file that is indicated in the operands.
It uses the IK variable. This variable takes on a value other than zero when the generated statement ends abnormally (end of file or error on the key for example). You must determine the action to take, according to the value of this variable.
*!RW "SEGM"
where SEGM is
a Segment. MOVE 0 TO IK
WRITE SEGM
INVALID KEY MOVE 1 TO IK