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

Removing the duplicate lines if count crosses a number


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

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Wed Nov 19, 2008 4:09 pm
Reply with quote

Hi,
I have a requirement as below:
Sample Input:

Code:

AAA 123  kdlfjsldfd
AAA 123  dsljkfdlsj
AAA 165  dfsjkdfljls
AAA 286  dlsjfdsljfls
BBB 198  1
BBB 198  2dfsljdsjlsj
BBB 191  3dlksjldsjfl
BBB 191 50fljfsljlsf
BBB 193 51fljfsljlsf
..
more than 50 records with same 'BBB 198' 
..
..
..
BBB 198 84fljfsljlsf
BBB 133 ddfsdfdsaf
BBB 133 dsfadfss
BBB 135 dfsafdsafd


First 3 bytes represents a set of records.
If we have more than 50 records in a set, then duplicate records in each set should be eliminated based on (5-7) 3 bytes
For AAA set we have only 4 records- No problem
For BBB set we have more than 50 records, So the duplicate records in this set should be eleminated, only first occurance of the record should be taken.
output:
Code:

AAA 123  kdlfjsldfd
AAA 123  dsljkfdlsj
AAA 165  dfsjkdfljls
AAA 286  dlsjfdsljfls
BBB 191 50fljfsljlsf
BBB 133 ddfsdfdsaf
BBB 135 dfsafdsafd
BBB 193 51fljfsljlsf
BBB 198  1




LRECL= 80
all other data from 9th position can be anything

Thanks,
Balu
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 19, 2008 9:53 pm
Reply with quote

Quote:
For BBB set we have more than 50 records, So the duplicate records in this set should be eleminated, only first occurance of the record should be taken.


For BBB 191, the input has:

BBB 191 3dlksjldsjfl
BBB 191 50fljfsljlsf

so the first record is:

BBB 191 3dlksjldsjfl

But for the output, you show:

BBB 191 50fljfsljlsf

which is the second record. How does that correspond to your stated "rule" about taking the first record?
Back to top
View user's profile Send private message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Thu Nov 20, 2008 9:42 am
Reply with quote

Hi Frank,

I am sorry to say that it was a copy paste error.
The record
BBB 191 3dlksjldsjfl
should come in the output file.

and Please note that our sort version is a old version and it doesn't has Group operations in it.


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

Senior Member


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

PostPosted: Thu Nov 20, 2008 11:03 pm
Reply with quote

vvmanyam,


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,(X,Y),RLSE)         
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
  SORT FROM(IN) USING(CTL1)                                       
  SPLICE FROM(T1) TO(OUT) ON(1,3,CH) WITH(1,85) WITHALL USING(CTL2)
//CTL1CNTL DD *                                                   
  OPTION EQUALS                                                   
  SORT FIELDS=(1,3,CH,A,5,3,CH,A)                                 
  OUTREC OVERLAY=(81:SEQNUM,5,ZD,RESTART=(1,7),5X)                 
  OUTFIL FNAMES=T1,REMOVECC,                                       
  SECTIONS=(1,3,TRAILER3=(1,3,86:MAX=(81,5,ZD,M11,LENGTH=5)))     
//CTL2CNTL DD *                                                   
  SORT FIELDS=(1,3,CH,A,86,5,CH,D)                                 
  OUTFIL FNAMES=OUT,BUILD=(1,80),                                 
  OMIT=(81,5,ZD,GT,1,AND,86,5,ZD,GT,50)
/*
Back to top
View user's profile Send private message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Fri Nov 21, 2008 10:37 am
Reply with quote

Thanks Skolusu
Excellent solutoin ...




Thanks,
Balu
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 To get the count of rows for every 1 ... DB2 3
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top