Previous Topic: 2.3.3.3.3 Generation Control Language

Next Topic: 2.3.3.3.3.2 Generation Control Language Syntax

2.3.3.3.3.1 Generation Control Language Variables

When JCLGEN is processing your definitions, it must have a
method of placing the information you provide into the
records being created. This process of substitution is done
via symbolic variables similar to normal IBM CLIST and JCL
processing. The prototype statements from MICS.PROTOLIB or
MICS.PARMS may contain symbolic variables that JCLGEN
replaces with the values you defined.

Symbolic variables begin with an ampersand (&) and are
terminated by any of the common separator characters such as
a space, parenthesis, another ampersand, equal sign, and so on. 
If the delimiter is a period, it is taken out of further
processing. Two ampersands in a row (&&) are replaced with a
single ampersand. Substitution of symbolics are repeated on
a line until no more symbolics are found.

Besides supporting symbolic variables substitution, the
JCLGEN process has a number of built-in functions:
&DATATYPE, &LENGTH, &STR, &SUBSTR, and &DLM.

Examples of symbolic substitutions and functions are shown
below. For these examples, assume that the values of the
symbolic variables are as follows:

            &CICDATA      = &prefix..MICS.CIC.DATA
            &DASDSMSPARMS = STORCLAS=MICSTEMP
            &DASDUNIT     = SYSDA
            &JOBLINES     = 50
            &PREFIX       = XYZ.CICS
            &PROG         = 'MICS PROGRAMMER'
            &RIP          = CIC
            &SAVEMEMBER   = SMFINITA
            &TAPEUNIT     = 3400-5

Standard substitution works by replacing the name of the
symbol with the symbol's value. This process repeats until
there are no more symbol names present in the prototype
statement.

  Example 1:
    Before: //WORK   DD  UNIT=&DASDUNIT,
    After:  //WORK   DD  UNIT=SYSDA,

The next example shows the use of the &STR function and 
multiple substitutions. &STR returns the value within the
parenthesis as is.

  Example 2:
    Before: //CICDATA DD DISP=SHR,DSN=&&&RIP&STR(DATA)
    Scan 1: //CICDATA DD DISP=SHR,DSN=&CICDATA
    Scan 2: //CICDATA DD DISP=SHR,DSN=&PREFIX..MICS.CIC.DATA
    After:  //CICDATA DD DISP=SHR,DSN=XYZ.CICS.MICS.CIC.DATA

In this case, the &STR function was not needed. The
statement could have been written as in the next example and
would give the same results.

  Example 3:
    Before: //CICDATA DD DISP=SHR,DSN=&&&RIP.DATA
    Scan 1: //CICDATA DD DISP=SHR,DSN=&CICDATA
    Scan 2: //CICDATA DD DISP=SHR,DSN=&PREFIX..MICS.CIC.DATA
    After:  //CICDATA DD DISP=SHR,DSN=XYZ.CICS.MICS.CIC.DATA


&DATATYPE(expression) will return a value of NUM or CHAR
depending whether the expression is numeric or not.

    Before: :IF &DATATYPE(&DASDUNIT) EQ CHAR THEN
    Scan 1: :IF &DATATYPE(SYSDA) EQ CHAR THEN
    After:  :IF CHAR EQ CHAR THEN

    Before: :IF &DATATYPE(&JOBLINES) NE NUM THEN GOTO ERROR
    Scan 1: :IF &DATATYPE(50) NE NUM THEN GOTO ERROR
    After:  :IF NUM NE NUM THEN GOTO ERROR


&LENGTH(expression) returns a numeric value equal to the
number of characters in the expression up to the last
non-blank character. The following example illustrates the
use of &LENGTH:

    Before: // PGMLEN='&LENGTH(&PROG)',
    Scan 1: // PGMLEN='&LENGTH(MICS PROGRAMMER)',
    After:  // PGMLEN='15',


The &SUBSTR function is used to return a portion of a string
as a value. It is patterned after the CLIST &SUBSTR function
and not the SAS SUBSTR function. Its syntax is &SUBSTR(start
position:end position,character string) where start position
and end position are relative to the first character in the
string being position 1. If start position and end position
have the same values, a string of length 1 is returned. In
this case, end position need not be specified. Some examples
of the use of &SUBSTR follow:

  Example 1:
    Before: :SET NAME = &SUBSTR(6:15,&PROG)
    Scan 1: :SET NAME = &SUBSTR(6:15,MICS PROGRAMMER)
    After:  :SET NAME = PROGRAMMER
  Example 2:
    Before: &SUBSTR(1,&DATATYPE(&&&RIP.DATA))
    Scan 1: &SUBSTR(1,&DATATYPE(&CICDATA))
    Scan 2: &SUBSTR(1,&DATATYPE(&PREFIX..MICS.CIC.DATA))
    Scan 3: &SUBSTR(1,&DATATYPE(XYZ.CICS.MICS.CIC.DATA))
    Scan 4: &SUBSTR(1,CHAR)
    After:  C


&DLM(expression) inserts a comma before the expression value
IF THE VALUE IS NOT NULL. If the expression resolves to a
null value, the comma is omitted. &DLM is used in
constructing JCL statements with symbols that may have null
values.

  Example 1:
    Before: //WORK   DD  UNIT=&DASDUNIT&DLM(&DASDSMSPARMS),
    After:  //WORK   DD  UNIT=SYSDA,STORCLAS=MICSTEMP,
                                   |
                                   +--inserted by &DLM

This example illustrates the situation where &DASDSMSPARMS
has a null value.

  Example 2:
    Before: //WORK   DD  UNIT=&DASDUNIT&DLM(&DASDSMSPARMS),
    After:  //WORK   DD  UNIT=SYSDA,


A complete list of the variables that are available at the
start of the JCL generation process is found in the
sharedprefix.MICS.SOURCE(JCLPARM). Some of the more commonly
used variables are shown below in Figure 2-31.


