--------------------------------------------<snip>--------------------------------------
Is there a standard z/OS tool to "initialize" a VSAM file?
----------------------------------------<unsnip>---------------------------------------
No.
------------------------------------<snip>-----------------------------------------
There are a few reasons I want to do this.
One is when reloading an IMS database the index portion of the database
(which is a VSAM ESDS) must be empty (initialized). If it is not I get
something like this:
DFS0730I UNABLE TO OPEN DATA SET WITH DDNAME FFUNDIN FOR REASON
I,30,DATABASE FFUNDIN PSB FFUNDDB IVP3
where "I,30 "
An attempt was made to open a VSAM data set associated with a PCB which
has processing option L and the data set is not empty.
Programmer response: If the old data set is to be scratched, delete it
using the VSAM AMS program. If the data set is not to be scratched, use
a PCB with processing option other than L."
It seems to me there is no point using AMS to do a DELETE/DEFINE. I can
just initialize the database.
--------------------------------<unsnip>-------------------------------------
You're mixing your terms somewhat. :-) If the cluster is defined with
the REUSE attribute, all you need to do is OPEN and CLOSE it using an
ACB that also specifies REUSE. ESDS clusters have no index.
---------------------------------------<snip>--------------------------------------------
For now I've been using IDCAMS REPRO from a DUMMY dataset. This works
fine, but for whatever reason it bugs me. There should be something to
just open the file (for reuse) and then close it. So I came up with this:
INITVSAM START 0
BEGIN SAVE (14,12)
BALR 3,0
USING *,3
OPEN FILE1
LTR 15,15
BNZ DUMP
B CLOSE
DUMP ABEND 1234,REASON=99,DUMP
CLOSE CLOSE FILE1
LTR 15,15
BNZ DUMP
RETURN (14,12),RC=0
FILE1 ACB MACRF=(CNV,OUT,RST)
RPL1 RPL ACB=FILE1
END BEGIN
Warning! I am not really an assembler programmer. But it is simple
enough and seems to do the trick. Can anyone see anything wrong with
this or see any reason why I shouldn't do this? What do others usually
do to empty/initialize a file? Or do you generally just not do this? We
have a lot of VSE JCL where we use a utility called Doctor.D to
initialize files. But I'm not sure as to the various reasons why we are
initializing the files. I think sometimes we process a file and then
initialize it so that it's empty if we try to process it again before
it's properly "rebuilt" (by a program or usually an FTP) the next
processing day.
Anyway, any thoughts are welcome.
Frank
------------------------------------------------<unsnip>------------------------------------------
What you have here is perfectly acceptable and I've used similar
programs in the past for exactly that purpose, although I notice you've
deleted some of the ACB parms, like a DDNAME. Check your ACB operands
very carefully, code only what's absolutely necessary and you should be
fine. I'm not sure you need CNV in the MACRF, but OUT and RST will do
the trick. You don't need a RPL 'cuz you're not doing any I/O to the
dataset. I used to have a program to do exactly what you need; if you
contact me off-list, I'll look around and see if I still have it. If so;
you're welcome to a copy.
--
Rick
--
Remember that if you’re not the lead dog, the view never changes.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html