IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

A question on EXEC cics write/delete


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
quanzhong

New User


Joined: 12 Aug 2008
Posts: 46
Location: china

PostPosted: Sat Oct 30, 2010 9:18 am
Reply with quote

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:

EXEC CICS WRITE
DATASET (ACTIVE-FILE)
RIDFLD (FILE-KEY)
FROM (INACTIVE-RECORD)
LENGTH (FILE-LENGTH)
END-EXEC.

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?

please give me you hand

thanks.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Oct 30, 2010 9:27 am
Reply with quote

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

New User


Joined: 12 Aug 2008
Posts: 46
Location: china

PostPosted: Sat Oct 30, 2010 9:53 am
Reply with quote

thanks. robert

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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Oct 30, 2010 12:08 pm
Reply with quote

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!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Oct 31, 2010 12:47 am
Reply with quote

Hello,

Quote:
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.
Robert has already explained how this can happen. . .

One way to prevent this is to convert the vsam to database. . .
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sun Oct 31, 2010 1:11 am
Reply with quote

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.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Using API Gateway from CICS program CICS 0
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top