OUTREC BUILD
Builds each new record from pieces: some columns from the old one and some fixed text.
Also written OUTREC, BUILD
Why it matters. Most of the bank's files are made from other files. OUTREC reshapes the records on the way through.
See it
Build one record, piece by piece
Tap each piece of BUILD in order. It reads left to right.
Start with C'A'.
0 of 11 pieces
Syntax
OUTREC BUILD=(piece,piece,...) OUTREC FIELDS=(piece,piece,...)
- p,m
- Copy m bytes from position p of the input record.
- C'text'
- Write fixed text.
- SEQNUM,n,ZD
- A counter, n digits wide, up by 1 for each record.
- nX
- Write n blanks.
- n:
- Move to column n before the next piece.
- OVERLAY
- The sibling of BUILD that changes parts of the record and keeps the rest.
Try it OUTREC BUILD
- 1
You're in the SYSIN lines of job OPENACCT. SORT FIELDS=COPY is already above you. Write the statement that builds each output record so it starts with the letter A, then a 7-digit counting number, then 10 characters from column 9 of the customer.
SYSIN OUTREC BUILD=(C'A',SEQNUM,7,ZD,9,10) - 2
Submit the job OPENACCT from your DEV JCL library.
SUBMIT 'ZB0001.DEV.JCL(OPENACCT)' - 3
Read the output of the job.
OUTPUT OPENACCT
Remember
- OUTREC BUILD=( ) is a list of pieces, left to right.
- 9,10 copies 10 characters from column 9.
- C'text' writes fixed text. SEQNUM counts up.
The usual mistake
OUTREC BUILD=(A,SEQNUM,7,ZD,9,10)
Fixed text needs C and quotes. A on its own is not text, so DFSORT cannot read the piece.
OUTREC BUILD=(C'A',SEQNUM,7,ZD,9,10)
On real z/OS
Real DFSORT names the product and release in ICE000I and prints more lines (such as ICE250I and ICE193I). MF/OS runs a subset of DFSORT and writes its own product name there. Numeric formats read digits from text here, not real packed or binary bytes. Real DFSORT also has INREC, which reshapes before the sort, and OUTFIL, which can write several outputs. OUTREC remains valid.
Where can I practise OUTREC BUILD?
Right here, at ZedBank. You take a junior job at a simulated bank and use OUTREC BUILD in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- DFSORTThe standard sort utility, used far beyond sorting to select, merge, reformat and summarise records at speed.
- DD statementThe JCL statement that connects a name inside a program to a real dataset outside it.
- Job stepOne program execution within a job. A job is simply a sequence of steps that run in order.
- JCLJob Control Language: the language used to tell the mainframe what programs to run, in what order, and with what files.