Introduction
In JCL, the DD (Data Definition) statement is used to describe the datasets a program will use—whether for input, output, or temporary processing. While the basic structure is straightforward, some of the DD statement's features behave in ways that are not obvious to beginners. Parameters like DUMMY, SYSOUT, dataset concatenation, and space allocation rules often lead to confusion.
Refer to IBM Docs - DD Statement for valid DD Statements
Refer to IBM Docs - Reusable JCL to get JCLs for common usages.
Exercise - Create JCL with valid DD Statements
- A PS with a Fixed block type and Record size 98.
- A PDS with Fixed type with Block size 120.
- A valid DSORG=PO type dataset.
- A Dataset with Secondary quantity of 20 CYLS
- A Dataset on ZAPRD4 volume.
- A Input DD with making sure no Allocation is made.
- DD Statement that Output to a printer located at CLASS=A.
- DD Statement that ignore Output from the program.
- A DD Statement that takes data from input stream.
Exercise - Fix Invalid DD Statements
//DD01 DD DSN=MY.DATASET
//DD02 DD DUMMY,DSN=TEST.DUMMY
//DD03 DD DSN=,DISP=SHR
//DD04 DD DISP=SHR
//DD05 DD DSN=MY.DATA,DISP=SHR,DCB=(LRECL=0)
//DD06 DD DSN=TEMP.DATA,DISP=(NEW,CATLG),UNIT=SYSDA
// SPACE=(TRK,10,5),DCB=RECFM=FB,LRECL=80
//DD07 DD DSN=MY.FILE,DISP=NEW,SPACE=(TRK,10)
// DCB=(RECFM=FB,BLKSIZE=400,LRECL=800)
//DD08 DD DSN=MY.DATA,DISP=(NEW,CATLG),
// UNIT=SYSDA,DCB=(RECFM=U,LRECL=80)
//DD09 DD DSN=MY.PDS,DISP=SHR,
// SPACE=(TRK,5,5),DCB=(RECFM=FB,LRECL=80,DSORG=PO)
//DD10 DD DSN=MY.DATASET,DISP=(NEW,CATLG),VOL=SER=,UNIT=SYSDA
Exercise - DD Concatenation of Same types
Try below concatenation and verify if the execution is successful or failure or result in some data issues.
- Concatenate two PS datasets with the same DCB attributes and verify successful execution.
- Concatenate two PS datasets (RECFM=FB) with different LRECL and observe which LRECL is used.
- Concatenate two PS datasets with different RECFM values (RECFM=F and RECFM=V).
- Concatenate datasets with different BLKSIZE values. Monitor for warnings or overrides.
- Concatenate an empty dataset followed by a non-empty dataset. Observe if any data is processed.
Exercise - DD Concatenation of Different types
- Concatenate a PDS and PS in a single DD statement. Try to access a PDS member and observe behavior.
- Concatenate datasets with incompatible DSORG values (e.g., DSORG=PO followed by DSORG=PS) and observe failure or success.
- Concatenate two PDS datasets(LOADLIB) with overlapping member names. Test which member is picked.
- Create a DD concatenation with a cataloged dataset followed by a temporary dataset.
- Use DUMMY as one of the concatenated datasets and observe how it behaves in read operations.
- Concatenate datasets where the first is DISP=OLD and the second is DISP=SHR. Observe access results.