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
 

 

Eliminating lower duplicate records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
vissubhai

New User


Joined: 07 Nov 2007
Posts: 12
Location: Hyderabad

PostPosted: Fri Nov 09, 2007 10:11 am    Post subject: Eliminating lower duplicate records
Reply with quote

Hi All... This is Viswanath. Nice to see various complex Sort problems here and their solutions. This stuff is great.

Coming to my problem I have an input file with as:

AAABBB3
AAABBB2
AAABBB4
BBBCCC1
BBBCCC5
BBBCCC2
XXXYYY7
XXXYYZ4
XXXYYZ3

And my output file should be as follows:

AAABBB4
BBBCCC5
XXXYYY7
XXXYYZ4

That is the output file should be sorted on first six fields and if there are any duplicates, they should be eliminated and the record which contains the largest value in seventh byte should be present.

Awaiting for the response.

Thanks in Advance,
Vissubhai.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Nov 09, 2007 10:27 am    Post subject:
Reply with quote

Viswanath,

May be you are looking for this

Code:

//SORTIN DD *                             
AAABBB3                                   
ZZZZZZ1                                   
AAABBB2                                   
AAABBB4                                   
BBBCCC1                                   
BBBCCC5                                   
BBBCCC2                                   
XXXYYY7                                   
XXXYYZ4                                   
ZZZZZZ3                                   
XXXYYZ3                                   
ZZZZZZ2                                   
ZZZZZZ4                                   
/*                                       
//SORTOUT DD SYSOUT=*                     
//SYSIN DD *                                       
  SORT FIELDS=(1,6,CH,A,7,1,CH,D)                   
  OUTREC OVERLAY=(20:SEQNUM,8,ZD,RESTART=(1,6))     
  OUTFIL OMIT=(20,8,ZD,NE,+1),BUILD=(1,19)         
/*                                                 



O/P:

Code:
AAABBB4   
BBBCCC5   
XXXYYY7   
XXXYYZ4   
ZZZZZZ4   


i/p file lrecl assumed 19. Change according to your req.
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: Fri Nov 09, 2007 9:36 pm    Post subject:
Reply with quote

Vissubhai,

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

Code:

//S1    EXEC  PGM=ICETOOL                               
//TOOLMSG DD SYSOUT=*                                   
//DFSMSG  DD SYSOUT=*                                   
//IN DD DSN=...  input file                                               
//OUT DD DSN=...  output file                                       
//TOOLIN DD *                                           
SELECT FROM(IN) TO(OUT) ON(1,6,CH) FIRST USING(CTL1)   
/* 
//CTL1CNTL DD *                                         
  SORT FIELDS=(1,6,CH,A,7,1,CH,D)                       
/*
Back to top
View user's profile Send private message
vissubhai

New User


Joined: 07 Nov 2007
Posts: 12
Location: Hyderabad

PostPosted: Mon Nov 12, 2007 9:48 am    Post subject: Reply to: Eliminating lower duplicate records
Reply with quote

Thank you so much Frank and Murmohk1

You guyz Rock...
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 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 Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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