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 BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts How do you create Eclipse based dialogs jasorn IBM Tools 0 Thu Aug 03, 2017 5:05 pm
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm

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