Symbolic parameters in JCL allow for variable substitution, making JCL more flexible and reusable. They enable you to create general-purpose JCL that can be customized at execution time with different values. This is particularly useful for procedures (PROCs) where the same process needs to be executed with different datasets, program names, or other parameters.
Note:
Symbolic parameters enhance reusability and reduce maintenance by allowing the same JCL to be used in multiple scenarios with different values.
1//procstep PROC PARAM1=default1,PARAM2=default2,...
1//step DD DSN=prefix.&PARAM1..SUFFIX
1//step EXEC procname,PARAM1=value1,PARAM2=value2
When concatenating symbolic parameters with other text:
12345//PAYPROC PROC SYSID='PROD',DAY=TODAY //STEP1 EXEC PGM=PAYROLL //INPUT DD DSN=&SYSID..PAYROLL.&DAY,DISP=SHR //OUTPUT DD DSN=&SYSID..PAYROLL.OUTPUT,DISP=(NEW,CATLG) // PEND
This procedure defines two symbolic parameters (SYSID and DAY) with default values that are used in dataset names.
12//PAYRUN JOB (ACCT#),'JOHN DOE',CLASS=A //STEP1 EXEC PAYPROC,SYSID=TEST,DAY=MONDAY
This job executes the PAYPROC procedure, overriding the SYSID parameter with 'TEST' and the DAY parameter with 'MONDAY'.
1234567//PAYJOB JOB (ACCT#),'JOHN DOE',CLASS=A //PAYPROC PROC ENV='PROD',DATE=CURRENT //STEP1 EXEC PGM=PAYROLL //INPUT DD DSN=&ENV..PAYROLL.&DATE,DISP=SHR // PEND //* //RUN EXEC PAYPROC,ENV=TEST,DATE=20230401
This example defines an in-stream procedure with symbolic parameters and then executes it with overridden values.
12345678910111213//DBPROC PROC DBG=N, // REGION=4M, // DBNAME='TESTDB', // OPTS=('OPTIMIZE','NOAUDIT','LOG') //DBSTEP EXEC PGM=DBPROG, // REGION=®ION, // PARM=('&DBNAME',&OPTS) //INPUT DD DSN=&DBNAME..DATA,DISP=SHR //DEBUG DD DUMMY // IF &DBG=Y THEN //DEBUG DD SYSOUT=* // ENDIF // PEND
This example uses symbolic parameters for region size, program options, and conditional processing.
Type | Description | Example |
---|---|---|
Procedure Parameters | Defined in PROC statement for use within the procedure | //PROC1 PROC A=1,B=2 |
System Symbols | Predefined by the system, available to all jobs | &SYSUID, &SYSDATE |
SET Statement Variables | User-defined variables created with SET statements | //SET RUNDATE=20230401 |
EXEC Overrides | Values provided when executing a procedure | //STEP EXEC PROC,A=3 |
z/OS provides several system symbols that can be used like symbolic parameters:
Symbol | Description | Example Value |
---|---|---|
&SYSUID | User ID of job submitter | USER01 |
&SYSDATE | Current date (format: yyyyddd) | 2023091 (for April 1, 2023) |
&SYSTIME | Current time (format: HH.MM.SS) | 14.30.00 |
&SYSNAME | System name | SYS1 |
&SYSPLEX | Sysplex name | PLEXC |
&SYSSMFID | SMF system identifier | S01 |
&SYSSYMR | Sysplex routing code | 01 |
123//REPJOB JOB (ACCT#),'&SYSUID',CLASS=A //STEP1 EXEC PGM=REPORTER //OUTDD DD DSN=&SYSUID..REPORT.D&SYSDATE,DISP=(NEW,CATLG)
This example uses system symbols to include the submitter's user ID and current date in the job and dataset names.
12345//PROC1 PROC TYPE=TEST, // TEST='TEST.DATA', // PROD='PROD.DATA' //STEP1 EXEC PGM=PROCESS //INPUT DD DSN=&&TYPE..DATA,DISP=SHR
This example uses a symbolic parameter to determine which of two other symbolic parameters to use.
12345678//SETJOB JOB (ACCT#),'JOHN DOE',CLASS=A // SET DAY=MONDAY // SET ENV=TEST // IF &DAY=MONDAY THEN // SET ENV=PROD // ENDIF //STEP1 EXEC PGM=PROCESS //INDD DD DSN=&ENV..DATA,DISP=SHR
This example uses SET statements and conditional logic to dynamically set parameter values.
123456//DATEJOB JOB (ACCT#),'JOHN DOE',CLASS=A // SET FULLDATE=20230401 /* YYYYMMDD */ //STEP1 EXEC PGM=PROCESS //YEARDD DD DSN=REPORT.&FULLDATE(1:4),DISP=SHR //MONTHDD DD DSN=REPORT.&FULLDATE(5:2),DISP=SHR //DAYDD DD DSN=REPORT.&FULLDATE(7:2),DISP=SHR
This example uses substring notation to extract parts of a date value.
Issue | Possible Causes & Solutions |
---|---|
Parameter not substituted |
|
Incorrect substitution |
|
JCL errors when overriding parameters |
|
//JCLDUMP DD SYSOUT=*
to see the JCL after symbolic parameter substitution%SET MSGLEVEL=(1,1)
to see detailed JCL listing including substitutionSYMLIST
to the JOB statement to display resolved symbols in the job logSymbolic parameter processing is mostly consistent between JES2 and JES3 environments: