Purpose
This is the COBOL parser translator,
written in REXX, that parses the source identified by the SOURCE DDNAME.
Functions
One of the functions of an SCLM
parser is to determine a module's dependencies. FLMLRCBL determines
the names of dependencies that are to be copied into the COBOL source.
The
parser uses the following syntax rules to locate dependency names:
- The search for tokens is restricted to columns 8 -72. Column 7
is ignored except when it contains '*' or '/' (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.
- 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 and
the member name is taken as the name of a dependency.
- When the 3 tokens EXEC, SQL, and INCLUDE are found in order on
1 or more uncommented lines after column 7, with no intervening text,
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 and the member name is taken as the
name of a dependency.
- 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 quoted
member names following COPY statements. Reserved words inside quoted
strings and comments will not be counted as statements.
- FLMLRCBL recognizes COPY or EXEC SQL INCLUDE anywhere in the source
file (as long as they are not in quotation marks or comments).
Multiple COPY or EXEC SQL INCLUDE
statements on any line or continued line are recognized.
The
following example illustrates conditions under which dependencies
will and will not be formed. Each MEMBER# token appears in an example
of syntax that the parser recognizes as creating a dependency. A MEMBER#
token must be from 1 to 8 characters. The BADCPY1 and BADCOPY02 statements
in the example will not create dependencies for the following reasons:
- BADCPY1 and the COPY preceding it are inside a quoted string and
are therefore ignored.
- BADCOPY02 is longer than 8 characters.
123456*<-Column 7 Column 72->
001010 FD TEST-FILE COPY MEMBER1.
001200 01 I-O-CNTL . COPY 'MEMBER2'
001201 01 I-O-CNTL COPY "MEMBER3" .
001201 01 LABEL PIC X VALUE 'EXTRA COPY
001201- BADCPY1 '.
001202 EXEC SQL INCLUDE MEMBER4
001202 EXEC SQL INCLUDE 'MEMBER5'
001202 EXEC SQL INCLUDE "MEMBER6"
001300 COPY
001300* copy across a comment line
001300 MEMBER7.
001400 01 TESTNAMX COPY MEMBER8 . COPY MEMBER9.
001401 77 TESTNAME . COPY BADCOPY02.
Another
function of the parser is to gather statistics or metrics for each
module to be parsed. SCLM saves 10 statistics; only 7 are generated
by this parser. For COBOL, this parser defines the following 10 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 and blank lines that are found before
the first noncomment line.
- Total statements
- The number of the following reserved words that appear on an uncommented
line after column 7:
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
Use the following guidelines
to specify parameters:
- The order of the parameters is not important.
- See the language definitions provided by SCLM for the actual usage
of the parameters for FLMLRCBL.
The following keyword parameters,
separated by commas, are required as input for FLMLRCBL:
- LISTINFO
- Pointer to the SCLM list information record. This parameter is
required and must be set to @@FLMLIS.
- LISTSIZE
- The size of the LISTINFO buffer. This parameter is required and
must be set to @@FLMSIZ. The parser checks to make sure that the LISTSIZE
parameter is large enough to hold at least one entry of 228 bytes.
- STATINFO
- Pointer to the SCLM statistics information record. This parameter
is required and must be set to @@FLMSTP.
Return codes