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.
Important: Any line that contains an identifier or an attribute
must be entered in uppercase letters.
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.
The identifiers vary according
to the position in the generated program:
- 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 programIdentifiers |
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.
You can overwrite the
PROCEDURE DIVISON line
by entering, for example, the following information:
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.
See the
examples in figure 1 and figure 3.
- JXXNN (where XX is the function
code and NN the subfunction code)
This index is
used in a DO loop.
Coding rules for lines
Attention: The line number is required on the first
line of the line group: title line, attribute line, and condition
line. A line number must also be entered on the first source code
line that follows this group.
Coding rules for line numbers
You can enter
alphanumeric line numbers in the WORKING-STORAGE SECTION,
and numeric line numbers in the PROCEDURE DIVISION.
You can parameterize them with $.
The following coding rules apply to line numbers:
- If the previous identifier is FXXYY, the
line number must have the following lengths:
- 3 or 6 characters if it does not contain any $,
- 2, 3, 5, or 6 characters if it contains a $.
- If the previous identifier is not FXXYY,
the line number must be 3 characters long.
- If *! is found from column 7, the line number
is required.
- If the line number contains a $, the following
controls apply:
- The $ must not be in position 3 or 6.
- The value that follows the $ must be 0
- 9 or A-J.
The line numbers are strictly managed in the Macros that
are migrated from Pacbase.
They are 3 characters long in the WORKING-STORAGE SECTION and
6 characters long in the WORKING-STORAGE SECTION.
For more information, see Line numbers in the Pacbase migrated Macros.
Examples
Figure 1. Indexes
in the hierarchical level 01 of the automatic indexes
in a Macro:
Figure 2. Indexes in the hierarchical
level 01 of a generated program:
Figure 3. Indexes in the hierarchical
level 01 of the work or linkage area, in a Macro:
Figure 4. Indexes in the hierarchical
level 01 of the work or linkage area, in a generated
program:
Figure 5. Example of code input in a
Macro