OUTFIL: Creating multiple identical copies
OUTFIL: Creating multiple identical copies
Summary
- OUTFIL can be used to create multiple datasets with the same data. The known reason behind multiple datasets creation is backups.
- If the same dataset used to take backup on different areas like disk, tapes or local site, OUTFIL will be most useful.
- The same can be achieved with OUTFIL and the FNAMES parameter with an OPTION COPY statement.
- The FNAMES parameter identifies the DD statements in JCL for output data sets by their DDnames.
Syntax -
OPTION COPY
OUTFIL FNAMES=(DDNAME1, DDNAME2,…..,DDNAMEn)
DDNAMEn | DDNAME is eight character’s name that representing the actual dataset in JCL. |
Example -
Scenario - Create two output files with the same data in the input file
Input File - MTHUSER.SORT.INPUT01 - FB file of 80 length
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
00001 student1 dept1 560
00003 student3 dept2 520
00004 student4 dept1 540
00005 student5 dept2 500
00002 student2 dept3 510
******************************** Bottom of Data ********************************
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//Job-card
//*
//**********************************************************************
//*
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=MTHUSER.SORT.INPUT01,DISP=SHR
//OUTPUT1 DD DSN=MTHUSER.SORT.OUTPT01,
// SPACE=(CYL,(1,1),RLSE),DCB=*.SORTIN,
// DISP=(NEW,CATLG,DELETE)
//OUTPUT2 DD DSN=MTHUSER.SORT.OUTPT02,
// SPACE=(CYL,(1,1),RLSE),DCB=*.SORTIN,
// DISP=(NEW,CATLG,DELETE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=(OUTPUT1,OUTPUT2)
/*
**************************** Bottom of Data ****************************
Output File1 - MTHUSER.SORT.OUTPT01 - FB file of 80 length
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
00001 student1 dept1 560
00003 student3 dept2 520
00004 student4 dept1 540
00005 student5 dept2 500
00002 student2 dept3 510
******************************** Bottom of Data ********************************
Output File2 - MTHUSER.SORT.OUTPT02 - FB file of 80 length
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
00001 student1 dept1 560
00003 student3 dept2 520
00004 student4 dept1 540
00005 student5 dept2 500
00002 student2 dept3 510
******************************** Bottom of Data ********************************
Explaining Example -
OUTFIL FNAMES=(OUTPUT1,OUTPUT2) - copies all the records to the output files OUTPUT1, OUTPUT2 to create to identical copies.