Block size
The amount of data the system moves between disk and memory in one go.
Also written BLKSIZE
Why it matters. A good block size makes every job that reads or writes the file faster. A poor one wastes disk space and time.
Syntax
ALLOCATE DATASET('name') NEW RECFM(F B) LRECL(n) BLKSIZE(n)
//ddname DD DSN=name,DISP=(NEW,CATLG),RECFM=FB,LRECL=80,BLKSIZE=27920- BLKSIZE(n)
- Bytes in one block.
- LRECL(n)
- Bytes in one record. For fixed blocked files, BLKSIZE is a multiple of it.
- RECFM(F B)
- Fixed length, blocked.
- 27920
- The largest multiple of 80 that fits half a 3390 track (27998).
- Leave it out
- The system picks a good value (system-determined block size).
Try it ALLOC
- 1
Look at the details of the account file, ZBANK.DATA.ACCOUNTS. Find its block size.
LISTDS 'ZBANK.DATA.ACCOUNTS' - 2
Make a new file, ZB0001.DEV.TXNFILE, with the same shape: fixed blocked records of 80, and a block size of 27920.
ALLOC DSN('ZB0001.DEV.TXNFILE') NEW DSORG(PS) RECFM(F,B) LRECL(80) BLKSIZE(27920)
Remember
- BLKSIZE is how many bytes move in one read or write.
- A block holds whole records: 27920 is 349 times 80.
- Bigger blocks mean fewer reads, so jobs run faster.
The usual mistake
BLKSIZE(27900) with LRECL(80)
27900 is 348.75 records. A block must hold a whole number of records, so the number is wrong.
BLKSIZE(27920), or leave BLKSIZE out and let the system choose
On real z/OS
ALLOCATE here fills in FB and 80 when you leave them out, and the space figures are accepted but not modelled. Real z/OS takes them from your options, or from a data class on a storage-managed system, and a bad combination is refused by the system or fails when the file is opened. Real systems usually leave BLKSIZE out and let the system choose.
Where can I practise Block size?
Right here, at ZedBank. You take a junior job at a simulated bank and use Block size in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- Record formatWhether the records in a dataset are all the same length or vary, and how they are blocked. Written as RECFM.
- Logical record lengthHow long each record in a dataset is, in characters, written as LRECL.
- DatasetWhat a mainframe calls a file: a named collection of records with a defined structure, rather than a loose stream of bytes.
- Space allocationReserving disk space for a dataset up front, in tracks, cylinders or blocks, with room to grow.