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: 10232
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
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm
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


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