View previous topic :: View next topic
|
Author |
Message |
sri_code
New User
Joined: 20 Nov 2006 Posts: 19 Location: india
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
The fastest way would be an IDCAMS delete/define...... |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
Back to top |
|
|
sri_code
New User
Joined: 20 Nov 2006 Posts: 19 Location: india
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe i'm muddled. . .
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Bill,
Thanks
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
|