Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to delete a duplicate row in a flat file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to delete a duplicate row in a flat file
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    Post subject:
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    Post subject: Reply to: Delete duplicate row ...
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: 8614
Location: Back in jolly old England

PostPosted: Thu Jan 17, 2008 5:48 pm    Post subject:
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    Post subject: Re: Reply to: Delete duplicate row ...
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10373
Location: italy

PostPosted: Thu Jan 17, 2008 5:52 pm    Post subject: Reply to: Delete duplicate row ...
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    Post subject: Re: Reply to: Delete duplicate row ...
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    Post subject:
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    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10373
Location: italy

PostPosted: Thu Jan 17, 2008 6:14 pm    Post subject: Reply to: Delete duplicate row ...
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    Post subject: Re: Reply to: Delete duplicate row ...
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: 24
Location: bangalore

PostPosted: Thu Jan 24, 2008 3:15 pm    Post subject:
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: 24
Location: bangalore

PostPosted: Thu Jan 24, 2008 3:37 pm    Post subject: yes using SORT Utilities
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    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
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us