Previous Topic: 2.3.3.3.3.1 Generation Control Language Variables

Next Topic: 2.3.3.3.3.3 Using the Generation Control Language

2.3.3.3.3.2 Generation Control Language Syntax

The Generation Control Language (GCL) has 14 types of
statements, each of which must begin with a colon:

+-----------------------------------------------------------+
| FUNCTION            | STATEMENT    | GENERAL FORMS        |
+---------------------+--------------+----------------------+
| Comments            |:*            |:* any comments       |
|                     |              |                      |
| Branching           |:GOTO         |:GOTO c               |
|                     |              |                      |
| Labels              |:label:       |:c:                   |
|                     |              |                      |
| Conditional testing |:IF           |:IF a = b THEN        |
|                     |              |:IF a = b THEN GOTO c |
|                     |              |:IF a NE b THEN       |
|                     |              |:IF a NE b THEN GOTO c|
|                     |              |:IF EXIST a THEN ...  |
|                     |              |:IF NOT_EXIST a THEN  |
|                     |              |                      |
| Else conditions     |:ELSE         |:ELSE                 |
|                     |              |:ELSE GOTO c          |
|                     |              |                      |
| Setting values      |:SET          |:SET a = b            |
|                     |              |:SET LBL + 1          |
|                     |              |                      |
|                     |:SETLIST      |:SETLIST l = a b c    |
|                     |              |                      |
| Prevent JOB card    |:NOJOBCARD    |:NOJOBCARD            |
|                     |              |                      |
| Create JOB card     |:JOBCARD      |:JOBCARD name         |
|                     |              |                      |
| Include PROTO member|:INCLUDE      |:INCLUDE member       |
|                     |              |                      |
| Dynamically include |:GENERATE     |:GENERATE job location|
| a job               |              |                      |
|                     |              |                      |
| Include PARM member |:INCLUDEPARM  |:INCLUDEPARM member   |
|                     |              |                      |
| Exit PROTO member   |:EXIT         |:EXIT                 |
|                     |              |                      |
| Include list of     |:INCLUDELIST  |:INCLUDELIST stp lo hi|
| PROTO members       |              |                      |
|                     |              |                      |
| Include PROTO member|:REPEATINCLUDE|:REPEATLINCLUDE m l   |
| repeatedly          |              |                      |
+---------------------+--------------+----------------------+
 Figure 2-32. GCL Statements
GCL was written for a very specific purpose--JCLGEN.  To keep
the implementation as simple as possible, the language has
very rigid, simple syntax rules.  The TSO CLIST language was
used as a design guide for GCL; however, GCL does not work
just like CLISTs.

GCL has the following general rules:

1.  Only one statement can appear on a line.  Continuation is
    not allowed.

2.  All GCL statements begin with a colon.  The colon may
    start in column 1 or later; however, nothing may precede
    it.

3.  There cannot be any blanks between the colon and the GCL
    command name.


COMMENTS ( :*    )

    The purpose of this statement is to provide documentation
    in the code.  A comment can appear anywhere within the
    prototype member.

    valid example
        :*  THIS IS A COMMENT

    invalid example
        DATA HERE :* ONLY ONE STATEMENT PER LINE

    The above example is invalid because characters precede
    the GCL colon.

BRANCHING ( :GOTO )

    The purpose of this statement is to skip over one or more
    prototype member statements.  You may only branch forward
    (down towards the last statement in the prototype
    member).  Branching is done by reading and ignoring
    statements until a label matching the branch label is
    found.  If the end of the member is reached before the
    label is found, an error message is printed and
    processing of this member is terminated.

    valid example
        :GOTO B
        :A:
        //* THIS JCL WILL NOT BE IN THE OUTPUT
        . . .
        :B:
        //* THIS JCL WILL BE IN THE OUTPUT

    invalid example
        :GOTO :ERROR:

    The above example is invalid because the branch label
    must not contain a beginning and/or ending colon.

