Generation Control Language Syntax

The Generation Control Language (GCL) has 14 types of statements.
micsrm140cd
The Generation Control Language (GCL) has 14 types of statements.
Each GCL statement must begin with a colon:
 
GCL Statements
 
FUNCTION
STATEMENT
GENERAL FORMS
Comments
:*
:* any comments
Branching
:GOTO
:GOTO c
Labels
:label:
:c:
Conditional testing
:IF
:IF a = b THEN
Conditional testing
:IF
:IF a = b THEN GOTO c
Conditional testing
:IF
:IF a NE b THEN
Conditional testing
:IF
:IF a NE b THEN GOTO c
Conditional testing
:IF
:IF EXIST a THEN ...
Conditional testing
:IF
:IF NOT_EXIST a THEN
Else conditions
:ELSE
:ELSE
Else conditions
:ELSE
:ELSE GOTO c
Setting values
:SET
:SET a = b
Setting values
:SET
:SET LBL + 1
Setting values
: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 a job
:GENERATE
:GENERATE job location
Include PARM member
:INCLUDEPARM
:INCLUDEPARM member
Exit PROTO member
:EXIT
:EXIT
Include list of PROTO members
:INCLUDELIST
:INCLUDELIST stp lo hi
Include PROTO member repeatedly
:REPEATINCLUDE
:REPEATLINCLUDE m l
GCL was written for a specific purpose--JCLGEN. To keep the implementation as simple as possible, the language has rigid, simple syntax rules. The TSO CLIST language was used as a design guide for GCL; however, GCL does not work 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 can start in column 1 or later; however, nothing can 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 previous 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 can only branch forward (down toward 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 previous example is invalid because the branch label must not contain a beginning or ending colon. or both.

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 can be "reused." Nothing can 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 previous example is invalid because the label does not have an ending colon. JCLGEN flags this error as an unknown GCL statement.

CONDITIONAL TESTING ( :IF )

The purpose of this statement is to provide a 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 (&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 is executed. If the comparison is false, the next single statement is 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 previous 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 can 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 previous example is invalid because the THEN word is always required.
The special comparison operators EXIST and NOT_EXIST are used to test whether a JCLGEN variable has been defined to the JCLGEN process. This action can be used to prevent unresolved variable errors that can occur in JCLGEN processing.
The following example tests if the variable a has been defined:
:IF EXIST a THEN
The following example tests if the variable a has not been defined.
:IF NOT_EXIST a THEN
Note:
 Actual variable name is used. If an ampersand is used, then variable resolution takes place and the resolved value is tested for existence.
For example:
:SET A = SMFID :IF EXIST &A THEN
tests for the existence of variable SMFID.

ELSE CONDITIONS ( :ELSE )

The purpose of this statement is to provide a 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 cannot follow a conditional :INCLUDE or :INCLUDEPARM. This restriction is necessary because the included member can contain GCL statements.
Invalid example:
 
:IF &DATABASE = NORTH THEN :INCLUDE DYNORTH :ELSE :INCLUDE DYSOUTH
The previous 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 can 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 can define new symbolic variables in sharedprefix.MICS.PARMS(JCLDEFC) or in prefix.MICS.PARMS(JCLDEF) through the USERDEF keyword. To define new symbolic variables, start with the three characters "USR" to prevent conflict with existing
MICS
symbols.
The value the symbol is set can be another predefined symbolic variables and a constant or both. If the value contains special characters, it should be specified though the &STR function. If the value contains blanks, it is 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 previous example is invalid because the second :SET value contains embedded blanks. Write the value as follows:
:SET USRHEADING = &STR('MICS RELEASE &USRRLSE')
A special form of :SET is used to increase the file label sequence number that is specified in tape DD statements. The special form must be written as shown here. Note the lack of an equal sign.
:SET LBL + 1
Any attempt to use the + operator with a symbol other than LBL results 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 can define new symbolic variables in sharedprefix.MICS.PARMS(JCLDEFC) or in prefix.MICS.PARMS(JCLDEF) through the USERDEF keyword. To define new symbolic variables, start with the three characters "USR" to prevent conflict with existing
MICS
symbols.
Valid examples:
 
:SETLIST USRCOMP = &USR1 &USR2 &USR3 :SETLIST USRCOMP = 4096 &USR2 X Y #Z
Invalid example:
 
:SETLIST USRCOMP &USR1 &USR2 &USR3
The previous 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 that is 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 previous 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 can be specified following the :JOBCARD command name. If the job name is missing, the current member's job name is used. The name is used to search the JCLINFO and JCL$Iccc tables. If the job name is found, the values that are specified for TIME, LINES, COPIES, CLASS, and PRIORITY is used. If the job name is not found, the DEFAULT entry information is used.
Valid example:
 
:JOBCARD MONTHLYB
Invalid example: 
 
:JOBCARD MONTHLYB1
The previous example is invalid because the name exceeds eight 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 cannot be an :ELSE. Up to six nested :INCLUDEs can be defined. Any number of non-nested :INCLUDEs can be in a member.
Note:
 For nesting limit, :INCLUDE and :INCLUDEPARM (described later) 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 previous example is invalid because member F is at the sixth level and cannot 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 cannot be an :ELSE. Up to six nested :INCLUDEPARMs can be defined. Any number of non-nested :INCLUDEPARMSs can be in a member.
Note:
 For the nesting limit, :INCLUDE and :INCLUDEPARM must be counted together.
Valid example:
 
:INCLUDEPARM ABC
Invalid example:
 
:INCLUDEPARM ABC DEF
The previous example is invalid because you cannot specify more than one member name.

DYNAMICALLY GENERATE JOBS (:GENERATE )

The GENERATE statement is used to request the generation of more jobs.
Unlike :INCLUDE, :GENERATE actually creates a 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.
A sample library specification follows:
  • CNTL
  • CLIST
  • MACRO
  • PARMS USOURCE
Valid example:
 
:GENERATE MYPARM PARMS
Invalid example:
 
:GENERATE MYPARM :GENERATE MYPARM MACLIB
  • The first example is invalid because no destination library has been specified.
  • 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 that is specified in the GENLIST is begun.
Valid example:
 
:IF &AUTOSUBMIT EQ YES THEN :EXIT
Invalid example:
 
:IF &AUTOSUBMIT EQ YES THEN :EXIT:
The previous 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 special purpose statement is 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 is selected. Valid step names types are DYSTEPS, WKSTEPS, MNSTEPS, and YRSTEPS. PROTOLIB members that can be processed are DYcccnnn, WKcccnnn, MNcccnnn, and YRcccnnn where ccc is the identifier of a component that is defined in the database unit and nnn is the component step number that must fall between the low and high values that are specified in the :INCLUDELIST statement.
Valid example:
 
:INCLUDELIST DYSTEPS ___010 ___199
Invalid example:
 
:INCLUDELIST &MSGCLASS
The previous 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 contains 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 contains 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 previous example is invalid because no repeat value name is specified.