Search code examples
db2mainframecicsvsam

Browsing VSAM files and DB2 tables using TSQ


I'm finding better ways on browsing VSAM records and DB2 tables in CICS. The current one I'm practicing is by using readnext/prev for browsing VSAM files and using cursors to browse DB2 tables. How can I utilize TSQ when I do browsing of files/tables? My sample application both have features of writing to VSAM file/inserting to DB2 table and browsing them as well.


Solution

  • Like what if i'm browsing the vsam file/db2 table while others are writing to vsam/inserting to db2 tables. Will the newly added records appear while i'm browsing at the same time?

    It depends. From a VSAM point of view, your CICS task will hold a position in the VSAM file. You may not be able to see newly inserted records until they have been committed by their originating task. And your ability to see inserted records will depend on how your task and the other task are accessing the VSAM file. As long as all CICS access takes place in a single CICS region either a stand-alone region or in a File-Owning Region (aka FOR), then any CICS task accessing the file will be able to see committed new records.

    If tasks are running in multiple CICS regions without using an FOR, then the file needs to be opened in RLS mode in all the regions to preserve integrity of the file contents.

    Batch updates/insertions to non-RLS files can cause similar problems as trying to update non-RLS files from two CICS regions.