View previous topic :: View next topic
|
Author |
Message |
vaibhavjadhav
New User
Joined: 27 Jul 2007 Posts: 33 Location: mumbai
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
|