MainframeMaster

JCL Tutorial

JCL Parameters

Progress0 of 0 lessons

Parameter Syntax Rules

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.

Basic Parameter Syntax

  • Parameters appear after the operation field (JOB, EXEC, DD)
  • Multiple parameters are separated by commas
  • No spaces are allowed between parameters and commas
  • Parameters can be coded in any order unless otherwise specified
  • Parameter syntax is generally: KEYWORD=value
  • If a value contains special characters or spaces, it must be enclosed in single quotes

Parameter Format Example

jcl
1
2
3
//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.

Positional vs. Keyword Parameters

JCL uses two types of parameters: positional and keyword parameters. Understanding the difference is crucial for proper JCL coding.

Positional Parameters

  • Must appear in a specific order
  • No keyword is specified
  • Position determines meaning
  • Separated by commas
  • Omitted positional parameters must have commas as placeholders

Example:

jcl
1
2
3
//SYSIN DD *,DLM=%% ... data ... %%

Keyword Parameters

  • Can appear in any order
  • Consist of a keyword followed by an equals sign and a value
  • More descriptive and self-documenting
  • Most common type of JCL parameter
  • Omitted keyword parameters are simply not included

Example:

jcl
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.

Required vs. Optional Parameters

JCL parameters can be either required or optional, depending on the context and the statement type.

Required Parameters

Required parameters must be specified for the statement to be valid. The job will fail with JCL errors if required parameters are missing.

StatementRequired Parameters (Examples)
JOBAccounting information (in some environments)
EXECEither PGM or PROC must be specified
DDOne of: DSN, *, DUMMY, SYSOUT (or similar)

Optional Parameters

Optional parameters can be omitted, and the system will apply default values or behaviors.

StatementOptional Parameters (Examples)Default Value
JOBCLASSInstallation defined (e.g., A)
JOBMSGCLASSInstallation defined (e.g., A)
EXECREGIONInstallation defined
EXECTIMENo limit
DDSPACERequired 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.

Parameter Continuation Techniques

When JCL parameters are too long to fit on a single line, they can be continued using specific techniques.

Standard Parameter Continuation

To continue parameters on the next line:

  • End the current line with a comma
  • Indicate continuation with a non-blank character in column 72 (traditionally 'X')
  • Start the continuation line with // in columns 1-2
  • Leave at least one blank in column 3
  • Start the continued parameters at any position from column 4-16
jcl
1
2
//STEP1 EXEC PGM=MYPROG,REGION=4M, X // TIME=10,PARM='OPTION1,OPTION2'

Nested Parameter Continuation

For complex parameters with subparameters, proper nesting is important:

jcl
1
2
3
4
5
//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.

Quoted String Continuation

When continuing a parameter containing quoted strings:

jcl
1
2
3
//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.

Common Parameter Defaults

Many JCL parameters have default values that are applied when the parameter is omitted. Understanding these defaults is important for proper JCL coding.

JOB Statement Parameter Defaults

ParameterDefault ValueDescription
CLASSInstallation defined (typically A)Job class that determines execution characteristics
MSGCLASSInstallation defined (typically A)Output class for job log and messages
MSGLEVEL(1,1)Controls the amount of JCL and allocation messages
TIMEInstallation defined or 1440 (24 hours)Maximum CPU time for the job
REGIONInstallation definedMaximum memory allocation for the job

DD Statement Parameter Defaults

ParameterDefault ValueDescription
DISP(NEW,DELETE,DELETE)Dataset disposition
UNITInstallation definedDevice type or group
DCBNo default, but inherits from datasetData Control Block attributes
SPACENo 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.

Parameter Value Formats (Symbolic Parameters)

JCL supports symbolic parameters, which are variables that can be substituted with actual values during job execution.

System Symbolic Parameters

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 name
jcl
1
2
3
//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.

User-Defined Symbolic Parameters

Users can define their own symbolic parameters using the SET statement or PROC parameter definitions:

jcl
1
2
3
4
5
6
7
//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 in Procedures

Symbolic parameters are especially useful in procedures for customization:

jcl
1
2
3
4
5
6
7
8
//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.

Complete JCL Parameters Example

Here's a comprehensive example showcasing different parameter types and techniques:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//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.