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
 

 

to delete a specific record when duplicates are present

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
zacharti

New User


Joined: 15 Jun 2006
Posts: 13

PostPosted: Wed Jan 23, 2008 1:15 pm    Post subject: to delete a specific record when duplicates are present
Reply with quote

Hi,
I have a file with the below input

1111 2007 A
1111 2007 B
2222 2008 A
3333 2009 A

HERE IN THE ABOVE EXAMPLE THE FIRST 2 RECORDS ARE SAME WHEN WE COMPARE THE FIRST TWO FIELDS,,,I.E WE HAVE A DUPLICATE. NOW WHEN SUCH CONDITION HAPPENS I WANT TO DELETE THE RECORD WITH B. HOW CAN I ACHIEVE THE SAME. CAN SOMEONE HELP ME.....
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jan 23, 2008 2:24 pm    Post subject:
Reply with quote

Assuming the thrid field(A,B) are in sorted order...
try this ICETOOL solution
Code:
//****************************************
//GETMATCH EXEC PGM=ICETOOL               
//TOOLMSG  DD SYSOUT=*                   
//DFSMSG   DD SYSOUT=*                   
//IN       DD *                           
1111 2007 A                               
1111 2007 B                               
2222 2008 A                               
3333 2009 A                               
/*                                       
//OUT      DD SYSOUT=*                   
//TOOLIN   DD *                           
  SELECT FROM(IN) TO(OUT) ON(1,9,CH) FIRST
/*                                       
Back to top
View user's profile Send private message
zacharti

New User


Joined: 15 Jun 2006
Posts: 13

PostPosted: Wed Jan 23, 2008 10:00 pm    Post subject:
Reply with quote

hi,
krisprem

its not in sorted order, then what can we do...?????.
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 Jan 23, 2008 10:13 pm    Post subject:
Reply with quote

zacharti,

Here's a DFSORT/ICETOOL job that will do what I think you asked for:

Code:

//S1    EXEC  PGM=ICETOOL                                         
//TOOLMSG DD SYSOUT=*                                             
//DFSMSG  DD SYSOUT=*                                             
//IN  DD *                                                         
1111 2007 A                                                       
1111 2007 B                                                       
2222 2008 A                                                       
3333 2009 A                                                       
4444 2009 B                                                       
4444 2009 A                                                       
/*
//OUT DD SYSOUT=*                                                 
//TOOLIN DD *                                                     
SELECT FROM(IN) TO(OUT) ON(1,4,CH) ON(6,4,CH) FIRST USING(CTL1)
/*   
//CTL1CNTL DD *                                                   
  SORT FIELDS=(1,4,CH,A,6,4,CH,A,11,1,CH,A)                       
/*


OUT would have:

Code:

1111 2007 A   
2222 2008 A   
3333 2009 A   
4444 2009 A   


Is that what you want?
Back to top
View user's profile Send private message
zacharti

New User


Joined: 15 Jun 2006
Posts: 13

PostPosted: Wed Jan 23, 2008 10:44 pm    Post subject:
Reply with quote

yes frank but cout you explain me these sort card
Back to top
View user's profile Send private message
zacharti

New User


Joined: 15 Jun 2006
Posts: 13

PostPosted: Wed Jan 23, 2008 11:02 pm    Post subject:
Reply with quote

hey frank,
THANKS A LOT I TRIED IT , IT WORKS FINE......
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 Jan 23, 2008 11:42 pm    Post subject:
Reply with quote

Quote:
could you explain me these sort card


SELECT FROM(IN) TO(OUT) ON(1,4,CH) ON(6,4,CH) FIRST USING(CTL1)

This is an ICETOOL SELECT operator:

FROM(IN) - defines the input file
TO(OUT) - defines the output file
ON(1,4,CH) ON(6,4,CH) - defines the ON fields as in positions 1-4 and 6-9. We check for dups and nondups on these two fields.
FIRST - keeps the first record with dup on fields (e.g. for 1111 2007 A and 1111 2007 B, it keeps 1111 2007 A) as well as unique records (e.g. 2222 2008 A).
USING(CTL1) - tells DFSORT to use the DFSORT control statements in CTL1CNTL.

CTL1CNTL has:

Code:

   SORT FIELDS=(1,4,CH,A,6,4,CH,A,11,1,CH,A) 


which sorts on the field in positions 1-4 (first ON field), the field in positions 6-9 (the second ON field) and the field in position 11 (not an ON field). The SORT is performed before SELECT processing. By sorting on the field in position 11 but not using it as an ON field, we ensure that SELECT sees the A record before the B record for each dup pair (for the two on fields) and keeps the A record as the FIRST record.
Back to top
View user's profile Send private message
zacharti

New User


Joined: 15 Jun 2006
Posts: 13

PostPosted: Thu Jan 24, 2008 2:55 am    Post subject:
Reply with quote

Hi Frank,
Thanks a lot frank for your answers.
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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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