Record Selection for Output File can be done using STARTREC, ENDREC, INCLUDE/OMIT, SAVE Parameters. Use SAVE to include records for OUTFIL processing that have not been included in any other OUTFIL group. If SAVE is specified on more than one OUTFIL group, then each of these OUTFIL groups gets the records that were discarded from all other OUTFIL groups that do not have SAVE. The OUTFIL INCLUDE/OMIT parameter is mutually exclusive with the SAVE parameter. Only one of these parameters can be specified for an OUTFIL group.
Note: Note that if the SORTOUT data set has not been associated with any OUTFIL control statement but is present in the JCL, the SORTOUT data set will receive a copy of all records prior to OUTFIL processing. This does not affect the SAVE operation, since SAVE is only pertinent to other OUTFIL group specifications.
SORT FILEDS=(Starting position, length, data-format, A/D) OUTFIL FNAMES=DD1, INCLUDE/OMIT COND=(….) OUTFIL FNAMES=DD2, INCLUDE/OMIT COND=(….) …....... OUTFIL FNAMES=DDn, SAVE DDn - Actual DD Name present in JCL. INCLUDE/OMIT - Specifies the INCLUDE/OMIT condition for specific OUTFIL. SAVE - Specifies the records not selected for any OUTFIL will be saved to DDn.
Scenario: Input contains the Employee Number, Name, Month & Subject. We want to write the records for the English, Physics & Business subjects to separate datasets then rest all discarded records to another dataset.
EMP NO (1:10) | NAME (11:20) | MONTH (31:3) | SUBJECT (35:10) |
1 | CHERYL | JANUARY | ENGLISH |
2 | NORMAN | MARCH | BUSINESS |
3 | LEONAID | DECEMBER | COMPUTER |
4 | IAN | OCTOBER | HISTORY |
5 | LINDA | FEBRURARY | PHYSICS |
6 | LITTLE | APRIL | ENGLISH |
7 | PIHU | JANUARY | HISTORY |
8 | VIKASH | OCTOBER | BUSINESS |
9 | SATVI | JANUARY | ENGLISH |
10 | LEE | DECEMBER | PHYSICS |
SORT FIELDS=(1,45,CH,A) OUTFIL FNAMES=ENGLOUT,INCLUDE=(35,10,CH,EQ,C’ENGLISH ') OUTFIL FNAMES=PHYSOUT,INCLUDE=(35,10,CH,EQ,C’PHYSICS ') OUTFIL FNAMES=BUSIOUT,INCLUDE=(35,10,CH,EQ,C’BUSINESS ') OUTFIL FNAMES=RESTOUT, INCLUDE=(35,10,CH,NE,C’ENGLISH ',AND, 35,10,CH,NE,C’PHYSICS ',AND, 35,10,CH,NE,C’BUSINESS ')
The first OUTFIL statement writes the records for the English subject to the ENGLOUT data set.
EMP NO (1:10) | NAME (11:20) | MONTH (31:3) | SUBJECT (35:10) |
1 | CHERYL | JANUARY | ENGLISH |
6 | LITTLE | APRIL | ENGLISH |
9 | SATVI | JANUARY | ENGLISH |
The second OUTFIL statement writes the records for the Physics subject to the PHYSOUT data set.
EMP NO (1:10) | NAME (11:20) | MONTH (31:3) | SUBJECT (35:10) |
5 | LINDA | FEBRURARY | PHYSICS |
10 | LEE | DECEMBER | PHYSICS |
The second OUTFIL statement writes the records for the Business subject to the BUSIOUT data set.
EMP NO (1:10) | NAME (11:20) | MONTH (31:3) | SUBJECT (35:10) |
2 | NORMAN | MARCH | BUSINESS |
8 | VIKASH | OCTOBER | BUSINESS |
The fourth OUTFIL statement writes the records not used for English, Physics or Business to the RESTOUT data set.
EMP NO (1:10) | NAME (11:20) | MONTH (31:3) | SUBJECT (35:10) |
3 | LEONAID | DECEMBER | COMPUTER |
4 | IAN | OCTOBER | HISTORY |
7 | PIHU | JANUARY | HISTORY |
But when there are more subjects the include statement for RESTOUT will be more complex. To avoid this SAVE parameter can be used.
SORT FIELDS=(1,45,CH,A) OUTFIL FNAMES=ENGLOUT,INCLUDE=(35,10,CH,EQ,C’ENGLISH ') OUTFIL FNAMES=PHYSOUT,INCLUDE=(35,10,CH,EQ,C’PHYSICS ') OUTFIL FNAMES=BUSIOUT,INCLUDE=(35,10,CH,EQ,C’BUSINESS ') OUTFIL FNAMES=RESTOUT,SAVE
The output of this will be the same as above. RESTOUT dataset will contain the same information as in the previous result i.e. rows with the subject in Computer and History.
EMP NO (1:10) | NAME (11:20) | MONTH (31:3) | SUBJECT (35:10) |
3 | LEONAID | DECEMBER | COMPUTER |
4 | IAN | OCTOBER | HISTORY |
7 | PIHU | JANUARY | HISTORY |
SORT FIELDS=(1,45,CH,A) OUTFIL FNAMES=ENGLOUT,INCLUDE=(35,10,CH,EQ,C’ENGLISH ') OUTFIL FNAMES=PHYSOUT,INCLUDE=(35,10,CH,EQ,C’PHYSICS ') OUTFIL FNAMES=BUSIOUT,OMIT=(35,10,CH,EQ,C’BUSINESS ') OUTFIL FNAMES=RESTOUT,SAVE
Now with OMIT condition for the BUSIOUT file all the records which don’t have the subject as BUSINESS. So the RESTOUT fil will now contain only the records having the subject as BUSINESS.
EMP NO (1:10) | NAME (11:20) | MONTH (31:3) | SUBJECT (35:10) |
2 | NORMAN | MARCH | BUSINESS |
8 | VIKASH | OCTOBER | BUSINESS |
A well-maintained product backlog is crucial for successful product development. It serves as a single…
Incremental value to the customer refers to the gradual delivery of small, functional parts of…
A Product Market refers to the group of potential customers who might be interested in…
The Professional Agile Leadership - Evidence-Based Management (PAL-EBM) certification offered by Scrum.org is designed for…
The Professional Agile Leadership (PAL I) certification, offered by Scrum.org, is designed to equip leaders…
Choosing the right Scrum Master Certification depends on your current experience and career goals. If…