You can use the FLMTRNSL macro to define translators for a language. The parameters of the FLMTRNSL
macro define all the attributes needed to call a given translator.
The FLMTRNSL FUNCTN parameter defines the function or purpose for
which a translator is called. SCLM uses translators for the following
functions:
- Parsing source code to determine statistics and dependency information. SCLM
calls these translators when a member is saved in the editor or migrated
(dialog function or MIGRATE service) or saved with the SAVE service.
- Translating one form of code into another, for example:
- Source code to object code and listings
- Script input to a formatted document
- Object code to load modules
SCLM calls these translators during
the build process.
- Verifying data. A verify translator performs validation in addition
to the default SCLM validation. The verify translator is invoked before
the translation step (such as compiling and linking) of build, and
before the copy phase of promote.
- Copying data. SCLM calls these translators during the promote
process. The
data can be either PDS members controlled directly by SCLM or non-PDS
data that includes an intermediate form of compilation units and external
data identified to SCLM via a build translator.
- Purging data. SCLM calls these translators during the promote
process. The data can be either PDS members controlled directly by
SCLM or non-PDS data that includes an intermediate form of compilation
units and external data identified to SCLM via a build translator.
The translators required for a language are language-specific.
Some languages require parse and build translators while others need
parse, build, copy, and purge translators.
Most SCLM-supplied example language definitions have two translators
defined. The first identifies the parser to be invoked, and the second
identifies the translator to be invoked during a build. Language definitions
can be created for the invocation of one or more translators during
the parse, build, copy, verify, or purge functions. For each of these
functions, the translators are invoked in the order in which they
appear in the language definition. Within a function in the language
definition, a translator can pass data on to the next translator invoked
by that function within the language definition. This capability allows
you to customize the SCLM product for unique processing requirements
in your project.
When connecting SCLM translators in a language definition, make
sure they are ordered so that they will execute in the correct sequence.
If used for build, you should order the preprocessing and compile
steps as you would in a CLIST or JCL.
If multiple-step language definitions specify more than one translator
to be invoked during a build, make sure the DDNAMEs for outputs to
be copied into the project hierarchy are unique. If the same DDNAME
is used, only the outputs from the last translator will be copied
to the hierarchy. For more information, refer to Using DDnames and DDname substitution lists.
Figure 1 shows a language definition that
uses multiple translators. The DB2® preprocessor
(DSNHPC) creates a COBOL source data set using the SYSCIN ddname.
The next translator, the COBOL II compiler IGYCRCTL, reads in the
SYSCIN data set.
Note that the receiving translator defines SYSCIN as IOTYPE=U,
meaning that SYSCIN has already been allocated in a previous translator
step.
Figure 1. COBOL
II with DB2 Preprocessor (Part
1 of 2)***********************************************************************
* COBOL II WITH DB2 PREPROCESSOR - LANGUAGE DEFINITION FOR SCLM
*
* DB2 OUTPUT IS PASSED VIA THE 'SYSCIN' DD ALLOCATION TO COBOL II.
* POINT THE FLMSYSLB MACRO(S) AT ALL 'STATIC' COPY DATASETS.
* CUSTOMIZE THE 'OPTIONS' AND 'GOODRC' FIELDS TO YOUR STANDARDS.
* ADD THE 'DSNAME' FIELD IF THE TRANSLATOR IS IN A PRIVATE LIBRARY.
* WHEN A NEW TRANSLATOR VERSION REQUIRES TOTAL RECOMPILATION FOR THIS
* LANGUAGE, THE 'VERSION' FIELD ON FLMLANGL SHOULD BE CHANGED.
***********************************************************************
* CHANGE ACTIVITY: *
* *
***********************************************************************
*
FLMLANGL LANG=DB2COB2,ALCSYSLB=Y
*
* PARSER TRANSLATOR
*
FLMTRNSL CALLNAM='SCLM COBOL PARSE', C
FUNCTN=PARSE, C
COMPILE=FLMLPCBL, C
PORDER=1, C
OPTIONS=(@@FLMLIS,@@FLMSTP,@@FLMSIZ,)
* (* SOURCE *)
FLMALLOC IOTYPE=A,DDNAME=SOURCE
FLMCPYLB @@FLMDSN(@@FLMMBR)
*
* BUILD TRANSLATORS
*
* --DB2 PREPROCESSOR INTERFACE--
FLMTRNSL CALLNAM='DB2 PREPROCESS', C
FUNCTN=BUILD, C
COMPILE=DSNHPC, C
VERSION=1.0, C
GOODRC=4, C
PORDER=3, C
OPTIONS=(HOST(COB2))
* 1 -- N/A --
FLMALLOC IOTYPE=N
* 2 -- N/A --
FLMALLOC IOTYPE=N
* 3 -- N/A --
FLMALLOC IOTYPE=N
* 4 -- SYSLIB --
FLMALLOC IOTYPE=I,KEYREF=SINC
* 5 -- SYSIN --
FLMALLOC IOTYPE=S,KEYREF=SINC,RECFM=FB,LRECL=80, C
RECNUM=2000
* 6 -- SYSPRINT --
FLMALLOC IOTYPE=W,RECFM=FBA,LRECL=121, C
RECNUM=9000,PRINT=I
* 7 -- N/A --
FLMALLOC IOTYPE=N
* 8 -- SYSUT1 --
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=800,RECNUM=9000
* 9 -- SYSUT2 --
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=800,RECNUM=9000
* 10 -- SYSUT3 --
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=800,RECNUM=9000
Figure 2. COBOL II with DB2 Preprocessor (Part 2 of 2)* 11 -- N/A --
FLMALLOC IOTYPE=N
* 12 -- SYSTERM --
FLMALLOC IOTYPE=A
FLMCPYLB NULLFILE
* 13 -- N/A --
FLMALLOC IOTYPE=N
* 14 -- SYSCIN --
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=80, C
RECNUM=9000,DDNAME=SYSCIN
* 15 -- N/A --
FLMALLOC IOTYPE=N
* 16 -- DBRMLIB--
FLMALLOC IOTYPE=P,DDNAME=DBRMLIB,MEMBER=@@FLMONM, C
DFLTTYP=DBRM,KEYREF=OUT1, C
RECFM=FB,LRECL=80,RECNUM=5000,DIRBLKS=1
*
* --COBOL II INTERFACE--
*
FLMTRNSL CALLNAM='COBOL II COMPILER', C
FUNCTN=BUILD, C
COMPILE=IGYCRCTL, C
VERSION=2.0, C
GOODRC=0, C
PORDER=3, C
OPTIONS=(XREF,LIB,APOST,NODYNAM,LIST,NONUMBER,NOSEQ)
*
* DDNAME ALLOCATION (USING DDNAMELIST SUBSTITUTION)
*
* 1 (* SYSLIN *)
FLMALLOC IOTYPE=O,KEYREF=OBJ,RECFM=FB,LRECL=80, C
RECNUM=5000,DFLTTYP=OBJ,DDNAME=SYSLIN
* 2 (* N/A *)
FLMALLOC IOTYPE=N
* 3 (* N/A *)
FLMALLOC IOTYPE=N
* 4 (* SYSLIB *)
FLMALLOC IOTYPE=I,KEYREF=SINC,DDNAME=SYSLIB
* 5 (* SYSIN *)
FLMALLOC IOTYPE=U,DDNAME=SYSCIN
* 6 (* SYSPRINT *)
FLMALLOC IOTYPE=O,KEYREF=OUT2,RECFM=FBA,LRECL=133, C
RECNUM=25000,PRINT=Y,DFLTTYP=LIST,DDNAME=SYSPRINT
* 7 (* SYSPUNCH *)
FLMALLOC IOTYPE=A
FLMCPYLB NULLFILE
* 8 (* SYSUT1 *)
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=80,RECNUM=5000
* 9 (* SYSUT2 *)
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=80,RECNUM=5000
* 10 (* SYSUT3 *)
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=80,RECNUM=5000
* 11 (* SYSUT4 *)
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=80,RECNUM=5000
* 12 (* SYSTERM *)
FLMALLOC IOTYPE=A,DDNAME=SYSTERM
FLMCPYLB NULLFILE
* 13 (* SYSUT5 *)
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=80,RECNUM=5000
* 14 (* SYSUT6 *)
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=80,RECNUM=5000
* 15 (* SYSUT7 *)
FLMALLOC IOTYPE=W,RECFM=FB,LRECL=80,RECNUM=5000