The OUTFIL control statement describes the output file(s) and the processing to be done on the output records. OUTFIL processing is supported for sort, merge, and copy applications. Use the OUTFIL control statement to create multiple output files without making multiple passes through the input data.
The following example illustrates how to use the OUTFIL control statement to define mul- tiple output files.
OUTFIL FILES=1,OUTREC=(10:1,20,40:45,5,50:60,8), INCLUDE=(21,2,CH,EQ,C'NY') OUTFIL FILES=2,OUTREC=(20:1,20,50:60,8), INCLUDE=(21,2,CH,EQ,C'MA')
The two OUTFIL control statements illustrated above are required to create two different output files.
OUTFIL FILES=(01,02,03),OUTREC=(1:1,40,50:41,40)
OUTFIL FTOV,VLTRIM=C’*',OUTREC=(1,7,9:8,8)
This OUTFIL control statement uses FTOV to convert fixed-length records to variable- length records and VLTRIM to remove the specified type of trailing bytes (in this case, asterisks).
The SPLIT parameter of the OUTFIL control statement causes output records to be distrib- uted in rotation among files in an OUTFIL group.
OUTFIL FILES=(01,02,03),SPLIT
For the above example, the first record will be written to the SORTOF01 data set; the sec- ond, to SORTOF02; the third, to SORTOF03. The fourth record will be written to SORTOF01 again, and so on in round-robin fashion.
SPLIT, SPLITBY=n and SPLIT1R=n are mutually exclusive. SPLITBY=1 is equivalent to SPLIT.
OUTFIL FILES=(01,02,03),SPLITBY=1
The SPLITBY=n parameter writes groups of records in rotation among multiple output data sets and distributes multiple records at a time among the OUTFIL data sets. n specifies the number of records to split by. The minimum value for n is 1.
OUTFIL FILES=(01,02,03),SPLIT1R=10
The SPLIT1R=n parameter of the OUTFIL control statement causes all output records to be grouped and distributed among files in an OUTFIL group in a single rotation to maintain contiguity. The first n records are written to the first output file followed by the next n
Input: Length | Data 45 John Lewis -12.83 Research 50 Ted Blank +128.37 Manufacturing 54 Marilyn Carlson -282.83 Technical Support 51 Rex Otis +2.83 Marketing SYSIN: OPTION COPY OUTFIL IFTHEN=(WHEN=INIT, OVERLAY=(5:5,18,JFY=(SHIFT=LEFT,LEAD=C'''',TRAIL=C''''), 34:34,19,JFY=(SHIFT=LEFT,LEAD=C'''',TRAIL=C''''))), IFTHEN=(WHEN=INIT, BUILD=(1,4,5,60,SQZ=(SHIFT=LEFT,PAIR=APOST,MID=C’,'))), VLTRIM=C'
This example illustrates how you can create VB output records with comma separated values from VB input records containing fields in fixed positions.
Output: Length | Data 52 'John Lewis' -12.83 'Research' 52 'Ted Blank' +128.37 'Manufacturing' 54 'Marilyn Carlson' -282.83 'Technical Support' 52 'Rex Otis' +2.83 'Marketing'
On the EXEC statement, specify PARM=’…,JPn”string”,…’ where n is from 0 to 9. The quotes delimit the start and end of the string, so the string should not contain any imbedded quotes. If apostrophes are required, two should be specified for each one so as not to terminate the PARM field. Up to 10 such JPn PARMs can be used in one PARM field.
The string may contain any combination of
Select data for the current month using system symbols for MM and YYYY
//SELECT2 EXEC PGM=SORT,PARM='JP1"&MON&YR4"' //SYSOUT DD SYSOUT=* //SYMNOUT DD SYSOUT=* //SORTIN DD * 062013 072012 072013 012013 //SORTOUT DD SYSOUT=* //SYSIN DD * INCLUDE COND=(1,6,CH,EQ,JP1) SORT FIELDS=(1,6,CH,A) //*
Assuming this JCL was executed in July 2013, after data dictionary symbol substitution the INCLUDE statement becomes
INCLUDE COND=(1,6,CH,EQ,C’072013')
The output would be – 072013
Select data for only certain states where the list of states will vary:
// SET STATE1='NY' // SET STATE2='NJ' // SET STATE3='PA' // SET STATE4='CT' // SET STATE5=' ' // SET STATE6=' ' // SET STATE7=' ' // SET STATE8=' ' //SELECT1 EXEC PGM=SORT, // PARM=('JP1"&STATE1",JP2"&STATE2",JP3"&STATE3",JP4"&STATE4"', // 'JP5"&STATE5",JP6"&STATE6",JP7"&STATE7",JP8"&STATE8"') //SYSOUT DD SYSOUT=* //SYMNOUT DD SYSOUT=* //SORTIN DD * TALLAHASSEE FL TRENTON NJ TOPEKA KS HARTFORD CT SACRAMENTO CA //SORTOUT DD SYSOUT=* //SYSIN DD * INCLUDE COND=(15,2,CH,EQ,L(JP1,JP2,JP3,JP4,JP5,JP6,JP7,JP8)) SORT FIELDS=(1,16,CH,A) //*
After data dictionary symbol substitution, the INCLUDE statement becomes
INCLUDE COND=(15,2,CH,EQ,L(C'NY',C'NJ',C'PA',C'CT',C' ',C' ', C' ',C' '))
The output is HARTFORD CT TRENTON NJ
//SORT01 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=XXXX.YYYY.RECORDS.INPUT,DISP=SHR //OUTPUT01 DD DSN=XXXX.YYYY.OUTPUT01, // DISP=(NEW,CATLG,DELETE), // UNIT=3390,SPACE=(TRK,(10,10)) //OUTPUT02 DD DSN=XXXX.YYYY.OUTPUT01, // DISP=(NEW,CATLG,DELETE), // UNIT=3390,SPACE=(TRK,(10,10)) //FILE01 DD SYSOUT=* //FILE02 DD SYSOUT=* //SORTWK01 DD SPACE=(CYL,20),UNIT=SYSDA //SORTWK02 DD SPACE=(CYL,20),UNIT=SYSDA //SORTWK03 DD SPACE=(CYL,20),UNIT=SYSDA //SYSIN DD * SORT FIELDS=(6,5,CH,A) OUTFIL FNAMES=(OUTPUT01,OUTPUT02) OUTFIL FNAMES=FILE01, INCLUDE=(1,3,CH,EQ,C'G01'), HEADER2=(2/,20:'EMPLOYEE INFOMATION', 2/,1:'FIRSTNAME',14:'LASTNAME',29:'WORK DEPT', 41:’HIRE DATE',54:'LEVEL',65:'SALARY', /,1:’---------', 14:'--------',29:'---------', 40:’----------',54:'------',65:'---------'), OUTREC=(1:3,12,C' ',17,15,C' ',32,3,7C' ', 36,10,C' ',47,2,BI,M0,5C' ',50,5,PD,M2) OUTFIL FNAMES=FILE02, INCLUDE=(1,3,CH,EQ,C'G02'), HEADER2=(2/,20:'EMPLOYEE INFOMATION', 2/,1:'FIRSTNAME',14:'LASTNAME',29:'WORK DEPT', 41:’HIRE DATE',54:'LEVEL',65:'SALARY', /,1:’---------', 14:'--------',29:'---------', 40:’----------',54:'------',65:'---------'), OUTREC=(1:3,12,C' ',17,15,C' ',32,3,7C' ', 36,10,C' ',47,2,BI,M0,5C' ',50,5,PD,M2) //*
SORT statement. FIELDS specifies an ascending 5-byte character control field starting at position 6.
OUTFIL statement. The sorted input records are written to the OUTPUT01 and OUTPUT02 data sets.
OUTFIL statement. The subset of sorted input records containing ‘G01’ in positions 1 through 3 are used to produce a report, which is written to the FILE01 data set.
OUTFIL statement. The subset of sorted input records containing ‘G02’ in positions 1 through 3 are used to produce a report, which is written to the FILE02 data set.
FILE01 ------ EMPLOYEE INFORMATION FIRSTNAME LASTNAME WORK DEPT HIRE DATE LEVEL SALARY --------- -------- --------- --------- ----- ------ CHRISTINE HAAS A00 01/01/1975 11 50,000.00 CHRISTINE MIKE. A00 01/01/1976 12 52,750.00 DIANE HARISON A00 01/01/1977 13 55,000.00 DIANE HEMMINGER A00 01/01/1978 14 60,750.00 FILE02 ------ EMPLOYEE INFORMATION FIRSTNAME LASTNAME WORK DEPT HIRE DATE LEVEL SALARY --------- -------- --------- --------- ----- ------ JOAN PAN A00 01/01/1979 15 50,750.00 KEVEN MASK B00 01/01/1980 16 51,750.00 MAGGIE NEME A00 01/01/1981 17 56,000.00 MIKE BUSH B00 01/01/1982 18 58,750.00 PETER MAWAH B00 01/01/1983 19 59,000.00 STEVE. ARNEY B00 01/01/1984 20 75,000.00
Effective Product Owner plays a crucial role in Agile development, acting as the bridge between…
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…