Jcl sort to split mainframe dataset

I am trying to split an MF PS into multiple datasets. For example, if I have a dataset containing 600 percent, I want to divide it into 6 files of 100 records. Can this be done using JCL sorting?

+3
source share
6 answers

Below the JCL uses DFSORT to split the DD SOTRIN evenly into 3 DATASETS outputs (OUT1, OUT2 and OUT3), to do this through 6 add 3 more outputs of the DD statements and add them to the FNAMES statement.

//SPLIT EXEC PGM=ICEMAN  
//SYSOUT DD SYSOUT=*  
//SORTIN DD DSN=Y897797.INPUT1,DISP=OLD  
//OUT1 DD DSN=Y897797.SPLIT1,DISP=(NEW,CATLG),  
// SPACE=(CYL,(5,5)),UNIT=SYSDA  
//OUT2 DD DSN=Y897797.SPLIT2,DISP=(NEW,CATLG),  
// SPACE=(CYL,(5,5)),UNIT=SYSDA  
//OUT3 DD DSN=Y897797.SPLIT3,DISP=(NEW,CATLG),  
// SPACE=(CYL,(5,5)),UNIT=SYSDA  
//SYSIN DD *  
SORT FIELDS=(21,5,FS,A)  
OUTFIL FNAMES=(OUT1,OUT2,OUT3),SPLIT  
/*  

SORT FIELDS = (21,5, FS, A) is how you want to sort a sortint dataset, below is what this field operator means

21
5
( Numeric)
A

DFSORT
Smart DFSORT Tricks

+4

SPLIT SPLIT, .

SPLITBY = n "" n OUTFIL. SPLIT SPLITYBY = 1.

SPLIT1R = n "" (n OUTFIL, n OUTFIL , OUTFIL, , , .

OUTFIL = OUT1 .

IF STATREC/ENDREC INCLUDE/OMIT, OUTFIL SAVE , OUTFIL.

+2
  • Deuian SORT CARD . 3 , , , 3, .
  • - , , , . 10000 . , , 40000 , 3 , 10000 + 10000/3 .

OUTFIL FNAMES = (OUT1, OUT2, OUT3), = 10000

  • , . , ...

=
OUTFIL FILES = OUT1, ENDREC = 10000
OUTFIL = 02, STARTREC = 10001, ENDREC = 20000 OUTFIL FILES = 03, STARTREC = 20001, ENDREC = 30000

  • , 30000 , , , SORT . 10000 .

, . .

+1

PS, 1 . . 3 . . , 1 o/p 2019 . O/p 2 2018 . O/p 3 2017 . .. JCL

0

, , , . OUTFIL SPLIT, OUTPUT1, OUTPUT2, OUTPUT1, OUTPUT2 .., . SPLIT , FNAMES. OUTFIL: OPTION COPY OUTFIL FNAMES = (OUTPUT1, OUTPUT2), SPLIT 17 , OUTPUT1, : 01 03 05 07 09 11 13 13 15 17

Similarly, the OUTFIL SPLITBY = n parameter splits n records at a time among the data sets specified in FNAMES. The following statements split four records at a time between three OUTFIL data sets: OPTION COPY OUTFIL FNAMES = (OUT1, OUT2, OUT3), SPLITBY = 4

0
source

The following JCL program is used to split one file into 3 files. This is one way to implement this logic. Link: https://youtu.be/HFT9wXtoo74

//JOB Statement here...
//P020  EXEC  PGM=SORT                                                  
//SYSOUT    DD  SYSOUT=*                                                
//SORTIN DD   DSN=USER.CHANDRU.PS1,DISP=SHR                          
//OUT1   DD   DSN=USER.CHANDRU.PS2,DISP=OLD                          
//OUT2   DD   DSN=USER.CHANDRU.PS3,DISP=OLD                          
//OUT3   DD   DSN=USER.CHANDRU.PS4,DISP=OLD                          
//SYSIN  DD   *
        OPTION COPY                                      
        OUTFIL FNAMES=(OUT1,OUT2,OUT3),SAVE,SPLITBY=1    
/*                                                                      
0
source

Source: https://habr.com/ru/post/1795966/


All Articles