OMIT COND
Leaves out the records that match a test, so the next step only sees clean ones.
Also written INCLUDE COND, INCLUDE, OMIT
Why it matters. Payments with no account, or a type nobody knows, must not reach the ledger. OMIT stops them at the door.
See it
Drop every record that has C in byte 30. Here C means closed.
Syntax
OMIT COND=(p,m,format,operator,value) INCLUDE COND=(p,m,format,operator,value[,OR|AND,...])
- p,m
- Where the field starts and how long it is.
- format
- How to compare: CH, ZD, PD, BI.
- operator
- EQ, NE, GT, GE, LT or LE.
- value
- What to compare with: C'text', X'hex' or a number.
- AND / OR
- Join tests. AND is worked out before OR.
- FORMAT=
- Gives the format once for every test, as OMIT COND=(1,2,EQ,C'XX'),FORMAT=CH.
Try it OMIT COND
- 1
You're in the SYSIN lines of job SORTTXN, under a SORT FIELDS line. Write the statement that leaves out a payment if column 10 is a space (no account) or if the 2 characters in column 30 are XX.
SYSIN OMIT COND=(10,1,CH,EQ,C' ',OR,30,2,CH,EQ,C'XX') - 2
Submit the job SORTTXN from your DEV JCL library.
SUBMIT 'ZB0001.DEV.JCL(SORTTXN)' - 3
Read the output of the job, and find how many records came out.
OUTPUT SORTTXN
Remember
- OMIT COND drops the records that match. INCLUDE COND keeps them.
- A test is start, length, format, operator, value.
- Check ICE054I: IN minus OUT is what the test removed.
The usual mistake
OMIT COND=(10,1,CH,EQ,' ')
The value is text, so it needs C and quotes: C' '. Without the C, DFSORT cannot read the value.
OMIT COND=(10,1,CH,EQ,C' ')
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. In real DFSORT the record count line ICE054I shows records that reached the output, as here.
Where can I practise OMIT COND?
Right here, at ZedBank. You take a junior job at a simulated bank and use OMIT COND 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.