LABELS ( :label: )

    The purpose of this statement is to identify a
    termination point for a branch.  All GCL labels begin and
    end with a colon.  Since all branching is downward to a
    label statement not yet read, an old label name may be
    "reused." Nothing may follow the ending colon.

    valid example
        :IF &A = YES THEN GOTO CONTINUE
        //*  SYMBOL A IS NOT EQUAL TO YES
        ...
        :CONTINUE:
        ...
        :IF &B NE 5 THEN GOTO CONTINUE
        //*  SYMBOL B IS EQUAL TO 5
        ...
        :CONTINUE:

    invalid example
        :CONTINUE

    The above example is invalid because the label does not
    have an ending colon.  JCLGEN will flag this as an
    unknown GCL statement.

CONDITIONAL TESTING ( :IF )

    The purpose of this statement is to provide conditional
    statement execution.  The statement in its basic form is
    written:

        :IF a operator b THEN

    The "a" and "b" represent symbols or constant values.  If
    "a" or "b" contain special characters or blanks, they
    must be specified with the GCL &STR function (i.e.,
    &STR(3400-4))

    The valid comparison operators are:

        = ^=  EQ NE

    The word "THEN" is always required.  If the comparison
    specified is true, the next single statement will be
    executed.  If the comparison is false, the next single
    statement will be ignored.

    valid example
        :IF &DATABASE = NORTH THEN
        :INCLUDE DYNORTH
       or
        :IF &TAPEUNIT = &STR(3400-5) THEN
        :SET USRTAPE = &TAPEUNIT

    invalid example
        :IF &SMF = YES AND &TSO = YES THEN

    The above example is invalid because it contains a
    compound expression.  However, it could have been written
    as follows:

        :IF &SMF&TSO = YESYES THEN


    In the basic form of the :IF statement, nothing may
    follow the THEN.  A second form of the :IF statement is
    provided to allow conditional branching.  Its special
    form is:

        :IF a operator b THEN GOTO c

    The special form is an abbreviation for the following
    basic form:

        :IF a operator b THEN
        :GOTO c

    valid example
        :IF &VCA NE YES THEN GOTO SKIPVCA

    invalid example
        :IF &DATABASE = NORTH GOTO NORTHFOUND

    The above example is invalid because the THEN word is
    always required.

    The special comparison operators EXIST and NOT_EXIST are
    used to test whether or not a JCLGEN variable has been
    defined to the JCLGEN process.  This can be used to
    prevent unresolved variable errors that may occur in
    JCLGEN processing.

    The following example will test if the variable a has
    been defined:

        :IF EXIST a THEN

    The following example will test if the variable a has not
    been defined.

        :IF NOT_EXIST a THEN

    Note that the actual variable name is used.  If an
    ampersand is used, then variable resolution takes place
    and the resolved value is tested for existance.

    For example:

    :SET A = SMFID
    :IF EXIST &A THEN

    will test for the existance of variable SMFID.

ELSE CONDITIONS ( :ELSE )

    The purpose of this statement is to provide conditional
    execution of a single statement if the previous :IF
    statement was false.

    valid example
        :IF &DATABASE = NORTH THEN
        //@ THIS STATEMENT IN NORTH JCL
        :ELSE
        //@ THIS STATEMENT NOT IN NORTH JCL

    An :ELSE may not follow a conditional :INCLUDE or
    :INCLUDEPARM.  This restriction is necessary since the
    included member may contain GCL statements.

    invalid example
        :IF &DATABASE = NORTH THEN
        :INCLUDE DYNORTH
        :ELSE
        :INCLUDE DYSOUTH

    The above example is invalid because the :ELSE follows a
    conditional :INCLUDE.  The valid way to get the desired
    result is as follows:

        :IF &DATABASE = NORTH THEN
        :INCLUDE DYNORTH
        :IF &DATABASE NE NORTH THEN
        :INCLUDE DYSOUTH

    In the basic form of the :ELSE statement, nothing may
    follow the :ELSE command name.  A second form of the
    :ELSE statement is provided to allow conditional
    branching.  Its special form is as follows:

        :ELSE GOTO c

    The special form is an abbreviation for the following
    basic form:

        :ELSE
        :GOTO c

