Examples of the DDNAME parameter
Example 1: The following procedure step is the only
step in a cataloged procedure named CROWE:
//PROCSTEP EXEC PGM=RECPGM
//DD1 DD DDNAME=WKREC
//POD DD DSNAME=OLDREC,DISP=OLD
DD statement DD1 is intended for weekly records in the input stream;
these records are processed by this step. Because the * and DATA
parameters cannot be used in cataloged procedures, the DDNAME parameter
is coded to postpone defining the data set until the procedure is
called by a job step. The step that calls the procedure is:
//STEPA EXEC PROC=CROWE
//WKREC DD *
.
.
data
.
/*
Example 2: When the procedure contains multiple steps,
use the form stepname.ddname for the ddname of the referenced DD statement.
For example, the following procedure steps appear in a cataloged procedure
named PRICE:
//STEP1 EXEC PGM=SUGAR
//DD1 DD DDNAME=QUOTES
.
.
.
//STEP2 EXEC PGM=MOLASS
//DD2 DD DSNAME=WEEKB,DISP=OLD
.
.
.
The step that calls the procedure is:
//STEPA EXEC PROC=PRICE
//STEP1.QUOTES DD *
.
.
data
.
/*
Example 3: When the referenced DD statement is to
be a concatenation, the procedure must already contain the concatenation.
(Such as when the referencing DD statement is to contain in-stream
data.) For example, the following procedure step appears in cataloged
procedure NEWONE.
//NEWONE PROC
//STEP1 EXEC PGM=TRYIT
//DD1 DD DDNAME=INSTUFF
// DD DSN=OLDSTUFF,DISP=OLD
.
.
The step that calls the procedure is:
//STEPA EXEC PROC=NEWONE
//STEP1.INSTUFF DD *
.
data
.
/*
The instream data (DDNAME=INSTUFF) is inserted before OLDSTUFF in the concatenation.
Example 4: In the following example we create
a DD concatenation in a procedure using multiple DDNAME forward references,
INPUT1—INPUT5. In the example, INPUT1 resolves to data set FIRST,
INPUT2 resolves to data set SECOND, and INPUT3 resolves to data set
THIRD. INPUT4 and INPUT5 resolve to DUMMY.
//ABC PROC
//SI EXEC PGM=IEFBR14
//DD1 DD DDNAME=INPUT1
// DD DDNAME=INPUT2
// DD DDNAME=INPUT3
// DD DDNAME=INPUT4
// DD DDNAME=INPUT5
//STEP1 EXEC ABC
//INPUT1 DD DSN=FIRST,DISP=SHR
//INPUT2 DD DSN=SECOND,DISP=SHR
//INPUT3 DD DSN=THIRD,DISP=SHR