Posted: Wed Aug 11, 2004 1:30 pm Post subject: Update/Delete VSAM recs, or just Delete/Define/Repro?
I have a pretty small VSAM file to maintain - about 3,000 to 5,000 records, about 150 bytes per record, with one primary key that's 22 bytes long.
The file is updated monthly. Updates include the following:
1. Deleting records that are more than 1 year old (based on a date field on each record)
2. Storing new records from a transaction work file read in (i.e., if the key from the work file is not already on the file, store a new record with that key).
There is no "update existing record" logic involved: Records are add, deleted, or left alone.
Part of this is my inexperience with VSAM, I admit. How hard is it to insert and delete records in a VSAM file?
Currently, I'm toying with this alternative:
1. Read the whole VSAM file, excluding the records I want to delete, and write the reset out to a flat file.
2. Read the input DSN, check if the record already exists on the VSAM file, and write out the records to the same flat file as in Step 1.
3. Sort the whole thing by the VSAM key with SyncSort.
4. Use IDCAMS to Delete, then Repro, the flat file into the VSAM file.
A few things I'm not sure about:
1. Will a REPRO to a VSAM file overaly the entire contents, and if not,
2. Do I need to delete the whole cluster, and then redefine it before the REPRO?
Again, maybe I'm just being a chicken about adding/deleting records from the VSAM file. But I have a feeling that maybe the file (or at least the key) could get fragmented over time and less efficient to use. Just overlaying the whole thing seems like it would re-org the file as well, and keep it "clean."
The file will never really grow past its current size. The Delete/Define/Repro process from a flat file takes only seconds, and the process runs monthly; so efficiency doesn't seem to be an issue.
What do you all think? I'd be very grateful to hear from some "old hands" with lots of VSAM/IDCAMS experience.
Thanks, kolusu! I think I'll go with the traditional route.
But I'm still wondering: Will the REPRO step overlay the entire VSAM file contents, or does it append? In other words, do I need to first delete the entire file before doing the REPRO step?
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
Posted: Thu Aug 12, 2004 2:21 pm Post subject:
I am not sure about this question.
But, I think, you may also need to look into your VSAM definition and see if it is defined with REUSE or NOREUSE; apart from DISP parameter. _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Here is some text on REUSE, that may be of some help:
The REUSE parameter
The REUSE parameter specifies that the cluster can be opened a second time as a reusable cluster. NOREUSE is the default, and specifies the cluster as nonreusable
Format : REUSE|NOREUSE
Some application call for temporary dataset or workfile that must be created, used and deleted each time the application run. To simplify these applications, VSAM lets you create reusable files.
REPRO is used for the following purposes:
1.Loads empty VSAM cluster with records.
2.Creates backup of a dataset
3.Merges data from two datasets (REPLACE)
Regarding DELETE/DEFINE/REPRO Sequence the following advantages lie with it:
DELETE-DEFINE-REPRO sequence required to restore the cluster incase of KSDS, CI & CA splits are eliminated, Primary index is rebuild,freespace redistributed. Alternate Indexes to be redefined
The System I am currently working with has more than 200 VSAM Files, By executing a Project early this year that Deletes/Defines/Repros all the MASTER VSAM Files we have saved around $22k Yearly Processing Cost. So as Kolusu said the "The Traditional Method" has its benifits.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum