Skip to main content

REFERBACK

REFERBACK allows you to reference datasets, DCB attributes, SYSOUT classes, and even load modules from previously defined DD statements or steps. By using syntax like DSN=.STEP1.DDNAME or DCB=(.DD1,LRECL=133), you can inherit properties without restating them.

This technique is especially helpful in multistep jobs, cataloged procedures, and when maintaining consistency across utilities like IEBGENER or sort programs.

Solve the following REFERBACK scenarios:

  • Create a dataset in one step and use it in a later step using REFERBACK.
  • Refer to a DD statement in the same step using backward reference.
  • Inherit DCB attributes from a dataset defined in a previous step and override LRECL only.
  • Use a load module stored in an earlier step as the program name in a later step.
  • Inherit the SYSOUT class from the JOB card in a output dataset.
  • Refer to a dataset created inside a PROC from the calling JCL.
  • Use the same input dataset across multiple steps without repeating DSN.
  • Reference the volume of a previously allocated dataset.
  • Inherit RECFM and BLKSIZE from another DD using REFERBACK.
  • Trigger an error by attempting a forward reference in REFERBACK and watch for error.
  • Chain multiple REFERBACKs where one step refers to another which itself uses REFERBACK. Is it possible/allowed?
  • Use a dataset created in a conditional step as input in another step using REFERBACK. What happens if COND result to skip the step?
  • Refer to a dataset created inside an instream PROC in a later EXEC outside the PROC.
  1. Reuse a load library from a previous step using REFERBACK in STEPLIB. Is it possible. Are there any alternative ways we can achieve the same?
  • Refer back to a cataloged dataset inside a cataloged procedure using REFERBACK.
  • Fix the JCL
//J1  JOB  MSGCLASS=X
//S1 EXEC PGM=IEFBR14
//A DD DSN=USERID.DATA.A,DISP=(NEW,CATLG),
// SPACE=(TRK,1),UNIT=SYSDA
//S2 EXEC PGM=IEFBR14
//B DD DSN=*.S3.A
//C DD DSN=*.A

Symbolic Parameters

By defining a symbol like MYTDSN, we can reuse it across multiple DD statements, making the code easier to modify and maintain. Symbolic substitution is especially helpful when datasets follow consistent naming patterns that change across environments or users. It also improves readability and minimizes errors caused by hardcoding long DSN strings.

This technique is essential for building flexible, reusable JCL in both development and production workflows.

Solve the following Symbolic parameter scenarios:

  • Create a dataset that includes the submitting user ID in its name using a symbol.

  • Define two symbols and use them inside a DSN in a DD statement.

  • Pass two user-defined symbols into in-stream data using proper export handling.

  • Write a PROC that uses symbolic parameters resolved from the calling JCL.

  • Use system symbols to build a dataset name that includes the current date.

  • Create a job where symbols are used to build both HLQ and file qualifier in a dataset.

  • Dynamically select SYSOUT class using a symbol.

  • Use both system and user-defined symbols in the same dataset name.

  • Refactor a job with hardcoded values to use symbols for file names and parameters.

  • Build a symbol-driven job that sets input file, output file, and control parameter dynamically.

  • Fix the JCL
    • Create a Symbolic Parameter MYTDSN with Value EXERDATA
    • Add that Symbolic Parameter and Fix the below JCL as applicable
//<YOUR ID>J  JOB ,NOTIFY=&SYSUID
//OUTPUT1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=&SYSUID..&MYTDSN.OUTPUT1,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//DD2 DD DSN=&SYSUID&MYTDSN..OUTPUT2,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//DD3 DD DSN=&SYSUID..&MYTDSN(OUTPUT3),
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//DD4 DD DSN=&SYSUID..&MYTDSN.,
// DISP=(MOD,CATLG),SPACE=(CYL,(2,2)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)