When a program continuously writes data to an output
sequential dataset, SB37 and SE37 abends can occur if additional
space is required. Let's examine how these abends occur using the following DD
statement:
//OUTFILE DD
DSN=USERID.OUTFILE,
//
DISP=(,CATLG,CATLG),
//
SPACE=(TRK,(1,1),RLSE),
//
LRECL=30,RECFM=FB,VOL=(,,,1)
Case 1: SB37 Abend
An SB37 abend occurs when the dataset has exhausted
all the space that can be allocated to it according to its space definition,
but the program still needs additional space.
For the DD statement shown above:
- Primary
allocation = 1 track
- Secondary
allocation = 1 track
- Maximum
number of extents allowed for a sequential dataset on a volume = 16 (1
primary extent + 15 secondary extents)
Therefore, the maximum space that can be allocated to
USERID.OUTFILE on a single volume is:
- 1
primary track
- 15
secondary tracks
Total = 16 tracks
If the program continues writing records after all 16 tracks
have been allocated, no additional extents can be obtained. As a result, the
job terminates with an SB37 abend.
Case 2: SE37 Abend
An SE37 abend occurs when the system attempts to allocate a new secondary extent, but the required space is NOT available on the volume.
Using the same DD statement:
//OUTFILE DD DSN=USERID.OUTFILE,
//
DISP=(,CATLG,CATLG),
//
SPACE=(TRK,(1,1),RLSE),
//
LRECL=30,RECFM=FB,VOL=(,,,1)
Each time the dataset requires additional space, the system attempts to allocate a secondary extent of 1 track. If sufficient free space is not available on the specified volume, the requested secondary extent cannot be allocated.
In this situation, even though the dataset has not yet reached its maximum limit of 16 extents, the allocation request fails and the job abends with SE37.
Note: If the system cannot allocate the requested primary space, the job step will fail with "JCL error" before execution begins. In such cases, the allocation fails with the message: IGD17272I VOLUME SELECTION HAS FAILED FOR INSUFFICIENT SPACE