MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Update/Delete VSAM recs, or just Delete/Define/Repro?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
gkreth
Beginner


Joined: 28 May 2004
Posts: 29
Topics: 10

PostPosted: Wed Aug 11, 2004 1:30 pm    Post subject: Update/Delete VSAM recs, or just Delete/Define/Repro? Reply with quote

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!

--Greg
    Back to top
    View user's profile Send private message
    kolusu
    Site Admin
    Site Admin


    Joined: 26 Nov 2002
    Posts: 12378
    Topics: 75
    Location: San Jose

    PostPosted: Wed Aug 11, 2004 2:05 pm    Post subject: Reply with quote

    Greg,

    check this link which discusses vsam record manipulations.

    http://www.mvsforums.com/helpboards/viewtopic.php?t=2014&highlight=vsam+add

    If you want a traditional solution , then go with Delete/Define/Repro process

    Hope this helps...

    Cheers

    Kolusu
    _________________
    Kolusu
    www.linkedin.com/in/kolusu
    Back to top
    View user's profile Send private message Send e-mail Visit poster's website
    gkreth
    Beginner


    Joined: 28 May 2004
    Posts: 29
    Topics: 10

    PostPosted: Thu Aug 12, 2004 9:44 am    Post subject: Reply with quote

    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?

    Thanks for your help.

    --Greg
    Back to top
    View user's profile Send private message
    Cogito-Ergo-Sum
    Advanced


    Joined: 15 Dec 2002
    Posts: 637
    Topics: 43
    Location: Bengaluru, INDIA

    PostPosted: Thu Aug 12, 2004 2:21 pm    Post subject: Reply with quote

    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.
    Back to top
    View user's profile Send private message
    ritam_biswas
    Beginner


    Joined: 29 May 2004
    Posts: 2
    Topics: 0

    PostPosted: Wed Aug 18, 2004 3:42 pm    Post subject: Reply with quote

    Hi Greg/Cogito-Ergo-Sum,

    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.

    Thanks,
    Ritam.
    Back to top
    View user's profile Send private message
    Display posts from previous:   
    Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
    Page 1 of 1

     
    Jump to:  
    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


    MVSFORUMS
    Powered by phpBB © 2001, 2005 phpBB Group