Page 1 of 1

Inserting new record into VSAM Backup File

PostPosted: Fri Apr 27, 2012 12:32 pm
by Sivapradeep
Hi,

I took backup of VSAM KSDS file into PS file using IDCAMS EXPORT utility. Now, i edited already existing record and saved this PS file and used IDCAMS IMPORT utility to restore the original KSDS file. the edited record has restored without any error.
but when i tried to insert a new record into the backup PS file and during restoration using IDCAMS IMPORT i'm getting an error.(snapshot shown below).
 ACTION ERROR ON E183904.JUN11LC.KSDS                       
** VSAM I/O RETURN CODE IS 108 - RPLFDBWD = X'8408006C'     
 IMPORT OF DATA SET FAILED AFTER DEFINE - DELETE ATTEMPTED   


what changes i should do to restore this backup ps file with new inserted record?

Re: Inserting new record into VSAM Backup File

PostPosted: Fri Apr 27, 2012 1:02 pm
by BillyBoyo
Why would you ever want to change a back-up? At that point, it stops being a back-up and you have no back-up.

Re: Inserting new record into VSAM Backup File

PostPosted: Fri Apr 27, 2012 2:32 pm
by Sivapradeep
Ya I knew this and u r rite. But I've to create new records in the ps file and build vsam based on this new records. Can you give the procedure for implementing this idea ?

Re: Inserting new record into VSAM Backup File

PostPosted: Fri Apr 27, 2012 3:09 pm
by BillyBoyo
Make sure you have an "untouched" backup of the VSAM file.

Just copy your VSAM using a program (SORT, IDCAMS with REPRO, for instance) to an actual PS. Edit. Do the reverse direction.

You might want to delete/define before going in the other direction.

If you go in an edit a structured back-up file, you won't be able to use it for anything.

Re: Inserting new record into VSAM Backup File

PostPosted: Fri Apr 27, 2012 6:21 pm
by Robert Sample
EXPORT saves the index informatino as well as the data information for the VSAM KSDS -- this is why you don't have to use DEFINE before an IMPORT. Changing an existing record won't impact the index information (unless, of course, you change the record length in which all bets are off). However, adding (or deleting) a record will change the index information and hence render the exproted file unusable as the index cannot be used any longer to rebuild the KSDS file.

If you want to modify (by adding to or deleling records from) the "backup" (and I use that word very cautiously since if you making changes to the output file and not the KSDS file, then you no longer have a "backup" file at all) then you MUST use REPRO to build a sequential file and then use DELETE / DEFINE to build the KSDS definnition anew before loading the data back again. Unless, of course, you spend the time to figure out the hexadecimal values that you must change to incorporate the changed index information in the exported file -- and don't forget that VSAM compresses the index keys so the process requires you to ALSO know how to rebuild compressed keys. And depending upon the specific changes, you might have to add a new level of index to the exported file, and so forth.

In other words, attempting to change an exported file the way you are doing is an EXTREMELY BAD idea for many, many, many reasons.