Purpose
This is the COBOL parser translator
that parses the source identified by the SOURCE DDNAME.
Functions
One of the functions of an SCLM
parser is to determine all of a module's dependencies. FLMLPCBL determines
all of the names that will be copied into the COBOL source.
FLMLPCBL
examines each line of the member. Lines located in the IDENTIFICATION
DIVISION (ID DIVISION) will not be examined for COPY statements or
quoted strings. This will permit the use of a comment entry for each
paragraph in the ID DIVISION without the need for an asterisk or slash
in column 7.
The parser uses the following syntax rules to
locate dependency names outside of the ID DIVISION:
- The search for tokens is restricted to columns 8-72. Column 7
is ignored except when it contains * and / (treated as a comment line)
or - (treated as a concatenation). The use of - to concatenate strings
for forming reserved words or dependency names is not supported.
- DBCS strings (delimited by shift-out and shift-in characters)
in comments and quotes are allowed. In addition DBCS user-defined names are allowed.
- When a line that is not a comment line or a continuation line
has COPY after column 7, the next token is taken as the name of a
dependency. Note the following exceptions:
- If the member name is enclosed in single or double quotes, the
quotes are ignored.
- When a line that is not a comment line or a continuation line
has EXEC, SQL, and INCLUDE as its first three tokens after column
7, the next token is taken as the name of a dependency. SQLCA and
SQLDA are not flagged as external dependencies.
- When searching for the next token on a line and there are no more
tokens on that line, the search continues with the next uncommented
line.
- Tokens inside quoted strings will be ignored (except for COPY
member names). Reserved words inside quoted strings will not be counted
as statements. COPY, EXEC SQL, and EXEC CICS* inside quoted strings
will be ignored.
- If a token is longer than 8 characters, it will not be added as
a dependency.
FLMLPCBL recognizes COPY MEMBER
where MEMBER is a 1-character to 8-character string with no separator
periods. A separator period is not required after MEMBER.
COPY
and MEMBER must be on the same line or on a continued line. However,
splitting COPY or MEMBER by using a hyphen (-) in column 7 of the
continued line is not supported. This is important to consider when
using code generators that use the hyphen in column 7 to concatenate
strings to form keywords and text names. Use of the hyphen to concatenate
strings in order to form a MEMBER as in COPY MEMBER results in the
COPY being ignored by FLMLPCBL. Use of the hyphen on the line after
COPY when COPY is the last token on the line results in the COPY being
ignored by FLMLPCBL.
FLMLPCBL can parse an odd number of quote
delimiters if the first two nonblank characters after column 7 on
a continuation line are two quote delimiters. FLMLPCBL expects to
find an even number of quote delimiters in a literal. You might need
to introduce a constant with a literal value that is also continued
on the next line to produce an even number of quote delimiters. If
you have an odd number of quote delimiters, the dependencies following
the odd number of delimiters might be ignored. The following example
illustrates a statement with an odd number of quote delimiters:
123456 VALUE 'This literal has a quote in column 72 and the next '
123457 '' 2 quote delimiters result in an odd number of quote
123458 delimiters for this statement '.
It
is recommended to code DBCS and mixed SBCS and DBCS literals on a
separate line especially when the literal contains blanks. For example
you can reduce the chance of some of your dependencies being ignored
by splitting a line like this:
001000 VALUE 'MQ GET/BROWSE çWáÔà{ñ .« '.
FFFFFF44444444444444ECDEC47DD4CCE6CDDEEC04E4E4C4448074444444444
00100000000000000000513450D4807531296625E865B4091BAFDB000000000
into two
001000 VALUE
FFFFFF44444444444444ECDEC44444444444444444444444444444444444444
001000000000000000005134500000000000000000000000000000000000000
and
001001 'MQ GET/BROWSE çWáÔà{ñ .« '.
FFFFFF444444444444444444447DD4CCE6CDDEEC04E4E4C4448074444444444
00100100000000000000000000D4807531296625E865B4091BAFDB000000000
The parser also gathers statistics or metrics for
each module to be parsed. SCLM saves 10 statistics, but this parser
only generates 7. For COBOL, this parser defines the following statistics:
- Total lines
- The total number of records in the file.
- Comment lines
- The number of lines with a slash (/) or an asterisk (*) in column
7.
- Noncomment lines
- The number of total lines minus the number of comment lines.
- Blank lines
- The number of lines that contain only blanks after column 6. Any
sequence numbers in the rightmost columns of the line are ignored.
- Prolog lines
- The number of comment lines that are found before the first noncomment
line.
- Total statements
- The number of lines that are not comment or continuation lines
whose first token after column 7 is one of the following reserved
words:
ACCEPT DIVIDE INSPECT REWRITE
ADD ENTER MERGE SEARCH
ALTER ENTRY MOVE SET
CALL EVALUATE MULTIPLY SORT
CANCEL EXAMINE NOTE START
CLOSE EXIT ON STOP
COMPUTE GO OPEN STRING
CONTINUE GOBACK PERFORM SUBTRACT
COPY GOTO READ TRANSFORM
DELETE IF RELEASE UNSTRING
DISPLAY INITIALIZE RETURN WRITE
In
addition, any EXEC SQL and EXEC CICS® statements
are treated as program statements.
- Comment statements
- This value is always 0.
- Control statements
- This value is always 0.
- Assignment statements
- This value is always 0.
- Noncomment statements
- This is the same as Total statements.
Parameters
The following positional parameters,
separated by commas, are expected as input to FLMLPCBL
- @@FLMLIS
- The address of the dependencies pointer. This parameter is required.
- @@FLMSTP
- The address of the statistics output buffer. This parameter is
required.
- @@FLMSIZ
- The size of the dependency list buffer in bytes. This parameter
is required.
- SQL=
- Maximum of eight characters specifying the name of the include
set assigned to EXEC SQL INCLUDE dependencies.
- INCLSET
- When INCLSET is present, include set dependencies will be generated.
That is, when COPY ABC OF XYZ statements are encountered,
a dependency for copybook ABC is generated with an include set name
of XYZ. This facilitates having copybooks with same name from different
sources.
When DBCS
is present, quote delimiters are ignored in any token that contains
either shift in (X'0E') or shift out (X'0F').
Return codes