IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Eliminating lower duplicate records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Fri Nov 09, 2007 10:27 am
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 Developer


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

PostPosted: Fri Nov 09, 2007 9:36 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top