Skip to main content

Introduction - REFERBACK

In JCL, you often need to repeat dataset names, DCB parameters, or SYSOUT settings across multiple steps. This repetition can lead to errors and cluttered code. REFERBACK solves this by letting one step refer back to the definitions in previous steps, making JCL easier to read, update, and maintain. It’s done using the * symbol and is especially useful when jobs are long or reused frequently.

IBM Docs - REFERBACK


Why REFERBACK?

REFERBACK (also called backward reference) pulls values from previously defined DD statements or from the JOB card.

  • Keeps JCL clean and consistent.
  • Minimizes typing and potential mistakes.

Basic Syntax

SyntaxMeaning
*.DDNAMERefer to a DD in the same step
*.STEPNAME.DDNAMERefer to a DD in a previous step
*.procname.stepname.ddnameRefer to a DD inside a PROC
example
//* Example of simple REFERBACK across multiple steps. 
//STEP01 EXEC PGM=IEFBR14
//MYDD DD DSN=MY.DATA.FILE,DISP=SHR
//STEP02 EXEC PGM=IEFBR14
//OUTDD DD DSN=*.STEP01.MYDD
//* Example of Partial DCB Override
//MYDD2 DD DCB=(*.STEP01.MYDD1,LRECL=80)
//* Example of Program Referback
//GO EXEC PGM=*.LINK.SYSLMOD

Common Uses

ParameterUse CaseExample
DSNReuse dataset nameDSN=*.STEP01.OUTDD
SYSOUTUse JOB-level SYSOUT classSYSOUT=*
DCBInherit format and record attributesDCB=*.STEP01.INFILE
VOLUMEUse same volume as another datasetVOLUME=REF=*.STEP1.FILEIN

What You Can’t Refer Back

  • DISP – Dispositions are step-specific
  • SPACE – Allocation differs per step
  • UNIT – Devices are not inherited
  • Forward references – You can’t refer to DDs not yet defined
  • Cross-job references – REFERBACK works only within the same job

Here is your simplified and handout-ready version of the Symbols in JCL topic, suitable for training use. I’ve cut down some details, removed the demo links, and added a concise intro as requested:


Introduction - Symbols

JCL symbols make your code more flexible, reusable, and easier to maintain, especially when working with changing parameters, system values, or procedures. Instead of hardcoding values in every step, you can use symbols as placeholders. JCL supports both system-defined and user-defined symbols, and since z/OS 2.1, symbols can even be passed into programs through in-stream data.

IBM Docs - Symbols

Here are some listed type of SYMBOLS.

System Symbols

These are automatically available and reflect current system info like user ID, date, or job attributes.

  • &SYSDATE – Current system date
  • &DAY – Current day of the month
  • &SYSUID – Submitting user's ID
tip

Use SDSF's SYM panel to view live system symbols.


JCL Symbols (User-Defined)

Created using the SET statement. Useful for jobs where values change per run.

// SET FILENUM=001
// SET USERID=JOHN
note

Don't override system symbols.


Symbol Usage Rules

  • Symbols work only for values, not for JOB, EXEC, or DD names.
  • You can’t override system symbols like REGION. Use alternatives:

❌ Incorrect:

// SET REGION=200K
REGION=&REGION

✅ Correct:

// SET SIZE=200K
REGION=&SIZE

Using Periods with Symbols

Use a period (.) to separate a symbol from surrounding text. If nothing follows the symbol, a period isn’t needed.

// SET XNAME=AAAA
DSN=&SYSUID..LOAD → SHRDV06.LOAD
DSN=&SYSUID..&XNAME → SHRDV06.AAAA
DSN=&SYSUID..&XNAMEAA → ❌ Looks for &XNAMEAA, not valid

Exporting Symbols to Execution (z/OS 2.1+)

Before z/OS 2.1, symbols were only used during JCL conversion. Now, they can also be used during execution, like inside in-stream data.

To do this, use two steps:

Step 1: Export the Symbols

Use the EXPORT statement to define which symbols should be available at execution.

Here are a few options for how the parameters can be exported:

  • EXPORT SYMLIST=* – Export all defined symbols
  • EXPORT SYMLIST=(symbol1,symbol2) – Export only specific symbols
// EXPORT SYMLIST=(PARM1,PARM2)
// SET PARM1='ABC'
// SET PARM2='XYZ'

Step 2: Import into in-stream data

Once set and exported, to make them available to in-stream data, we need to specify which parameters to pass. Options include:

  • SYMBOLS=JCLONLY – Use JCL symbols only
  • SYMBOLS=EXECSYS – Use both JCL and system symbols
//SYSIN DD *,SYMBOLS=JCLONLY
INPUT1=&PARM1
INPUT2=&PARM2
/*

Summary

  • Use system symbols to refer to runtime values like date or user ID.
  • Use JCL symbols to manage job parameters cleanly with SET.
  • Use EXPORT/SYMLIST to pass symbols into SYSIN or other execution data.
  • Be careful with naming and syntax rules—especially when symbols are mixed with text.