Micropatterns to generate branching instructions

These micropatterns generate GO TO statements in an iteration, or in a function or subfunction. The GFT and GDI micropatterns can be used to manage the iterations in a Program, Screen, or Server. The GB and GT micropatterns can be used to manage branchings to functions or subfunctions.

GFT branches to the end of the current highest iteration. GDI branches to the beginning of the current highest iteration.

GB exits the current iteration, whose level is entered in the operands. It causes a return to the beginning of the loop. GT branches to the end of the function or subfunction to which the statement belongs, and whose level is indicated in the operands.
Note: If the function or subfunction has an IT type and if it used with an EL type function or subfunction, the GB and GT micropatterns branch to the beginning of the EL function or subfunction.

The statements generated from all these micropatterns are always followed by a period.

Note: Other branching micropatterns can be used: GF, GFA, GD, and GDB. However, they are specific to the Dialog and Client/Server functions. So they are documented with the micropatterns specific to these functions.

Input format

You enter these micropatterns in the COBOL code of a Program, Screen, or Server with the PDP COBOL editor, or in the code of a Macro in the Source COBOL tab that opens with the Macro design editor.

Note: You can enter the micropatterns in full or use the wizard that is available from the Snippets view, in the RPP snippets category.
To indicate a micropattern that manages the iterations, you must enter the following lines:
      *!GXX
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.
  • GXX is the micropattern identifier: GFT or GDI.
Note: After the instance is generated again, these micropatterns are expanded according to the entity type and to the function into which the micropattern is indicated.
To indicate a micropattern that branches to a function or subfunction, you must enter the following lines:
      *!GX "NN"
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.
  • GX is the micropattern identifier: GF or GT.
  • " " must frame the operands.
  • NN is the function or subfunction level.

Generated result for GFT

In a generated Program, GFT sets the end-of-file processing switches and branches to the end-of-run function (F20):
   MOVE ALL ‘1' TO FT GO TO F20.
In a generated Screen (standard or client Screen), GFT branches to the end of the category processing.
  • In a function < F39, GFT produces:
    GO TO F39999-ITER-FT.
  • In a function > F39, GFT produces:
    GO TO F69999-ITER-FT.
In a generated Server, GFT branches to the end of the category processing:
  • In a check and update function (Fvunn-CHUP), GFT produces:
    GO TO Fvunn-CHUP-CATR-FN.
  • In a selection function (Fvunn-SELC), GFT produces:
    GO TO Fvunn-SELC-CATR-FN.

Generated result for GDI

In a generated Program, GDI branches to the beginning of the iteration loop (F05) :
   GO TO F05.
In a generated Screen (standard or client Screen), GDI branches to the next occurrence of the current category, or to the next category.
  • In a function < F39, GDI produces:
    GO TO F39999-ITER-FI.
  • In a function > F39, GDI produces:
    GO TO F69999-ITER-FI.
In a generated Server, GDI branches to the next occurrence of the current category, or to the next category.
  • In a check and update function (Fvunn-CHUP), GDI produces:
    GO TO Fvunn-CHUP-CATR-SRVx-DONE.
  • In a selection function (Fvunn-SELC), GDI produces:
    GO TO Fvunn-SELC-CATR-SRVx-DONE.

Generated result for GB

The following line is generated:
GO TO Fffss-900.
where ffss is the function or subfunction whose level is indicated in the operands.

Generated result for GT

The following line is generated:
GO TO Fffss-FN.
where ffss is the function or subfunction to which the statement belongs and whose level is indicated in the operands.

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.

The newly indented lines undergo the following controls upon the new generation:
  • 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.


Feedback