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
 

 

how to elliminate duplicates in cobol?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
vaibhavjadhav

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Tue Oct 23, 2007 2:06 pm    Post subject: how to elliminate duplicates in cobol?
Reply with quote

hi,

can you please tell me how to elliminate the duplicates in a cobol without using any utility.

please provide me with a brief solution.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10257
Location: italy

PostPosted: Tue Oct 23, 2007 2:23 pm    Post subject: Reply to: how to elliminate duplicates in cobol?
Reply with quote

I guess that the question was asked in the wrong forum !

if the forum is the right one why not use sort

otherwise :
first of all You need to have the records sorted in key order

here is the pseudocode for the main logic:
Code:

( the key could be built from non contiguous fields )
initialize the previous key to low values
do until the end of the input file
   read a record
   build the current key
   if the current key is different from to the previous key then
      write the record
      move the current key to the previous key
   end if
end do
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Oct 23, 2007 2:26 pm    Post subject:
Reply with quote

vaibhavjadhav

1. SORT file based on the KEY
2. Start reading the file,
if the previous KEY is equal to current KEY then don't write to the o/p file;
else write to the o/p file.
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
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 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 COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


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