Logical record length
How long one record is, in characters. It is written LRECL.
Also written LRECL, record length
Why it matters. A program reads records of one length. If the file is a different length, the data is cut or the job fails.
Syntax
ALLOCATE DATASET('name') NEW RECFM(F B) LRECL(n) BLKSIZE(n)
//ddname DD DSN=name,DISP=(NEW,CATLG),RECFM=FB,LRECL=133- LRECL(n)
- The record length in bytes.
- Fixed (F)
- Every record is exactly this long.
- Variable (V)
- This is the longest record, counting the 4-byte length field at the front.
- 133
- A print line of 132 characters plus 1 control character.
- COBOL FD
- The record in the program must match the LRECL.
Try it ALLOC
- 1
Make a file for a report, ZB0001.DEV.REPORT, with records of 133 characters. Use a block size of 27930.
ALLOC DSN('ZB0001.DEV.REPORT') NEW DSORG(PS) RECFM(F,B) LRECL(133) BLKSIZE(27930) - 2
Look at the details of the new file.
LISTDS 'ZB0001.DEV.REPORT'
Remember
- LRECL is the length of one record.
- 80 is the common size. Print lines are often 133.
- BLKSIZE is a whole number of records.
The usual mistake
LRECL(80) for a report with 133 characters on each line
A line longer than the record length does not fit. The end of the line is lost, or the job fails.
LRECL(133)
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.
Where can I practise Logical record length?
Right here, at ZedBank. You take a junior job at a simulated bank and use Logical record length 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.
- Block sizeHow much data is moved between disk and memory in one go, written as BLKSIZE.
- DatasetWhat a mainframe calls a file: a named collection of records with a defined structure, rather than a loose stream of bytes.
- Sequential datasetThe simplest kind of dataset: records stored one after another and normally read from start to finish.