SETTING VALUES ( :SET )

    The purpose of this statement is to save the specified
    value in the named symbolic variable.  The symbolic
    variable name can be up to 31 characters long.  You may
    define new symbolic variables in
    sharedprefix.MICS.PARMS(JCLDEFC) or in
    prefix.MICS.PARMS(JCLDEF) via the USERDEF keyword.  To
    define new symbolic variables, start with the three
    characters "USR" to prevent conflict with existing
    CA MICS symbols.

    The value to which the symbol is set can be another
    predefined symbolic variables and/or a constant.  If the
    value contains special characters, it should be specified
    via the &STR function.  If the value contains blanks, it
    must be surrounded by apostrophes within the &STR
    function.

    valid example
        :SET USRDEVICE = &STR(3400-4)

    invalid example
        :SET USRRLSE = 6
        :SET USRHEADING = MICS RELEASE &USRRLSE
        //@ &USRHEADING

    The above example is invalid because the second :SET
    value contains embedded blanks.  The value should have
    been written:

        :SET USRHEADING = &STR('MICS RELEASE &USRRLSE')

    A special form of :SET is used to increment the file
    label sequence number specified in tape DD statements.
    The special form must be written as shown below.  Note
    the lack of an equal sign.

        :SET LBL + 1

    Any attempt to use the + operator with a symbol other
    than LBL will result in an error.

SETTING VALUES ( :SETLIST )

    The purpose of this statement is to save the values of 1
    or more symbolic variables in the named symbolic
    variable.  Constants can also be introduced, including
    special characters.

    The symbolic variable name can be up to 31 characters
    long.  You may define new symbolic variables in
    sharedprefix.MICS.PARMS(JCLDEFC) or in
    prefix.MICS.PARMS(JCLDEF) via the USERDEF keyword.  To
    define new symbolic variables, start with the three
    characters "USR" to prevent conflict with existing CA
    MICS symbols.

    valid examples
        :SETLIST USRCOMP = &USR1 &USR2 &USR3
        :SETLIST USRCOMP = 4096  &USR2 X Y #Z

    invalid example
        :SETLIST USRCOMP &USR1 &USR2 &USR3

    The above example is invalid because an equal sign was
    not used to separate the symbol name from the value list.

PREVENT JOB CARD ( :NOJOBCARD )

    The purpose of this statement is to prevent the automatic
    creation of a JOB card for a JCL member.  This statement
    must be the first noncomment statement read from the
    MICS.PROTOLIB member during the creation of the JCL
    member.

    valid example
        :NOJOBCARD
        :IF &AUTOSUBMIT = YES THEN
        :JOBCARD BACKUPJ

    invalid example
        :IF &AUTOSUBIT = NO THEN
        :NOJOBCARD

    The above example is invalid because the :NOJOBCARD comes
    too late--the JOB card has already been created.

CREATE JOB CARD ( :JOBCARD )

    The purpose of this statement is to create a JOB card
    where specified in the generated member.  This statement
    is intended for jobs that submit other jobs to the JES
    internal reader.  A job name may be specified following
    the :JOBCARD command name.  If the job name is missing,
    the current member's job name will be used.  The name is
    used to search the JCLINFO and JCL$Iccc tables.  If the
    job name is found, the values specified for TIME, LINES,
    COPIES, CLASS, and PRIORITY will be used.  If the job
    name is not found, the DEFAULT entry information will be
    used.

    valid example
        :JOBCARD MONTHLYB

    invalid example
        :JOBCARD MONTHLYB1

    The above example is invalid because the name exceeds 8
    characters.

INCLUDE PROTOLIB MEMBER ( :INCLUDE )

    The purpose of this statement is to process members from
    the MICS.PROTOLIB library into the member being
    generated.  After reaching the end of the included
    member, generation continues with the statement following
    the :INCLUDE statement.  This next statement may not be
    an :ELSE.  Up to six nested :INCLUDEs can be defined.
    Any number of non-nested :INCLUDEs can be in a member.
    Note that for the purpose of the nesting limit, :INCLUDE
    and :INCLUDEPARM (described below) must be counted
    together.

    valid example
        :INCLUDE ABC

    invalid example
         :INCLUDE A

         assume that:
           member A contains - :INCLUDE B
           member B contains - :INCLUDE C
           member C contains - :INCLUDE D
           member D contains - :INCLUDE E
           member E contains - :INCLUDE F
           member F contains - :INCLUDE G
           member G contains - :*

    The above example is invalid because member F is at the
    sixth level and may not include a seventh (:INCLUDE G).

