Mainframes 360
The one stop destination for System Z professionals

Tuesday, October 1, 2013

Space ABENDs – SB37, D37, E37

What are those extents?
One of the major tasks of the z/OS is to allocate space for files. A simple mechanism for doing this is contigous allocation. In this scheme, a contiguous section of the disk is allocated for a file. This method achieves optimal performance for the application reading/writing the file. However, contiguous allocation scheme has some cons :

1. The OS must know, how much space will be required for the file prior to creating the file. On the z/OS, you must specify explicitly, the amount of space needed through the SPACE parameter.
2. Because files are being continually created or deleted, over a period of time, free space(holes) is scattered across the disk in small chunks.Fragmentation occurs. A single large contiguous section may not be available to satisfy the space request.

To resolve these two problems, the z/OS will commonly use extent allocation - a scheme in which chunks of space are allocated to a file, as and when the program that is writing the file needs them. A system that uses extent allocation, needs to know where all of the extents of a file are located. The z/OS uses a dictionary approach, a system in which a table has the information about each dataset. The VTOC(Volume table of contents) holds a row for every file on the disk. Every row referred as file control block has an array of pointers to extents. To further improve the performance of the VTOC, there's also a VTOC index.
Space Allocation on z/OS
The SPACE parameter specifies the primary and secondary allocation. A space request like (CYL,(100,100)) means that z/OS would try to allocate 100 cylinders of primary space. The secondary space is the overflow size. That is if the dataset becomes full, z/OS routines extend the dataset by another 100 cylinders of secondary space.

For non-VSAM dataset, z/OS allows upto 16 extents of a file per disk volume. Theoretically, you can therefore have a file size of 1 primary extent and upto 15 secondary extents. For a space request like (CYL,(100,100)), this translates to a maximum size of 100 cylinders + 15 x 100 cylinders = 1600 cylinders of space. In practice, z/OS may not find a large contiguous section of the disk to fulfill a primary request. By default, z/OS can satisfy a primary request by breaking it up in upto 5 extents. The bottom-line is, that a primary request can be fulfilled by anything from 1 to 5 extents. Remember, that each extents contributes to the total of the 16 allowed. So, if the full 5 extents are used for the primary allocation, you are left with just 11 for the secondary.

Space abends
As a programmer, you may run into out-of-space errors on creating new datasets. The system abend code SB37 occurs, when there's not enough space or no more extents available on the current volume. The abend code SD37 is raised when you don't specify a secondary allocation. Another abend is SE37, which occurs when there are no more volumes available.

References:

To many people who are thrown to work at a mainframe computer on their first job, they feel lost. Mainframe people seem to speak a completely different language and that doesn't make life easy. What's more, the books and manuals are incredibly hard to comprehend.

"What on earth is a Mainframe?" is an absolute beginner's guide to mainframe computers. We'll introduce you to the hardware and peripherals. We'll talk about the operating system, the software installed on a mainframe. We'll also talk about the different people who work on a mainframe. In a nutshell, we'll de-mystify the mainframe.

Readers based in India, can buy the e-book for Rs. 50 only or the print book. International readers based in the US and other countries can click here to purchase the e-book.