there is two vsam file, seperately to store inactive accounts (inactive-file) and active accounts (active-file), when using read-random-update method to access an accounts, the program first to read the active-file, if not found, then to read inactive-file, if found it in inactive-file, the program will migrate that record from inactive-file to active-file, the code is:
first, write active file:
if write successfully, then delete the accout from inactive-file:
EXEC CICS DELETE
DATASET (INACTIVE-FILE)
END-EXEC.
Now I meet a problem, I have an accouts list, about 10 million, to random read the two account file (this is done via batch, not CICS, and this will not migrate account from inactive-file to active-file), to determine whether the account really exists in our system. my solution is to read inactive-file first, if not found, to read active-file, if still not found, then print it to the error file, accounts in error file means the accounts not really exist in our system. but when i check the error file, I found some accounts in it still can be locate in our system, which means there's some wrong with logic, but I am sure it is the general solution (if an account exist in our system, it must be in inactive-file or active-file, when it is not found in inactive-file, then it must be migrated to active-file)
now I am focus on the mechanism of exec cics write/delete, i want to know, when write/delete a record, it is to update buffer first, then file, or update file immediately?
the secord is, as VSAM has Index and DATA, when write/delete, it update INDEX first, or DATA first?
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
Quote:
when write/delete a record, it is to update buffer first, then file, or update file immediately?
CICS updates in the buffer -- just like the rest of MVS -- and then applies the change(s) to the file. Depending upon the amount of file activity, and how the file buffering is set up in CICS, it could be anywhere from a few seconds to many hours between the time the file change is made by the program and the time the change is actually applied to the VSAM file.
Quote:
the secord is, as VSAM has Index and DATA, when write/delete, it update INDEX first, or DATA first?
I have no idea and have no idea why you would think this important enough to ask about. This may be a case where only IBM could tell you the answer, and there's no reason for IBM to tell you this since such internal matters could change at any time.
can you also help to expain why some record not found when I am trying random read during batch proceesing, and how to prevent this situation. (I can't close these two online files, and can't stop the migrate process).
concurrent access ( batch/cics/whatsoever) to files being updated is prone to give inconsistent results...
You and Your storage support should take some time to meditate on the
SHAREOPTIONS attributes and the caveats for the different values
what You are experiencing is due to a poor understanding of the above!
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
Your solution choices are three:
1. Convert to a database as Dick suggested.
2. Change the SHROPTIONS and add queueing to your CICS and batch programs. Note that this requires using an Assembler program to handle the batch enqueue / dequeue logic as COBOL does not have anything built in to do so. You may also find a vendor program that can be purchased to handle the enqueue / dequeue logic -- but that requires purchase and most mainframe products cost tens of thousands (or more) of dollars.
3. Give up on the idea of simultaneous CICS and batch updates to the VSAM file and redesign your system to not do so. In most cases, this is the best option to go with.