View previous topic :: View next topic
|
Author |
Message |
subramanianup Warnings : 1 New User
Joined: 18 May 2005 Posts: 46 Location: Bangalore, INDIA
|
|
|
|
How will you delete duplicate records using Cobol Program not by JCL? |
|
Back to top |
|
|
fixdoubts
New User
Joined: 21 Oct 2005 Posts: 54
|
|
|
|
Hi,
usually you have a key with which you say you have duplicate records
in the file.
Compare the key of the previously read record with the key of the presently read record
IF (KEY-PREVIOUS = KEY-PRESENT)
Then you have the duplicate record.. This is true of your file is sorted
else you have to do an internal sort before you read the file.
Regards, |
|
Back to top |
|
|
sbalajibe
New User
Joined: 15 Aug 2005 Posts: 62
|
|
|
|
hi subramanianup,
U Can even do it using sort utility in JCL
thanks
BAlaji |
|
Back to top |
|
|
subramanianup Warnings : 1 New User
Joined: 18 May 2005 Posts: 46 Location: Bangalore, INDIA
|
|
|
|
To Balaji
i know that we can use sort utility, but i need it using cobol program
TO fixdoubts
I think your logic will after sort only, but i dont want to use "Internal Sort ", now think it give me ans.
for example the records like as follows
2522,2656,2616,7445,5656,1212,4545,1212,4545,2522,6655,2656 |
|
Back to top |
|
|
fixdoubts
New User
Joined: 21 Oct 2005 Posts: 54
|
|
|
|
Hi,
If you dont want to do an internal sort then i think you can use a
table.
Some think like
05 Group-I
07 element-key
07 element-flag
First you will read the file and put the key value into the field element-key.
But before you insert the key value you will search for the presence of the key field in the table using a search verb if present will discard...like this you will have distinct keys in the table.
Once you do this you will start with your input file read from the start
and check the table for the presence of the KEY field you read if its present you will set the element-flag.
Like wise now if at all you KEY value come again you will check the element-flag which will be set you will discard the record.
Hope this long msg dont bug. and will be use ful to you.
Regards, |
|
Back to top |
|
|
fawzy47 Currently Banned New User
Joined: 22 Oct 2005 Posts: 42
|
|
|
|
To drop duplicate Use syncsort
define your dataset as you normaly do in jcl
//stepdrp exec pgm=sort
...
//sysin dd *
SORT FIELDS= COPY,EQUALS
SUM FIELDS=NONE
/*
GOOD LUCK
Fawzy |
|
Back to top |
|
|
|