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 will you delete duplicate records using Cobol Pgm?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How will you delete duplicate records using Cobol Pgm?
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Re: How will you delete duplicate records using Cobol Pgm?
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming 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. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am


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