SPLIT file using SORT based on totals



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Re: SPLIT file using SORT based on totals

Postby skolusu » Fri Apr 19, 2013 11:00 pm

kkamarnath,

if your intention is to have the first and last group in 2 different files and rest of the groups into a single file, then use the following DFSORT JCL which will give you the desired results
//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//INA      DD DISP=SHR,DSN=Your input FB 133 byte file
//INB      DD DISP=SHR,DSN=Same input FB 133 byte file
//OUT01    DD SYSOUT=*
//OUT02    DD SYSOUT=*
//OUT03    DD SYSOUT=*
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  JOINKEYS F1=INA,FIELDS=(134,8,A),SORTED,NOSEQCK                   
  JOINKEYS F2=INB,FIELDS=(001,8,A),SORTED,NOSEQCK                   
  JOIN UNPAIRED,F1                                                   
  REFORMAT FIELDS=(F1:1,141,?)                                       
  OUTFIL FNAMES=OUT01,BUILD=(1,133),INCLUDE=(134,8,ZD,EQ,1)         
  OUTFIL FNAMES=OUT03,BUILD=(1,133),INCLUDE=(142,1,CH,EQ,C'1')       
  OUTFIL FNAMES=OUT02,BUILD=(1,133),SAVE                             
//*                                                                 
//JNF1CNTL DD *                                                     
  INREC IFTHEN=(WHEN=GROUP,END=(5,5,CH,EQ,C'TOTAL'),PUSH=(134:ID=8))
//*                                                                 
//JNF2CNTL DD *                                                     
  INCLUDE COND=(5,5,CH,EQ,C'TOTAL')                                 
  INREC BUILD=(SEQNUM,8,ZD,START=0)                                 
//*


Bill,

We don't have to SORT and SUM For JNF2, we simply can use a COPY operation using the trick of identifying the last record.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Re: SPLIT file using SORT based on totals

 

Re: SPLIT file using SORT based on totals

Postby kkamarnath » Mon Apr 22, 2013 12:18 pm

Hi Kolusu,

Thank you very much for your solution.

It worked well.. :)

I really apprecaite you help.

Thanks,
Amar
kkamarnath
 
Posts: 10
Joined: Wed Apr 17, 2013 6:08 pm
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post