Joined: 14 Jan 2008 Posts: 2504 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.