Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 2433
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 Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us