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: 10211
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. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


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