Space allocation
Space reserved on disk when a dataset is made: a first amount, and a second amount to add if it fills.
Also written SPACE, primary and secondary space, allocation
Why it matters. A dataset that runs out of space stops the job that writes to it. Planning the space avoids that.
Syntax
ALLOCATE DATASET('name') NEW SPACE(primary,secondary) TRACKS|CYLINDERS
//ddname DD ...,SPACE=(TRK,(primary,secondary))- primary
- The space reserved at once.
- secondary
- The space added each time it fills.
- TRK / CYL
- Tracks or cylinders. In JCL, a block length is also allowed.
- RLSE
- Give back unused space when the file closes.
- B37 / D37 / E37
- Out of space on the volume, out of primary with no secondary, or out of extents.
Try it ALLOC
- 1
Make a file, ZB0001.DEV.BIGFILE. Reserve 5 tracks first, and add 2 tracks each time it fills.
ALLOC DSN('ZB0001.DEV.BIGFILE') NEW DSORG(PS) TRACKS SPACE(5,2) - 2
Look at the details of the new file.
LISTDS 'ZB0001.DEV.BIGFILE'
Remember
- Primary space is reserved when the dataset is made.
- Secondary space is added each time the primary fills, up to the limit of extents.
- Units are tracks, cylinders or blocks. Cylinders suit large files.
The usual mistake
SPACE(1,0) TRACKS for a file that will hold a whole day of payments
One track is small and nothing can be added. When it fills, the job ends with an abend such as D37.
Give a primary that fits the usual size, and a secondary for growth
On real z/OS
Space figures are accepted but not enforced in MF/OS, so a file cannot fill up and abend B37, D37 or E37 here. On real z/OS a dataset has a limit of extents on each volume, so a very small secondary can run out of extents before the disk is full.
Where can I practise Space allocation?
Right here, at ZedBank. You take a junior job at a simulated bank and use Space allocation in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- DatasetWhat a mainframe calls a file: a named collection of records with a defined structure, rather than a loose stream of bytes.
- DASDDirect access storage device, the mainframe term for disk storage.
- VolumeA single unit of disk storage with a six-character label, on which datasets are placed.
- AbendAn abnormal end: a program stopping in an uncontrolled way rather than finishing and reporting a result.
- DD statementThe JCL statement that connects a name inside a program to a real dataset outside it.