Data operations
CICS supports: v
Emulation of VSAM files v
Browsing v
Logging v
Sequential data set access
Emulating VSAM files
The efficiency of database and file operations is an important factor in the performance of any CICS system.
To minimize contention delays using VSAM emulated files: v
Minimize the time that they are reserved for exclusive use. The
exclusive-use
enqueue is the way CICS and OS/400 prevent concurrent updates. It is held on the record level. The AS/400
® also holds a lock on the file level while the file is opened. The hold for exclusive use ends when either the request is completed, at the next syncpoint, or when the task has completed, depending on whether or not the resource is recoverable. For nonrecoverable files, the exclusive use that starts with an EXEC CICS READ UPDATE command ends when OS/400 data management has completed the EXEC CICS REWRITE command. For recoverable files, the CICS exclusive use ends at either a syncpoint or end of task.
The table shows which requests require exclusive use and when that reservation terminates.
Table 5. Requests that require exclusive use and when the reservation terminates
Command
READ UPDATE
WRITE MASSINSERT
WRITE
DELETE RIDFLD
1
Released by
REWRITE/DELETE/UNLOCK/
SYNCPOINT
Completion of WRITE
Completion of WRITE
Completion of DELETE v
Hold position in an emulated VSAM file for as short a time as possible. The table shows which commands hold position and when the hold is released.
Table 6. Commands that hold position and when the hold is released
Command
READ UPDATE
WRITE MASSINSERT
STARTBR
1
Released by
REWRITE/DELETE/UNLOCK/
SYNCPOINT
Completion of WRITE
ENDBR
1
If a request is made to close a file (using SET
™
FILE), the file is not closed until the task has terminated. For nonrecoverable files, EXEC CICS UNLOCK or EXEC
CICS SYNCPOINT commands also close the file. For recoverable files, only the next EXEC CICS SYNCPOINT command also closes the file.
To minimize processor overhead in emulated VSAM files:
Chapter 5. Designing efficient applications
75
v
Minimize the number of
open files
within a CICS shell. CICS opens files within each CICS shell when they are first referred to. Open processing on the iSeries is a relatively expensive operation in terms of processor resources and system storage requirements. CICS attempts to optimize the open processing by keeping files opened across task completion boundaries on the probability that a subsequent task will access the same file. The programmer should be aware that too many opened files may cause excessive demand of system storage and increase page faults. v
Ideally, you would want CICS to have the files used by an application already opened. However, if your users are executing a mixture of applications that access a multitude of files, you can reduce the number of files that CICS keeps open across tasks with the FILECTL system initialization parameter. v
Use
skip-sequential
processing if you are reading many nonadjacent records in sequence. (Skip-sequential processing begins with an EXEC CICS STARTBR command. Each record is retrieved with an EXEC CICS READNEXT command, but the key feedback area pointed to by the RIDFLD option is supplied with the key of the next requested record before the EXEC CICS READNEXT command is issued.) v
Use the GENERIC option on the EXEC CICS DELETE command when deleting a group of records in a KSDS whose keys start with a common character string.
CICS internally optimizes an EXEC CICS DELETE GENERIC command.
Browsing files
CICS provides the ability to browse emulated VSAM files in an optimized manner that is very efficient. You should use the browse function when you are reading records sequentially.
Logging files
Both CICS and OS/400 provide options to log activity using either CICS journal control facilities or OS/400 journals against a file. Logging using CICS journal control facilities enables you to use the logged file for postprocessing, or you may want to log reads for security reasons. OS/400 journals are primarily used by
OS/400 commitment control during syncpoint processing, thus providing data integrity for the file. You have to balance the need for postprocessing, security and data integrity, against the overhead of user journaling.
Sequential file access
CICS provides a number of different sequential processing options. Temporary
storage and intrapartition transient data queues (already discussed in “Temporary storage” on page 73 and in “Intrapartition transient data” on page 74) are the most
efficient to use, but they must be created and processed entirely within CICS. The following methods apply to sequential files that must be processed
externally
to
CICS: v
Extrapartition transient data v VSAM entry-sequenced files v
Journals
Extrapartition transient data is the CICS way of handling standard sequential files.
It is the least efficient of the three forms of sequential support listed, because CICS has to synchronize access to the files. Moreover, extrapartition transient files are not recoverable.
76
CICS for iSeries Application Programming Guide V5