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

How to delete a duplicate row in a flat file


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

New User


Joined: 06 Oct 2007
Posts: 32
Location: India

PostPosted: Thu Jan 17, 2008 4:27 pm
Reply with quote

Hi,
How to delete a duplicate row in a flat file?Is it possible?


Thanks & Regards
icon_smile.gif

[/b]
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Jan 17, 2008 5:33 pm
Reply with quote

you should create a new file with those records omitted.
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Thu Jan 17, 2008 5:43 pm
Reply with quote

icon_eek.gif

If u checked the forums, u might have found out that u can use a simple sort card to achieve this...


Quote:
you should create a new file with those records omitted.

but what does this mean??

icon_exclaim.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Jan 17, 2008 5:48 pm
Reply with quote

It means keep the original input and create a new output, do not over write the original input file.
Back to top
View user's profile Send private message
ousep143

New User


Joined: 06 Oct 2007
Posts: 32
Location: India

PostPosted: Thu Jan 17, 2008 5:52 pm
Reply with quote

Hi raak,

I want to know,how to delete duplicate record in a flat file or how to compare two records?

Regards
icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jan 17, 2008 5:52 pm
Reply with quote

Acevedo' s reply simply meant that for flat (wrong term anyway) aka PS files
it is not possible to delete/insert records in place

do not confuse things when in the Ispf environment,... when editing a PS file
ISPF will just bring all the records in memory and afterwards ( at save time )
it will open the dataset in output and write out all the records
Back to top
View user's profile Send private message
ousep143

New User


Joined: 06 Oct 2007
Posts: 32
Location: India

PostPosted: Thu Jan 17, 2008 6:00 pm
Reply with quote

hi enrico,

Is it possible to findout duplicate rows in a PS file.

Regards
icon_smile.gif
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Jan 17, 2008 6:02 pm
Reply with quote

expat and enricho assumptions are correct, of course.

ousep143
1-read the posts about delete a PS file.
2-compare... that's another question.

this post is in the Cobol forum...maybe you shoud try a search in the DFSORT/ICETOOL forum.

;)
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Thu Jan 17, 2008 6:03 pm
Reply with quote

Just curious...

the original question was

Quote:
How to delete a duplicate row in a flat file?Is it possible?


If I give a SUM FIELDS=NONE on this file and give the same file as output,
the duplicates should get eliminated.

Why should I require a new file for that??

Quote:
do not over write the original input file


why is this so?? Is it because in case any problem happens, there is a chance of the input records getting corrupted??
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Jan 17, 2008 6:07 pm
Reply with quote

IMNHO... we should know if this has to be done in Cobol or not.

IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Jan 17, 2008 6:14 pm
Reply with quote

Quote:
Is it because in case any problem happens, there is a chance of the input records getting corrupted??


exactly that, when auditing operating standards and procedures, You cannot imagine
how many shops I have found using this WRONG/FOOLISH approach,
there is no saving in that,
and in one case after having been forced to carry on an in depth analysis
they found the duplicate records were the consequence of
a wrong design ( missing data checking ) and faulty programming
and they were even complaining about 12 hours rerun because of that
Back to top
View user's profile Send private message
ousep143

New User


Joined: 06 Oct 2007
Posts: 32
Location: India

PostPosted: Fri Jan 18, 2008 10:33 am
Reply with quote

Hi everybody,
Thanks for information.

Regards
icon_smile.gif
Back to top
View user's profile Send private message
mnnarayankar

New User


Joined: 21 Jan 2008
Posts: 23
Location: bangalore

PostPosted: Thu Jan 24, 2008 3:15 pm
Reply with quote

nice questions.

One answer is this 1st load u r PS file into KSDS vsam dataset. using COBOL pgm or using REPRO command. VSAM KSDS allow to write only unique records with help of key. Once all unique data u get then unload VSAM file into PS file.
Back to top
View user's profile Send private message
mnnarayankar

New User


Joined: 21 Jan 2008
Posts: 23
Location: bangalore

PostPosted: Thu Jan 24, 2008 3:37 pm
Reply with quote

use SORT utilities to elinminates the duplicate within a file

Syntax : Sort fields = (starting pos,length,type,asc/desc),EQUALS
Sum fields = none.

use INDD, OUTDD, and SORTWORK

starting position : anything but integer value.
length : Length mean total no of character from 1st character.
type means : ZD,PD,BI,CH

if EQUALS is coded then records to be written is the first record else it can be anything..
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts DELETE SPUFI DB2 1
Search our Forums:

Back to Top