Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Omit records when key value changes based on another key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Omit records when key value changes based on another key
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    Post subject:
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    Post subject: Reply to: Omit records when key value changes based on anoth
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us