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
 
deleting duplicate records in dataset using cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: deleting duplicate records in dataset using cobol
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

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

Global Moderator


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

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

http://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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to display offset thru cobol prog... tvinodkumar7 CICS 2 Sun Apr 22, 2018 8:42 pm
No new posts Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm
No new posts COBOL MVS options BiswajitDG COBOL Programming 8 Fri Apr 06, 2018 12:35 am

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