Thursday, December 22, 2011

Difference between empty dataset and DUMMY


Is there any difference in processing, when you use an empty VSAM dataset, and when you DUMMY it out ?    
                         
Apparently,  Yes, there are a few differences :

                        <-------------- FILE STATUS ------------->
                        Open   Start  Readnext  Read  Write  Close
                        ----    ----  -------   ----   ----   ----
1. Non-empty VSAM dataset 00      00    00        23     00     00
2. Empty VSAM dataset     00      23    NA        23     00     00
3. DUMMY                  00      00    10        23     00     00 


Note : A few assumptions have been made here : 
    a. The key with which we read(or write), is NOT available in the non-empty dataset (and is not > the last key in file !) 
       - Hence the START and READNEXT are successful, but READ fails.
    b. READNEXT need NOT be performed if START itself fails
       - Hence the "NA" for the READNEXT of the empty dataset.
    c. The empty VSAM dataset has been primed.
       - Otherwise the OPEN would have failed for it.


Points to Observe :
    A. The Empty dataset returns file status 23 for START (RECORD NOT FOUND), while the dummied out file returns 00.  (This caused a few problems in one of our production jobs. A program performed a START (with full key) on two inactive claim files, to check for DUPLICATE claims (i.e. if START is successful, it means the claim already exists, otherwise if record not found, fine). Initially these datasets were dummied out, so the STARTs on these files returned file status 00 - making the program believe that the claims are already available in the system - hence several claims got reported as duplicates. When the same job was re-run with empty datasets instead, no duplicate was reported, since the START now returned file status 23.)       
                                                                     
    B. Even though the START on the DUMMY file returns file status 00, the READNEXT returns status 10 (END OF FILE), since there is NO record to read !                                               

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.