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 MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am
No new posts Duplicate PARM on OUTFIL sancraig16 SYNCSORT 11 Thu Apr 05, 2018 10:25 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm
No new posts Copy set of records based on condition krish.deepu SYNCSORT 2 Thu Mar 08, 2018 11:39 am

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