Code syntax in the Macro COBOL editor
You must follow the syntactic rules to create code lines in the Macro COBOL editor.
The identifiers
You must specify an identifier before each COBOL statement to insert it at the beginning of a program, in the WORKING-STORAGE SECTION, LINKAGE SECTION, or PROCEDURE DIVISION. You must enter the identifier in the COBOL margin (columns 1 - 6). You must enter a line number on the line that follows the line with the identifier. The Macro lines will be inserted in the position that is indicated by the identifier.
The identifier input is validated. If an error is detected, the instance is marked as erroneous in the workspace. As a result, generating the instances that call this Macro becomes impossible. All the controls are detailed in Controls of the Macro source code syntax.
- Identifiers for the beginning of a program:
These identifiers can be parameterized as B$n$n.
The following table indicates all the possible identifiers and the paragraph that is generated for each identifier.Table 1. Identifiers for the beginning of a program Identifiers Generated paragraphs B__01 COBOL API comment B__05 PAF comment B__10 PROGRAM-ID B__20 AUTHOR B__30 DATE-COMPILED B__40 ENVIRONMENT DIVISION B00 CONFIGURATION SECTION B0000 SOURCE-COMPUTER B0010 OBJECT-COMPUTER B0020 SPECIAL-NAMES B01 INPUT-OUTPUT SECTION B01 FILE-CONTROL B01FF SELECT FF-FICHIER B0100 I-O-CONTROL B60 Reserved for the DATA DIVISION line B99 Reserved for the FILE SECTION line B9*FF Rewriting of the FD clause for the FF file Note: You can use the ACTION=R attribute to delete a section or a paragraph, as in the following example:B01 000 INPUT-OUTPUT SECTION. 100 FILE-CONTROL. B01A2 900 SELECT A2-FILE ASSIGN TO UT-S-TESTCTL. B9999 *ACTION=R
- Identifiers for the work and linkage areas: WXX (where XX is
the position in the WORKING-STORAGE SECTION):
These identifiers can be parameterized.
You can indicate these identifiers to overwrite the PROCEDURE DIVISON line in the generated program. To do so, you must enter the following information:- On the first line, enter the identifier WXX.
- On the second line, enter a line number 000 followed by the new declaration of the PROCEDURE DIVISON. You can create other lines if necessary.
W99 000 PROCEDURE DIVISION USING 010 SQ01.
- Identifiers for the description of processing (functions, subfunctions): FXXYY (where XX is
the function code and YY the subfunction code):
These identifiers can be parameterized.
- Identifiers for the generation of indexes:All the indexes are generated under the same level of indexes. If you want them to be generated under any level 01 that you choose, you must enter them as WXX. If you want them to be generated under the level 01 of the automatic indexes, you must enter the following identifiers:
- IXXNN (where XX and NN are two codes on two
characters each, such as the Data Structure and Segment code).
This index corresponds to the size of the table that must be indicated in a work and linkage area.
The following three indexes are automatically generated:- IXXNNM contains the maximum number of records that is specified by the user (initialized by VALUE).
- IXXNNL contains the maximum number of the records that are actually loaded. It is initialized to zero and must be incremented upon loading. It cannot exceed the maximum number.
- IXXNNR is related to the table search. It is initialized to zero and cannot exceed IXXNNL.
The data must be declared in the work and linkage area as: W-XXNN or W-XXNN-DELCO (where W is a digit or a letter that represents the work area and DELCO is the Data Element code).
The table size can be parameterized.
You must enter the indexes on a level 05.
- JXXNN (where XX is the function code and NN
the subfunction code)
This index is used in a DO loop.
- IXXNN (where XX and NN are two codes on two
characters each, such as the Data Structure and Segment code).
Coding rules for lines
- Outside the PROCEDURE DIVISION, you must enter
the following information:
- A line with an identifier,
- One or more lines with source code. The first line must contain a line number.
- In the PROCEDURE DIVISION, you must enter the following information:
- A line with an identifier,
- A line with a title (optional),
- A line that contains the attributes. It is required if you create a function or subfunction.
The conditions and the code must start in the margin B of the COBOL code.
All the possible values for the insertion of a function or subfunction are detailed in the help that is associated with each function or subfunction creation wizard.
All the coding rules of line numbers, identifiers, and attributes are explained in Controls of the Macro source code syntax.
The coding rules that specifically apply to the Macros migrated from Pacbase are explained in Source code of the migrated Macros.
Examples




