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

How to empty a KSDS vsam file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sri_code

New User


Joined: 20 Nov 2006
Posts: 19
Location: india

PostPosted: Wed Feb 25, 2009 9:37 pm
Reply with quote

Hi All,

My program processes an empty VSAM, so i want to empty the vsam file before giving input to the program

i tried to copy DUMMY using REPRO, buts its not deleting the records.
Is there any way i can empty the file (i.e. deleting all the existing records)

Thanks,
Srini..
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Feb 25, 2009 9:55 pm
Reply with quote

The fastest way would be an IDCAMS delete/define......
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Feb 25, 2009 10:04 pm
Reply with quote

Or using DFSORT as shown here in this previous topic.
Back to top
View user's profile Send private message
sri_code

New User


Joined: 20 Nov 2006
Posts: 19
Location: india

PostPosted: Thu Feb 26, 2009 12:49 am
Reply with quote

Thank you SuperK.... actually according to my requirement i cant delete/define the vsam.... SORT is definately handy

but i want to know why REPRO with DUMMY did not work....

Is there any way in COBOL with which we can delete all records from KSDS in 1 statement rather than deleting each record at a time?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 26, 2009 2:04 am
Reply with quote

Hello,

Quote:
actually according to my requirement i cant delete/define the vsam....
Surely not a business requirement. . . Is there some reason for this other than "somebody said so"?

Quote:
but i want to know why REPRO with DUMMY did not work....
It is not supposed to work that way. . . IDCAMS DELETE/DEFINE does what you want, not REPRO.

Quote:
Is there any way in COBOL with which we can delete all records from KSDS in 1
Not that i've seen.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 26, 2009 2:15 am
Reply with quote

If the VSAM file (Cluster) is defined using the REUSE keyword, then COBOL can clear the file if the program opens it as OUTPUT.

Regards,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Feb 26, 2009 2:37 am
Reply with quote

REPRO will not remove records from a VSAM file, just add them. It can be used to clear out a flat file, but not a VSAM file.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 26, 2009 3:36 am
Reply with quote

Hello,

I believe i'm muddled. . . icon_confused.gif

Quote:
Is there any way in COBOL with which we can delete all records from KSDS in 1 statement

Quote:
then COBOL can clear the file if the program opens it as OUTPUT

Would the OPEN alone empty the file?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 26, 2009 3:45 am
Reply with quote

Dick,

Yes, effectively the Base Cluster is initialised to binary zeros.

The only difference between this method and a new VSAM Delete/Define is the High-RBA in the catalog will be Non-Zero, providing the file had at least one record written to it.

Regards,
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 26, 2009 3:55 am
Reply with quote

Hi Bill,

Thanks icon_smile.gif

My experience with vsam (limited though it is, as we went to database before vsam replaced isam) has been that once they have data in them, they keep data in them. . .

d
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 26, 2009 5:04 am
Reply with quote

To reiterate, the VSAM file (Cluster) would have had to be defined using the REUSE keyword.

If COBOL attempts to OPEN OUTPUT, a newly created VSAM file (no records have be written yet, regardless whether the file was defined using REUSE or NOREUSE --- High-RBA is ZERO), the file-status returned with be '35'.

However, if COBOL attempts to OPEN OUTPUT, a previously created VSAM file, defined using REUSE and at least one record had been previously written, then the file-status returned will be '00'. If this same non-empty file had been defined as NOREUSE, the file status returned will be a non-zero value (probably a '90' something).

Regards,
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top