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
 

 

Removing the duplicate lines if count crosses a number

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Removing the duplicate lines if count crosses a number
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 Moderator


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

PostPosted: Wed Nov 19, 2008 9:53 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts what is meaning of the number in dcl Martylin PL/I & Assembler 2 Thu Mar 09, 2017 7:18 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 GDG version number PANDU1 JCL & VSAM 4 Sat Mar 04, 2017 8:28 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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