+--------------------------+--------------------------------+
|SYMBOL       SYNONYMS     | DESCRIPTION                    |
+--------------------------+--------------------------------+
|&ACCT        &ACCOUNT &A  | value of JCLDEF "ACCT"         |
|&AGDG                     | value of JCLDEF "AUDITGDG"     |
|&ARCHAUD                  | value of JCLDEF "ARCHIVE AUDIT"|
|&ARCHMNH                  | value of JCLDEF "ARCHIVE HISTM"|
|&ARCHWKH                  | value of JCLDEF "ARCHIVE HISTW"|
|&ARET                     | value of JCLDEF "AUDITGDG" * 7 |
|&AUTOSUBMIT               | value of JCLDEF "AUTOSUBMIT"   |
|&BFREQ                    | value of JCLDEF "BACKUP FREQ"  |
|&BGDG                     | value of JCLDEF "BCKUPGDG"     |
|&BRET                     | value of JCLDEF "BCKUPGDG" * 1 |
|&ccc                      | YES if COMPONENT in unit       |
|&CVOLSER                  | value of JCLDEF "CVOLSER"      |
|&CVOLUNIT                 | value of JCLDEF "CVOLUNIT"     |
|&DASDSMSPARMS             | value of JCLDEF "DASDSMSPARMS" |
|&DASDUNIT                 | value of JCLDEF "DASDUNIT"     |
|&DAYSMFFILES              | value of JCLDEF "DAYSMFFILES"  |
|&DATABASE                 | value of JCLDEF "DATABASE"     |
|&DENSITY                  | value of JCLDEF "DENSITY"      |
|&DOCSYSOUT                | value of JCLDEF "DOCUMENT"     |
|&EXPDT                    | value of JCLDEF "EXPDT"        |
|&GROUP       &G           | value of JCLDEF "GROUP"        |
|&INCLUDELEVEL             | internal include nesting level |
|&ISPxLIBn                 | value of JCLDEF "ISPxLIBn"     |
|&JES                      | value of JCLDEF "JES"          |
|&JOBCLASS    &CLASS  &C   | value of JCLDEF "CLASS"        |
|                          | value of JCLINFO "JOBCLASS"    |
|&JOBCOPIES   &COPIES      | value of JCLINFO "JOBCOPIES"   |
|&JOBLINES    &LINES       | value of JCLINFO "JOBLINES"    |
|&JOBNAME                  | internal value created from    |
|                          | value of JCLDEF "JOBNAME" and  |
|                          | value of JCLINFO "UJOBNAME"    |
|&JOBPRTY     &PRTY &PRT   | value of JCLDEF "PRTY"         |
|                          | value of JCLINFO "JOBPRTY"     |
|&JOBTIME     &TIME &T     | value of JCLINFO "JOBTIME"     |
|&JOB7380                  | value of JCLDEF "JOB7380"      |
|&LBL                      | internal file sequence number  |
|&LOGS                     | value of JCLDEF "LOGS"         |
|&MGDG                     | value of JCLDEF "HISTMGDG"     |
|&MICSLVL                  | internal Maintenance level     |
+--------------------------+--------------------------------+
+--------------------------+--------------------------------+
|SYMBOL       SYNONYMS     | DESCRIPTION                    |
+--------------------------+--------------------------------+
|&MRET                     | value of JCLDEF "HISTMGDG" * 31|
|&MSGCLASS    &MSC         | value of JCLDEF "MSGCLASS"     |
|&MSGLEVEL    &MSGLEV &MSL | value of JCLDEF "MSGLEVEL"     |
|&NOTIFY      &N           | value of JCLDEF "NOTIFY"       |
|&PASSWORD    &PA          | value of JCLDEF "PASSWORD"     |
|&PERFORM     &PE          | value of JCLDEF "PERFORM"      |
|&PMICS                    | internal value of MICS. or null|
|&PROCLIB                  | value of JCLDEF "PROCLIB"      |
|&PROG        &PRO         | value of JCLDEF "PROG"         |
|&REGION      &RE          | value of JCLDEF "REGION"       |
|&RENUMBER                 | value of JCLDEF "RENUMBER"     |
|&REPORTS                  | value of JCLDEF "REPORTS"      |
|&RIP                      | internal JCLGEN variable that  |
|                          | contains Component for         |
|                          | REPEATINCLUDE statement        |
|&SASHELP                  | value of JCLDEF "SASHELP"      |
|&SASLIB                   | value of JCLDEF "SASLIB"       |
|&SHAREDPREFIX             | value of JCLDEF "SHAREDPREFIX" |
|&SMICS                    | internal value of MICS. or null|
|&SORTCYL                  | value of JCLDEF "SORTCYL"      |
|&SORTLIB                  | value of JCLDEF "SORTLIB"      |
|&SORTSMSPARMS             | value of JCLDEF "SORTSMSPARMS" |
|&SORTUNIT                 | value of JCLDEF "SORTUNIT"     |
|&SYSDATE                  | internal date, DDMMMYY format  |
|&SYSTIME                  | internal time, HH:MM format    |
|&SYSUID                   | same as &GENLIST               |
|&TAPEPREFIX               | value of JCLDEF "TAPEPREFIX"   |
|&TAPEUNIT                 | value of JCLDEF "TAPEUNIT"     |
|&TMICS                    | internal value of MICS. or null|
|&TSMLINK                  | value of JCLDEF "TSMLINK"      |
|&TSMPARMS                 | value of JCLDEF "TSMPARMS"     |
|&UJOBNAME                 | value of JCLINFO "UJOBNAME"    |
|&USER        &U           | value of JCLDEF "USER"         |
|&WGDG                     | value of JCLDEF "HISTWGDG"     |
|&WRET                     | value of JCLDEF "HISTWGDG" * 7 |
+-----------------------------------------------------------+
| NOTE:  ANY OF THE SYMBOLIC DATA SET NAMES MAY ALSO BE     |
|        USED, BUT THEY ARE NOT INCLUDED IN THIS TABLE.     |
|        SEE SECTION 2.3.3.3.2.3, "CA MICS DATA SET NAMES   |
|        TABLE (JCLNAMES)".                                 |
+-----------------------------------------------------------+

Figure 2-31. Generation Control Language Variables (Partial)