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

deleting duplicate records in dataset using cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
venugopal404

New User


Joined: 14 Dec 2010
Posts: 13
Location: hyderabad

PostPosted: Wed Feb 02, 2011 12:31 pm
Reply with quote

please help me out


input:
12345abc12/02/1988
45865fgs02/15/1963
87468sdf01/12/2001
12345abc12/02/1988
87468sdf01/12/2001

required output by using cobol:
12345abc12/02/1988
45865fgs02/15/1963
87468sdf01/12/2001

FB/80
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Wed Feb 02, 2011 12:59 pm
Reply with quote

Is using cobol part of the requirement, and why?

If you sort the dataset with NODUPKEY keyword (do not have the sort documentation online) duplicate records on the key will be deleted.
Back to top
View user's profile Send private message
venugopal404

New User


Joined: 14 Dec 2010
Posts: 13
Location: hyderabad

PostPosted: Wed Feb 02, 2011 1:06 pm
Reply with quote

Yes,
using cobol is part of the requirement..using JCL, i know how to sort the file.
i just want to know, how can we do it using cobol..
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Wed Feb 02, 2011 1:17 pm
Reply with quote

You have to sort the file in key sequence anyway, read a record, store the key value, compare to that of the previous record, if different write to output, else do nothing, start over with the read.

Is that so difficult?
Back to top
View user's profile Send private message
venugopal404

New User


Joined: 14 Dec 2010
Posts: 13
Location: hyderabad

PostPosted: Wed Feb 02, 2011 2:02 pm
Reply with quote

thank you Kjeld
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Feb 02, 2011 2:23 pm
Reply with quote

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CT10/6.0?DT=20080528173317
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Wed Feb 02, 2011 9:40 pm
Reply with quote

Kjeld wrote:
You have to sort the file in key sequence anyway, read a record, store the key value, compare to that of the previous record, if different write to output, else do nothing, start over with the read.

Is that so difficult?

There is a flaw in my logic above, so I have to correct myself: The compare with the previous record key has to be done before you store the value of the current record in it.
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 -> COBOL Programming

 


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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Duplicate transid's declared using CEDA CICS 3
Search our Forums:

Back to Top