List of the available snippets
These snippets do not call micropatterns but make code insertion easier by displaying a wizard with the parameters to be entered. The corresponding code lines are then always correctly formatted.
Note: The snippets that call micropatterns are not documented as such. However, the micropatterns
that they insert are documented in Principle and use of micropatterns.
You can insert the following snippets to insert code:
- Indexes insertion. This snippet inserts the three indexes that are
automatically generated from a table declaration: IXXNNL for the number of records
that are stored in the table, IXXNNR for the search in the table, and
IXXNNM for the maximum number of records.Example: From the Indexes insertion snippet, the following specific code lines (with the default values) are inserted in the code.
05 IINDL PICTURE S9(4) VALUE ZERO. 05 IINDR PICTURE S9(4) VALUE ZERO. 05 IINDM PICTURE S9(4) VALUE +100.
- Search insertion (SCH/SCB). This snippet is used to search for a Data
Element in a sorted table. The Data Element is indicated in the second operand. The table code is
indicated in the first operand. This code must include the prefix in the WORKING-STORAGE
SECTION if it exists (1- for example). It can be followed by the Data
Element name if it is different from the Data Element name to be searched for.
The search is run with the standard indexes that are associated with the table. If no match is found, the IXXNNR index is greater than the IXXNNL index.
With SCH, the search stops when the table argument is greater than the search argument. It is not the case with SCB.
When the Search insertion (SCH/SCB) snippet is inserted, a comment line is automatically added to the code before the insertion. This line contains @SCH or @SCB, followed by the two operands between double quotation marks.
Example: In the following example, W-WK00-TABLE1 is the table code indicated in the first operand and W-WK00-VAL1 is the Data Element indicated in the second operand. The following lines are then inserted in the code.*@SCH "W-WK00-TABLE1 W-WK00-VAL1" MOVE 1 TO IINDIR. FXXYY-NNN. IF IINDIR NOT > IINDIL AND W-WK00-TABLE1 (IINDIR) NOT = W-WK00-VAL1 ADD 1 TO IINDIR GO TO FXXYY-NNN.
- Loop insertion. This snippet is used to indicate that a processing must
be run in a repetitive way. You enter the processing name in the operand. When you insert the
snippet, a @LOOP comment line is automatically inserted in the code to indicate the
beginning of the loop. The next line contains a PERFORM COBOL statement, followed
by the processing name and TIMES. You must add the number of repetitions manually,
before TIMES. Specify the processing on the next lines. The
END-PERFORM statement is automatically generated to indicate the end of the
loop.Example: You want to insert the MYPROCESSING processing. You indicate MYPROCESSING as the operand of the Loop insertion snippet and you insert the snippet. You enter the number of repetitions (3 in the example) and the processing code lines before END-PERFORM. The following lines are then inserted in the code.
*@LOOP PERFORM MYPROCESSING 3 TIMES * Insert code MYPROCESSING 1ST LINE MYPROCESSING 2ND LINE END-PERFORM.
- Insertion of the EVALUATE statement. This snippet is used to insert the
EVALUATE COBOL statement to test various conditions of a Data Element and specify
an action for each of them. Example: In the following example, you insert an EVALUATE statement in the F28BB subfunction. In the snippet insertion wizard, you indicate YA01-XCSDO as the Data Element whose value is to be tested. You indicate value1 as the condition. You specify that the processing MOVE 'value2' TO YA01-XTSD00 is to be run if the Data Element value is value1. You also indicate that the processing MOVE 'value3' TO YA01-XTSD00 is to be run if the Data Element value is not value1. The following lines are then inserted in the code.
*N28BB. NOTE *EVALUATE statement for YA01-CSDO *. F28BB. *<insert code for F28BB here> EVALUATE YA01-XCSDO WHEN 'value1' MOVE 'value2' TO YA01-XTSD00 WHEN OTHER MOVE 'value3' TO YA01-XTSD00 END-EVALUATE. F28BB-FN. EXIT.
- Work and linkage areas line insertion. This snippet can be used in a Macro only. It inserts an identifier in the WORKING-STORAGE SECTION according to the two characters that you specify. For example, if you enter AA as the snippet parameter, the identifier WAA is inserted into the Macro code.