View previous topic :: View next topic
|
Author |
Message |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
Hi,
Can program PGM1 read (INPUT mode) a file (KSDS) while PGM2 has opened it to update (OUTPUT mode), in CICS environment?
I am working on file handling options (locks e.g exclusive) and want to know if above is allowed.
Thanks for reading and reply.
Cheers!
zh_lad |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Are PGM1 and PGM2 both running in CICS? |
|
Back to top |
|
|
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
Yes. Both are running in CICS. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
As opposed to Batch, files are Opened by CICS either at Startup and/or First Reference.
Depending on the "Operations" settings in the RDO Entry (FCT), this will dictate what can be done to the file. These settings are ADD, BROWSE, DELETE, READ and UPDATE and can also been viewed via a CEMT INQ FILE.
So, PGM2 needs to be able to handle a DUPLICATE KEY condition (if you're writing a new record) but more importantly, PGM2 must read the target record for UPDATE and issue either an immediate REWRITE, DELETE or UNLOCK when the function is other than WRITE.
A Read for UPDATE locks the CI where this record (and other records) are found on the file. So, the bigger the CI, the larger the number of records potentially locked-out on a Read for UPDATE. You would NOT want to hold this UPDATE very long, because other tasks may need a different record located in this same CI, so quick processing of the given record is essential.
If PGM2 is going to issue a DELETE, I would strongly advise that you issue a Read for UPDATE, followed by the DELETE. Don't cut corners by issuing a DELETE without the Read for UPDATE. This could come back to haunt you.
HTH....
Bill |
|
Back to top |
|
|
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
Thanks for your reply and enlighting on Read for update and DELETE.
What will happend when PGM1 tries to read same record which is being updated/written by PGM2?
Many thanks. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
What will happend when PGM1 tries to read same record which is being updated/written by PGM2? |
CICS enforces queueing -- so PGM1 will wait until the updates from PGM2 are complete. |
|
Back to top |
|
|
|