Frank, Agreed, it would be nice, but there is no such function.
Your program needs a couple of additions to work. You'll need to set up a standard save area and you need to do a PUT to add a record and an ERASE to delete it. Tom Harper Neon Enterprise Software Sugar Land, TX ----- Original Message ----- From: IBM Mainframe Discussion List <[email protected]> To: [email protected] <[email protected]> Sent: Wed Mar 25 18:46:58 2009 Subject: initialize (reset) file Is there a standard z/OS tool to "initialize" a VSAM file? 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. 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 ---------------------------------------------------------------------- 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

