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
 
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 Merging records, but not all the time prino DFSORT/ICETOOL 11 Sat Feb 17, 2018 4:20 pm
No new posts Need all records with high key kalidasvs SYNCSORT 14 Fri Feb 09, 2018 10:38 pm
No new posts Why is SORT rearranging records that ... cschablow DFSORT/ICETOOL 4 Wed Jan 24, 2018 10:14 pm
No new posts Skip records depends on count lakshmiibmmainframes DFSORT/ICETOOL 5 Sun Dec 24, 2017 9:51 pm
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm

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