SQL, threadsafe and other programming considerations for CICS DB2 applications
When developing application programs, you must be aware of certain programming considerations in order to improve the performance of your application and avoid potential problems. Whether you use qualified or unqualified SQL influences many other aspects of the CICS® DB2® environment. To gain the performance benefits of the open transaction environment (OTE), your application programs must be threadsafe.
- Enabling CICS DB2 applications to use OTE through threadsafe programming
The CICS DB2 attachment facility includes a CICS DB2 task-related user exit (TRUE), DFHD2EX1, that is invoked when an application program makes an SQL request. It manages the process of acquiring a thread connection into DB2 , and of returning control to the application program when the DB2 processing is complete. - SQL language
The complete SQL language is available to the CICS programmer with only minor restrictions. - Using qualified and unqualified SQL
Programmers writing CICS DB2 programs can use qualified or unqualified SQL. In qualified SQL, the creator is specified in front of the table or view name. In unqualified SQL, the creator is not specified. - Views
It is generally recommended that you use views where appropriate. Note that some views cannot be updated. - Updating index columns
When you update index columns, you must consider two things. - Dependency of unique indexes
A programmer can take advantage of the fact that DB2 returns only one row from a table with a unique index, if the full key is supplied in the SELECT statement. A cursor is not needed in this case. - Commit processing
CICS ignores any EXEC SQL COMMIT statements in your application programs. The DB2 commit must be synchronized with CICS, which means that your program must issue an EXEC CICS SYNCPOINT command. CICS then performs the commit processing with DB2. An implicit SYNCPOINT is always invoked by the EXEC CICS RETURN at end of task. - Serializing transactions
You might need to serialize the execution of one or more transactions. This typically occurs when the application logic was not designed to deal with concurrency and in cases where the risk of deadlocks is high. - Page contention
When designing applications and databases, consider the impact of having many transactions accessing the same part of a table space. The term "hot spot" is often used to describe a small part of the table space, where the access density is significantly higher than the access density for the rest of the table space. - CICS and CURSOR WITH HOLD option
Use CURSOR WITH HOLD in your CICS program to keep the cursor open and in position during a SYNCPOINT. - EXEC CICS RETURN IMMEDIATE command
When the TRANSID option is specified in conjunction with the IMMEDIATE option, CICS avoids sending an end bracket (EB) to the terminal during the termination of the transaction that issued the RETURN command, and immediately initiates the transaction designated by the TRANSID option. The keyboard remains locked during this transaction, because no EB was sent to the terminal. - Avoiding AEY9 abends
An AEY9 abend occurs if an application issues an EXEC SQL command when the CICS DB2 attachment facility has not been enabled.
dfhtk2b.html |
Last updated: Monday, 5 June 2017