Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Matching and unmatched records!! Vignesh Sid SYNCSORT 3 Thu Nov 09, 2017 11:22 am
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us