INCLUDE PARMLIB MEMBER ( :INCLUDEPARM )

    The purpose of this statement is to process members from
    the MICS.PARMS library into the member being generated.
    After reaching the end of the included member, generation
    continues with the statement following the :INCLUDEPARM
    statement.  This next statement may not be an :ELSE.  Up
    to six nested :INCLUDEPARMs can be defined.  Any number
    of non-nested :INCLUDEPARMSs can be in a member.  Note
    that for the purpose of the nesting limit, :INCLUDE
    (described above) and :INCLUDEPARM must be counted
    together.

    valid example
        :INCLUDEPARM ABC

    invalid example
        :INCLUDEPARM ABC DEF

    The above example is invalid because you may not specify
    more than one member name.

DYNAMICALLY GENERATE JOBS (:GENERATE )

    The GENERATE statement is used to request the generation
    of additional jobs.

    Unlike :INCLUDE, :GENERATE actually creates a new member
    in the target library.

    you can also use :GENERATE to define dependencies between
    jobs.  For example, the statement ":GENERATE B CNTL" in
    the PROTOLIB member for job A requests that whenever JOB
    A is generated also generate job B.

    The library specification can be the following:

        CNTL
        CLIST
        MACRO
        PARMS
        USOURCE


    valid example
        :GENERATE MYPARM PARMS

    invalid example
        :GENERATE MYPARM
        :GENERATE MYPARM  MACLIB

      o  The first example is invalid because no destination
         library has been specified.

      o  The second example is invalid because MACLIB is an
         invalid destination library.

EXIT MEMBER ( :EXIT )

    The purpose of this statement is to return control to the
    member which included this member.  If this member was
    specified in the GENLIST member, the generation for this
    member is finished and the next member specified in the
    GENLIST is begun.

    valid example
        :IF &AUTOSUBMIT EQ YES THEN
        :EXIT

    invalid example
        :IF &AUTOSUBMIT EQ YES THEN
        :EXIT:

    The above example is invalid because the ending colon
    makes this GCL statement into a valid label and
    processing would continue.

INCLUDE LIST OF PROTOLIB MEMBERS (:INCLUDELIST)

    This is a special purpose statement used to include the
    DAYS, WEEKS, MONTHS, and YEARS job step members from
    MICS.PROTOLIB when generating the DAILY, WEEKLY, MONTHLY,
    and YEARLY jobs.  The parameters specify the type of job
    steps to be included and a low and high step suffix
    number value.  Only the step members that fall within the
    range of these values will be selected.  Valid step names
    types are DYSTEPS, WKSTEPS, MNSTEPS, and YRSTEPS.
    PROTOLIB members that may be processed are DYcccnnn,
    WKcccnnn, MNcccnnn, and YRcccnnn where ccc is the
    identifier of a component defined in the database unit
    and nnn is the component step number that must fall
    between the low and high values specified in the
    :INCLUDELIST statement.

    valid example
        :INCLUDELIST DYSTEPS ___010 ___199

    invalid example
        :INCLUDELIST &MSGCLASS

    The above example is invalid because it does not specify
    a valid job step type or provide a low or high range
    value.

REPEATEDLY INCLUDE A PROTOLIB MEMBER (:REPEATINCLUDE)

    The purpose of this statement is to include the specified
    MICS.PROTOLIB member multiple times.  For each inclusion,
    the &RIP internal symbol will contain a different value
    from the specified list.  The :REPEATINCLUDE statement
    cannot be nested.

    valid example
        :SET KW = &STR(A BB CCC DDDD)
        :REPEATINCLUDE MYMEMBER KW

    PROTOLIB member MYMEMBER would be included four times.
    The variable &RIP will contain a value of A for the first
    include, BB for the second, CCC for the third, and DDDD
    for the last include.


    invalid example
        :REPEATINCLUDE SMFCOMPTS

    The above example is invalid because no repeat value name
    is specified.