IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How will you delete duplicate records using Cobol Pgm?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
subramanianup
Warnings : 1

New User


Joined: 18 May 2005
Posts: 46
Location: Bangalore, INDIA

PostPosted: Fri Feb 10, 2006 1:05 pm
Reply with quote

How will you delete duplicate records using Cobol Program not by JCL?
Back to top
View user's profile Send private message
fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Fri Feb 10, 2006 2:15 pm
Reply with quote

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
View user's profile Send private message
sbalajibe

New User


Joined: 15 Aug 2005
Posts: 62

PostPosted: Fri Feb 10, 2006 3:03 pm
Reply with quote

hi subramanianup,

U Can even do it using sort utility in JCL



thanks
BAlaji
Back to top
View user's profile Send private message
subramanianup
Warnings : 1

New User


Joined: 18 May 2005
Posts: 46
Location: Bangalore, INDIA

PostPosted: Fri Feb 10, 2006 4:05 pm
Reply with quote

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
View user's profile Send private message
fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Fri Feb 10, 2006 4:20 pm
Reply with quote

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
View user's profile Send private message
fawzy47
Currently Banned

New User


Joined: 22 Oct 2005
Posts: 42

PostPosted: Sun Feb 19, 2006 8:58 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts DELETE SPUFI DB2 1
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
Search our Forums:

Back to Top