Split a file using SORT--Help



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

Split a file using SORT--Help

Postby jomythomas » Sat Aug 07, 2010 12:16 pm

I have a requirement like ,
To split a flat file and store data in different dataset.

Sample Input file format(Length 200)
===================


_w2345asf8790001:170:
A0010067 raj akshay 98648
B0006758 jay rakhinc 67589
_w2345asf8790001:168:
B9874646 ysgd yhnty 78659
u6788689 yiru ruiuu 987777


Out put file 1:should be like this,
_w2345asf8790001:170:
A0010067 raj akshay 98648
B0006758 jay rakhinc 67589


Output file2:shold be
_w2345asf8790001:168:
B9874646 ysgd yhnty 78659
u6788689 yiru ruiuu 987777


Maximum occurance of this header will be 4. like 168, 170, 176, 180
Please let me know How can I achieve this using SORT...
The search criteria can be string '_W' in the begining of each line.
I can confirm that '_W' wont come in file other than headers.

Jo
jomythomas
 
Posts: 1
Joined: Sat Aug 07, 2010 11:49 am
Has thanked: 0 time
Been thanked: 0 time

Re: Split a file using SORT--Help

Postby skolusu » Mon Aug 09, 2010 9:10 pm

Jomythomas,

The following DFSORT JCL will give you the desired results
//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=your input FB 200 byte file,DISP=SHR
//OUT1     DD SYSOUT=*                                             
//OUT2     DD SYSOUT=*                                             
//OUT3     DD SYSOUT=*                                             
//OUT4     DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'_W'),PUSH=(201:ID=1))
  OUTFIL FNAMES=OUT1,BUILD=(1,200),INCLUDE=(201,1,ZD,EQ,1)         
  OUTFIL FNAMES=OUT2,BUILD=(1,200),INCLUDE=(201,1,ZD,EQ,2)         
  OUTFIL FNAMES=OUT3,BUILD=(1,200),INCLUDE=(201,1,ZD,EQ,3)         
  OUTFIL FNAMES=OUT4,BUILD=(1,200),INCLUDE=(201,1,ZD,EQ,4)         
//*
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


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post