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 to empty a KSDS vsam file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to empty a KSDS vsam file
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: 2150
Location: At my coffee table

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

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

Moderator Team Head


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

PostPosted: Wed Feb 25, 2009 10:04 pm    Post subject: Reply to: How to empty a KSDS vsam file
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    Post subject:
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

Site Director


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

PostPosted: Thu Feb 26, 2009 2:04 am    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 26, 2009 2:15 am    Post subject: Reply to: How to empty a KSDS vsam file
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: 8119
Location: East Dubuque, Illinois, USA

PostPosted: Thu Feb 26, 2009 2:37 am    Post subject:
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

Site Director


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

PostPosted: Thu Feb 26, 2009 3:36 am    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 26, 2009 3:45 am    Post subject: Reply to: How to empty a KSDS vsam file
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

Site Director


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

PostPosted: Thu Feb 26, 2009 3:55 am    Post subject: Reply to: How to empty a KSDS vsam file
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 26, 2009 5:04 am    Post subject: Reply to: How to empty a KSDS vsam file
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


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