IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Omit records when key value changes based on another key


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Wed May 07, 2008 7:09 am
Reply with quote

Hi,

I have a file that has input records with 2 key values. I need to omit records with the following condition - when the value of the second key field changes after more than 10 records with the same first key.

RECFM - FB
LRECL - 80
First key field - 1-4
Second key field - 6-9

Sample input
0001 1345
0001 1345
0001 1346
0001 1346
0001 1346
0001 1346
0001 1346
0001 1346
0001 1347
0001 1347
0001 1347
0001 1347
0001 1348 -> second key value change after more than 10 records with
0001 1348 same value of first key. Any more records with 0001
as first key needs to be omitted.

Output
0001 1345
0001 1345
0001 1346
0001 1346
0001 1346
0001 1346
0001 1346
0001 1346
0001 1347
0001 1347
0001 1347
0001 1347

Can this be done thorugh sort/icetool?

Thanks,
Aneesh.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 07, 2008 9:51 pm
Reply with quote

Aneesh,

The following DFSORT/ICETOOL JCl will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL   
//TOOLMSG  DD SYSOUT=*       
//DFSMSG   DD SYSOUT=*       
//IN       DD DSN=Your input file,
//            DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                   
  SPLICE FROM(IN) TO(T1) ON(1,4,CH) -                             
  WITH(1,83) WITHALL KEEPBASE USING(CTL1)                         
  SORT FROM(T1) USING(CTL2)                                       
//CTL1CNTL DD *                                                   
  SORT FIELDS=(1,4,CH,A,84,9,CH,D)                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,3,ZD,RESTART=(1,4))),
        IFTHEN=(WHEN=(81,3,ZD,EQ,11),OVERLAY=(84:6,9))           
  OUTFIL FNAMES=T1,BUILD=(1,83),                                 
  OMIT=(81,3,ZD,GT,10,AND,(06,9,CH,NE,84,9,CH))                   
//CTL2CNTL DD *                                                   
  OPTION EQUALS                                                   
  SORT FIELDS=(1,4,CH,A,81,3,CH,A)                               
  OUTFIL FNAMES=OUT,BUILD=(1,80)                                 
/*                                                               


Hope this helps...

Cheers

Kolusu
Back to top
View user's profile Send private message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Thu May 08, 2008 9:43 am
Reply with quote

Thanks a lot, Kolusu. That is awesome.

Thanks,
Aneesh.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Use input file with OMIT rcd keys? DFSORT/ICETOOL 15
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top