JCL Troubleshooting
System reports dataset in use
Troubleshooting guide for System reports dataset in use. Dataset problems show up as allocation failures (IEC/IGD messages) or wrong-data bugs when DISP and catalog entries do not say what the programmer assumed.
What it means
- DISP controls three things at once: current status (SHR/OLD/MOD/NEW), normal termination (KEEP/CATLG/DELETE), and abnormal termination.
- The catalog is the truth for dataset location; a wrong catalog entry sends the job to the wrong volume or a stale generation.
- GDG bases resolve (+1)/(0)/(-1) at allocation time — the numbers shift as generations roll, which surprises hard-coded logic.
Common causes
- DD references a dataset that was never cataloged or was deleted: IEC141I 013-20 (not found).
- DISP=(NEW,CATLG) on an existing dataset name: IEC141I 013-48 — dataset already exists.
- Temporary dataset (&&TEMP) referenced in a later step but the creating step was skipped by COND — the DD then points at nothing.
- GDG (0) requested but the base has no generations, or (+1) used when the job only reads: IEC141I 013-34.
- GDG LIMIT reached: oldest generation rolls off while a job still needs it — classic month-end failure.
- Dataset in use: another job holds DISP=OLD enqueue; the job waits (or fails) with IEC141I 013-68.
- DISP=MOD on an existing sequential dataset appends instead of replacing — output has old + new records.
- DISP=OLD on a dataset every step needs serializes the whole job stream behind one enqueue.
- Cataloged dataset cannot be located: wrong catalog alias, or the entry points to a migrated/archived volume.
- UNIT/VOL=SER wrong: requesting a specific volume the dataset is not on, or a unit type the installation removed.
- DUMMY DD: program reads end-of-file immediately or writes go nowhere — behavior change is by design but often forgotten.
- SYSIN not read: DD * data placed after a step that never executes it, or DLM= delimiter missing so the reader consumes JCL.
- DCB mismatch: program expects RECFM=FB LRECL=80 but the dataset is RECFM=VB — records arrive shifted or the OPEN fails.
- Stale load module: STEPLIB concatenation lists an old library first, so the job runs last month code.
- Wrong module from concatenation: JOBLIB vs STEPLIB order, or a system library shadowing the intended loadlib.
How to diagnose
- Read the IEC141I / IEC130I message: the return code after the dash names the cause (013-20 not found, 013-48 exists, 013-68 in use).
- LISTCAT the dataset and the GDG base: check volumes, generations present, and LIMIT.
- For enqueue waits: SDSF DA or D GRS,C in the console shows who holds the dataset.
- For GDG: LISTCAT ENT(base) ALL shows LIMIT and current generations; compare (+1)/(0) usage against what the job needs.
- For DCB: ISPF 3.4 shows RECFM/LRECL/BLKSIZE of the real dataset — compare with the program FD and JCL DCB.
- For wrong module: check the STEPLIB/JOBLIB concatenation order and the module link date.
How to fix it
- Use DISP=SHR for read-only inputs so jobs do not serialize on enqueue; reserve DISP=OLD for true updates.
- For replace semantics use DISP=(NEW,CATLG,DELETE) after deleting the old dataset, or DISP=OLD with a program that rewrites fully.
- Fix GDG references: readers use (0), writers use (+1); raise LIMIT before month-end if generations roll off.
- Correct the catalog entry (DEFINE ALIAS or RECATALOG) instead of hard-coding VOL=SER workarounds.
- Put the newest load library first in STEPLIB and remove dead libraries from the concatenation.
- Match DCB on all three sides: dataset definition, JCL DD, and program FD.
Example: JCL dataset patterns that avoid the classic traps
//IN DD DSN=APP.MONTHLY.INPUT(0),DISP=SHR
//OUT DD DSN=APP.MONTHLY.OUTPUT(+1),
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(50,20),RLSE),
// DCB=(RECFM=FB,LRECL=200,BLKSIZE=0)
//WORK DD DSN=&&WORK,DISP=(NEW,PASS),
// SPACE=(TRK,(20,10)),
// DCB=(RECFM=FB,LRECL=200)
Readers take (0) with DISP=SHR; writers take (+1); BLKSIZE=0 lets the system pick the optimal block size.
Interview tip
- Q: A job fails with IEC141I 013-20 on a DD. System reports dataset in use — what does that tell you and what is the fix?
- A: 013-20 means dataset not found — the DSN is misspelled, never cataloged, or a GDG generation rolled off. I LISTCAT the name, check the GDG base if it is a generation, and fix the DSN or recreate the dataset rather than pointing at a different one.
Prevention checklist
- Standardize DISP usage: SHR for inputs, NEW/CATLG for outputs, never MOD for replace.
- Monitor GDG LIMIT vs retention before peak cycles.
- Keep load library concatenations short and ordered, newest first.
- Validate DCB (RECFM/LRECL) whenever a dataset is redefined.
