JCL parameters follow specific syntax rules that must be understood to write valid JCL. These rules govern how parameters are formatted, combined, and interpreted by the system.
KEYWORD=value
123//STEP1 EXEC PGM=IEFBR14,REGION=2M,TIME=5 //DD1 DD DSN=MY.DATASET,DISP=SHR,SPACE=(TRK,(10,5)) //DD2 DD DSN='MY.DATASET WITH SPACES',DISP=(NEW,CATLG,DELETE)
Notice how multiple parameters are separated by commas, and the dataset name with spaces is enclosed in single quotes.
JCL uses two types of parameters: positional and keyword parameters. Understanding the difference is crucial for proper JCL coding.
Example:
123//SYSIN DD *,DLM=%% ... data ... %%
Example:
1//MYJOB JOB CLASS=A,MSGCLASS=X,TIME=5
Modern JCL predominantly uses keyword parameters as they are easier to understand and maintain. Positional parameters are still used in specific contexts, particularly with certain DD statement parameters.
JCL parameters can be either required or optional, depending on the context and the statement type.
Required parameters must be specified for the statement to be valid. The job will fail with JCL errors if required parameters are missing.
Statement | Required Parameters (Examples) |
---|---|
JOB | Accounting information (in some environments) |
EXEC | Either PGM or PROC must be specified |
DD | One of: DSN, *, DUMMY, SYSOUT (or similar) |
Optional parameters can be omitted, and the system will apply default values or behaviors.
Statement | Optional Parameters (Examples) | Default Value |
---|---|---|
JOB | CLASS | Installation defined (e.g., A) |
JOB | MSGCLASS | Installation defined (e.g., A) |
EXEC | REGION | Installation defined |
EXEC | TIME | No limit |
DD | SPACE | Required only for new datasets |
It's good practice to explicitly specify important parameters even if they are optional, as installation defaults may change over time.
When JCL parameters are too long to fit on a single line, they can be continued using specific techniques.
To continue parameters on the next line:
12//STEP1 EXEC PGM=MYPROG,REGION=4M, X // TIME=10,PARM='OPTION1,OPTION2'
For complex parameters with subparameters, proper nesting is important:
12345//DD1 DD DSN=MY.DATASET, X // DISP=(NEW,CATLG,DELETE), X // DCB=(RECFM=FB, X // LRECL=80, X // BLKSIZE=27920)
Note how the DCB parameter has nested subparameters that continue across multiple lines.
When continuing a parameter containing quoted strings:
123//STEP1 EXEC PGM=MYPROG, X // PARM='THIS IS A VERY LONG PARAMETER THAT NEEDS X // TO BE CONTINUED ON MULTIPLE LINES'
The quoted string continues across lines without needing to close and reopen quotes.
Many JCL parameters have default values that are applied when the parameter is omitted. Understanding these defaults is important for proper JCL coding.
Parameter | Default Value | Description |
---|---|---|
CLASS | Installation defined (typically A) | Job class that determines execution characteristics |
MSGCLASS | Installation defined (typically A) | Output class for job log and messages |
MSGLEVEL | (1,1) | Controls the amount of JCL and allocation messages |
TIME | Installation defined or 1440 (24 hours) | Maximum CPU time for the job |
REGION | Installation defined | Maximum memory allocation for the job |
Parameter | Default Value | Description |
---|---|---|
DISP | (NEW,DELETE,DELETE) | Dataset disposition |
UNIT | Installation defined | Device type or group |
DCB | No default, but inherits from dataset | Data Control Block attributes |
SPACE | No default (required for new datasets) | Space allocation for disk datasets |
Default values can vary between installations. It's important to consult your site's JCL standards documentation for specific default values in your environment.
JCL supports symbolic parameters, which are variables that can be substituted with actual values during job execution.
System-provided symbolic parameters begin with & and are resolved by the system:
&SYSUID
- Current user ID&SYSDATE
- Current date (format: yyyyddd)&SYSTIME
- Current time (format: hhmmss)&SYSJOBID
- Job identifier&SYSNAME
- System name123//MYJOB JOB (ACCT),'&SYSUID',NOTIFY=&SYSUID //DD1 DD DSN=&SYSUID..TEMP.DATA,DISP=(NEW,CATLG,DELETE) //SYSOUT DD SYSOUT=*,DEST=LOCAL.&SYSUID
Note the use of .. (double period) after &SYSUID in the dataset name - the first period is part of the parameter, the second is for the dataset name.
Users can define their own symbolic parameters using the SET statement or PROC parameter definitions:
1234567//MYJOB JOB (ACCT),'USER',NOTIFY=&SYSUID //* DEFINE SYMBOLIC PARAMETERS // SET DAY=MON // SET DATASET=PROD //* //STEP1 EXEC PGM=MYPROG //INPUT DD DSN=&DATASET..&DAY..DATA,DISP=SHR
Symbolic parameters are especially useful in procedures for customization:
12345678//MYPROC PROC DAY=MON,TYPE=PROD //STEP1 EXEC PGM=PROCESS //INPUT DD DSN=&TYPE..&DAY..DATA,DISP=SHR //OUTPUT DD DSN=&TYPE..&DAY..REPORT,DISP=(NEW,CATLG,DELETE) // PEND //* //* EXECUTE THE PROCEDURE WITH CUSTOM PARAMETERS //RUN EXEC MYPROC,DAY=TUE,TYPE=TEST
The procedure defines default values (MON and PROD), but they are overridden with TUE and TEST when the procedure is executed.
Here's a comprehensive example showcasing different parameter types and techniques:
12345678910111213141516171819202122232425262728293031323334//EXAMPLE JOB (ACCT,'DEPT123'),'&SYSUID',CLASS=A, // MSGCLASS=X,NOTIFY=&SYSUID, // MSGLEVEL=(1,1),REGION=0M,TIME=NOLIMIT //* //* DEFINE SYMBOLIC PARAMETERS // SET TODAY=&SYSDATE // SET ENV=TEST //* //STEP01 EXEC PGM=IEBGENER, // REGION=4M, // TIME=5, // PARM='NOSEQ,SIZE=1024K' //* //SYSUT1 DD DSN=&ENV..SOURCE.DATA, // DISP=SHR //* //SYSUT2 DD DSN=&ENV..TARGET.DATA.&TODAY, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5),RLSE), // DCB=(RECFM=FB, // LRECL=80, // BLKSIZE=27920, // DSORG=PS) //* //SYSIN DD DUMMY //* //SYSPRINT DD SYSOUT=* //* //STEP02 EXEC PGM=IDCAMS, // COND=(0,LT,STEP01) //SYSPRINT DD SYSOUT=* //SYSIN DD * LISTCAT ENTRIES('&ENV..TARGET.DATA.&TODAY') ALL /*
This example demonstrates positional and keyword parameters, required and optional parameters, parameter continuation, system and user-defined symbolic parameters, and nested parameters.