DFSORT OUTFIL Creating multiple identical copies

DFSORT OUTFIL DFSORT OUTFIL: Selecting and sampling by RRN

Advertisements


OUTFIL can be used to create multiple datasets with the same data.

The most 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)

Name Description
DDNAMEnDDNAME is eight character’s name that representing the actual dataset in JCL.

Example: -

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 ********************************

Job:

000100 //Jobcard 
000400 //*                                                                     
000400 //*                                                                     
000500 //**********************************************************************
000600 //*                                                                     
001100 //STEP01   EXEC PGM=SORT                                                
001300 //SORTIN   DD DSN=MTHUSER.SORT.INPUT01,DISP=SHR                    
001800 //OUTPUT1  DD DSN=MTHUSER.SORT.OUTPT01,                            
001810 //             SPACE=(CYL,(1,1),RLSE),DCB=*.SORTIN,                     
001820 //             DISP=(NEW,CATLG,DELETE)                                  
001900 //OUTPUT2  DD DSN=MTHUSER.SORT.OUTPT02,                            
002000 //             SPACE=(CYL,(1,1),RLSE),DCB=*.SORTIN,                     
002100 //             DISP=(NEW,CATLG,DELETE)                                  
002400 //SYSOUT   DD SYSOUT=*                                                  
002410 //SYSIN    DD *                                                         
002411      SORT FIELDS=COPY 
002420      OUTFIL FNAMES=(OUTPUT1,OUTPUT2)                                    
003500 /*                                                                      
****** **************************** Bottom of Data ****************************

Output File: 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 ********************************

File: 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 Solution:

OUTFIL FNAMES=(OUTPUT1,OUTPUT2) - copies all the records to the output files OUTPUT1, OUTPUT2 to create to identical copies.


DFSORT OUTFIL DFSORT OUTFIL: Selecting and sampling by RRN

Advertisements