Purpose
This is the C/370™ 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 all of a module's dependencies. FLMLRC37 determines
all of the names that will be copied into the C/370 source.
The parser uses the following
syntax rules to locate dependency names:
- The search for tokens is restricted to uncommented text.
- When an uncommented line has #INCLUDE as the first token, followed
by a token enclosed in double quotes ("MEMBER") or angle brackets
(<MEMBER>), the enclosed token is accepted as the name of a
dependency. Note the following exceptions.
- When an uncommented line has EXEC, SQL, and INCLUDE as its first
three tokens, the next token is accepted as the name of a dependency.
- Tokens inside strings or comments are ignored. /* */ pairs
are recognized as comment delimiters by the FLMLRC37 parser. Lines
starting with // are also recognized as comments.
Dependencies are generated after
removing excess characters (all characters up to and including the
rightmost /, if any, and all characters from the first period (.)
to the end of the file name). Any underscore characters (_) are replaced
by at sign characters (@). Dependency names longer than 8 characters
are truncated to 8 characters and a return code of 4 is issued. The
following table illustrates how dependencies are derived from include
directives.
Table 1. Examples of dependancies derived from include directives#include Directive |
Dependency Generated |
Return Code |
---|
#include "abc" |
ABC |
0 |
#include <sys/abc/xx> |
XX |
0 |
#include "Sys/abc/xx.h" |
XX |
0 |
#include <sys/name_1> |
NAME@1 |
0 |
#include "Name2/App1.App2" |
APP1 |
0 |
#include "xx.h.a" |
XX |
0 |
#include <DD:PLAN(YEAR)> |
NONE |
4 |
#include <'USER.SRC.MYINCS'> |
NONE |
4 |
#include "abc456789" |
ABC45678 |
4 |
The following example further 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. The BADCPY# statements will not create dependencies
for the following reasons:
- BADCPY1 is inside comment delimiters.
- BADCPY2 is not inside quotes or angle brackets.
- BADCPY3 is inside a string.
/* #include "badcpy1" */
#include "member1"
#include <member2>
#include badcpy2
EXEC SQL INCLUDE member3
printf '#include badcpy3'
Another function of the parser
is to gather statistics or metrics for each module to be parsed. SCLM
saves 10 statistics, but only 4 are generated by this parser. For C/370, this parser defines the
ten statistics as follows:
- Total lines
- The total number of records in the file.
- Comment lines
- This value is always 0.
- Noncomment lines
- This is the same as the total lines.
- Blank lines
- The number of lines that contain only blanks.
- Prolog lines
- This value is always 0.
- Total statements
- This value is always 0.
- Comment statements
- The total number of /* */ pairs in the member.
- Control statements
- This value is always 0.
- Assignment statements
- This value is always 0.
- Noncomment statements
- This value is always 0.
Parameters
The following guidelines apply
when specifying parameters:
- The order of the parameters is not important.
- See the language definitions provided by SCLM for the actual use
of the parameters for FLMLRC37.
The following keyword parameters,
separated by commas, are required as input to FLMLRC37
- 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