JCL SPACE Allocation Failures: Diagnose Primary and Secondary Extents Before Changing a Batch Job
A batch job can fail before its program gets control because an output dataset cannot be allocated or extended. This guide shows how to distinguish an initial-allocation problem from an extension problem, collect evidence that matters, and make a controlled correction without treating `SPACE` as a number to keep increasing.
A batch job can fail before its program gets control because an output dataset cannot be allocated or extended. This guide shows how to distinguish an initial-allocation problem from an extension problem, collect evidence that matters, and make a controlled correction without treating SPACE as a number to keep increasing.
The dataset names, quantities, and job names below are fictional. Allocation rules depend on device type, SMS classes, volume policy, data class, and local storage-management standards. Do not delete a partial output, alter a production JCL member, or rerun an updating job until the job's restart and output-reuse rules are known.
Symptom: the step did not reach the application
An allocation failure is often reported as a step abend or a message in the job log. The important first question is when it happened.
If the program's normal startup message, report heading, or first checkpoint is absent, the failure may be in allocation or catalog processing before business logic started. If the program produced records and then failed later, the dataset may have exhausted its primary allocation and failed while requesting a secondary extent.
Those are different problems:
| Observation | Likely question to answer | Unsafe shortcut |
| --- | --- | --- |
| Failure occurs before program startup | Could the system obtain the initial primary space under this dataset's placement rules? | Double the primary quantity without checking placement or SMS policy. |
| Program processed some input before failure | Did the output grow beyond primary space, and was a secondary extent available? | Rerun from the beginning over an existing partial output. |
| Same JCL fails only on one execution date | Did input volume, generation selection, or target volume change? | Assume the JCL syntax suddenly became invalid. |
| A nearby job succeeds with the same quantity | Are data class, storage class, unit, or target-volume conditions different? | Copy only the other job's SPACE clause. |
SPACE describes a request; it is not a guarantee that suitable free space is available. Under SMS, site policy may also influence placement and attributes. A technically valid clause can still fail because the requested extent shape is unavailable where the dataset is eligible to reside.
Evidence to capture before editing JCL
Capture the spool for the failing attempt, not just the final condition code. The evidence should let a storage or scheduler colleague reproduce the decision path without receiving business data.
Record these items:
- Job, step, DD name, start time, and the message identifiers associated with allocation or extension.
- Whether the DD is
NEW,OLD,MOD, or a generation reference, plus its disposition on normal and abnormal termination. - The complete effective DD statement after procedure-symbolic substitution. A cataloged PROC can hide the actual
SPACE,UNIT,STORCLAS, orDATACLASvalues. - Dataset organization, record format, logical record length, block-size approach, and whether the output is sequential, partitioned, or VSAM. The remedy differs by type.
- Input record count or expected output volume from a successful comparable run. Use counts and sizes; do not include business records in a support ticket.
- Whether the program began, how many records it wrote if known, and whether it creates database updates or downstream files.
- The target dataset's catalog status and whether a partial dataset already exists.
Do not infer allocated capacity from the primary value alone. Track allocation units as stated in the JCL: tracks, cylinders, records, blocks, or an approved site convention. Converting without the device and data-class context can produce a misleading estimate.
A compact example: primary versus extension space
This fictional report step creates a new sequential file:
//RPTOUT DD DSN=ACCT.TEST.DAILY.REPORT,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(20,5),RLSE),
// DCB=(RECFM=FB,LRECL=133,BLKSIZE=0)
The request has three separate ideas:
CYLis the allocation unit.20is the primary quantity requested when the dataset is created.5is the secondary quantity requested each time more space is needed.RLSEasks for unused allocated space to be released at close; it does not create extra capacity during the run.
Suppose the report normally consumes 12 cylinders but a month-end run needs 47. The system first allocates 20 cylinders. As the file grows, it may request additional 5-cylinder extents. That can succeed, fail because an extent of that size is not available under the placement rules, or reach an installation-specific extent or allocation limit. The useful diagnosis is not “47 is larger than 20”; it is whether the job had the correct expected volume and whether the system could satisfy each allocation request.
A change to SPACE=(CYL,(50,10),RLSE) might be appropriate only after the expected volume and storage constraints are understood. It can also make initial allocation harder if the eligible storage cannot provide the larger initial request. A smaller primary with a suitable secondary may be more resilient in one environment, while another site may prefer fewer, larger extents. Follow local standards rather than applying a universal ratio.
Diagnosis path
Use this sequence to avoid solving the wrong layer.
Did the program start?
No -> Inspect effective DD, NEW/MOD disposition, SMS/volume messages,
and whether the primary request could be placed.
Yes -> Establish records written and checkpoint boundary.
Did output exceed expected volume?
Yes -> Compare actual growth with primary/secondary requests.
Check extension-related messages and allocation policy.
No -> Check for an existing dataset, conflicting disposition,
catalog issue, or incorrect target selected by symbols.
First, inspect the resolved JCL. An override such as SPACE=&OUTSP is meaningful only after the scheduler substitution is visible. Likewise, a UNIT or volume request can constrain the allocation to a location with less suitable free space than the general pool.
Next, compare the run to a known good run at the same business point. A larger input may be legitimate, but it may also signal duplicate input, a date-selection error, or an upstream extract that changed record length. Space symptoms should not hide an interface-control problem.
Finally, determine whether the dataset is partial and usable. A cataloged file with a normal-looking name is not proof that its contents are complete. Check record counts, trailer controls where available, and the producing step's completion state. Do not let a rerun append to it merely because DISP=MOD makes that convenient.
Safe correction choices
The correction should match the evidence:
- Primary allocation could not be placed: engage storage management with the requested size, effective SMS values, and timing. Changing quantities may not address a constrained class, volume, or policy.
- Output legitimately grew beyond forecast: revise estimates using several comparable peak runs, then propose primary and secondary values in the site's approved allocation convention.
- Output growth is abnormal: correct the upstream selection, duplicate feed, or loop before increasing space. More space would allow incorrect output to travel farther.
- Partial output exists after an updating step: decide restart disposition from the runbook and checkpoint design. A new output name, controlled cleanup, or a restart from a defined point may be required; none is automatic.
Avoid adding CONTIG as a reflex. It requests a contiguous primary extent and can make allocation less likely when free space is fragmented. It is a specific requirement, not a general cure for extension failures.
Before rerun: support checklist
- Confirm whether the failed step performed database updates, writes to other output files, or external transmissions before failure.
- Confirm the restart point and whether scheduler restart changes procedure parameters or generation references.
- Verify the partial output's catalog status, record count, and trailer/control totals; do not use its existence as proof of completeness.
- Review the effective JCL, including PROC overrides and SMS-related DD parameters.
- Obtain approval for any production JCL, storage-class, disposal, or cleanup change.
- Preserve the failing spool and record the changed assumption: expected volume, allocation unit, target class, or source-data correction.
The practical takeaway: an allocation failure is evidence about the requested dataset shape and the environment's ability to provide it. Establish whether the problem is initial placement, later extension, or abnormal output growth before changing SPACE or rerunning the batch flow.