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.

You must conform to the following input format:
      *!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.

You must conform to the following input format:
      *!OPE "DS"
where DS is the Data Structure indicated in the Program -CD Lines tab.
This micropattern generates:
   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.

You must conform to the following input format:
      *!CLO "DS"
where DS is the Data Structure indicated in the Program -CD Lines tab.
This micropattern generates:
   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.

You must conform to the following input format:
      *!R "DS"
where DS is the Data Structure that is indicated in the Program -CD Lines tab.
If the Data Structure access mode in the Program -CD Lines tab is S : Sequential, this micropattern generates:
   MOVE 0 TO IK
   READ DS-FILE
   AT END MOVE 1 TO IK
If the Data Structure access mode in the Program -CD Lines tab is D : Dynamic, this micropattern generates:
   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.

You must conform to the following input format:
      *!RN "DS"
where DS is a Data Structure.
This micropattern generates:
   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.

You must conform to the following input format:
      *!W "SEGM"
where SEGM is the Segment indicated in the Program -CD Lines tab.
If the Data Structure Input/Output mode indicated in the Program -CD Lines is T : Sort, this micropattern generates:
  MOVE 0 TO IK
	RELEASE     SEGM
If the Data Structure Input/Output mode indicated in the Program -CD Lines is not T : Sort, this micropattern generates:
  MOVE 0 TO IK
	WRITE        SEGM
  INVALID KEY MOVE 1 TO IK
Note: The third line is generated only if the Data Structure organization in the Program -CD Lines is I : Indexed.

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.

You must conform to the following input format:
      *!RW "SEGM"
where SEGM is a Segment.
This micropattern generates:
  MOVE 0 TO IK
	WRITE  SEGM
  INVALID KEY MOVE 1 TO IK

Feedback