Extraction of set / group of records based on condition.



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

Extraction of set / group of records based on condition.

Postby dam_chandu » Wed Mar 23, 2011 11:01 am

Hi All,

I have a input file (FB, LRECL: 10). Alphabets F or K or M at the first byte are the delimiters for the group or set of records.

Sample Input File

A -> First set of records.
1
2
F -> Start of new set i.e. second set of records.
1
2
3
F -> Start of new set i.e. third set of records.
1
2
F -> Start of new set i.e. fourth set of records.
1
K -> Start of new set i.e. firth set of records.
1
2
3
K -> Start of new set i.e. sixth set of records.
1
M -> Start of new set i.e. seventh set of records and so on...
1
2
3

Requirement:

Would wish to split the above input file into two files using Sort / Icetool.

1) File 1, where we have all records which are "F delimited" record along with dependents 1,2,3 records.
2) File 2, where we have all records which are NOT "F delimited" record along with dependents 1,2,3 records.

Output File 1

F
1
2
3
F
1
2
F
1

Output File 2

A
1
2
K
1
2
3
K
1
M
1
2
3

Regards,
Anand.
dam_chandu
 
Posts: 6
Joined: Mon Sep 20, 2010 6:17 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Extraction of set / group of records based on condition.

 

Re: Extraction of set / group of records based on condition.

Postby skolusu » Wed Mar 23, 2011 9:34 pm

dam_chandu,

Use the following DFSORT JCL which will give you the desired results

//STEP0100 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SORTIN   DD DSN=your input FB 10 byte file,DISP=SHR
//FILEF    DD SYSOUT=*                                             
//OTHER    DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,SS,EQ,C'F,K,M'),PUSH=(11:1,1))
  OUTFIL FNAMES=FILEF,BUILD=(1,10),INCLUDE=(11,1,CH,EQ,C'F')       
  OUTFIL FNAMES=OTHER,SAVE,BUILD=(1,10)                             
//*
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: Extraction of set / group of records based on condition.

Postby dam_chandu » Fri Mar 25, 2011 10:05 am

Hi Skolusu,

Thanks a ton. It worked. Appreciate your timely response.

Anand.
dam_chandu
 
Posts: 6
Joined: Mon Sep 20, 2010 6:17 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post