Obtaining program isolation and lock traces
In an IMS DB/DC or DBCTL environment, you can detect contention for a database segment by examining the output produced by the Program Isolation Trace Report utility (DFSPIRP0).
To get the source data for the utility, issue the /TRACE SET ON PI OPTION ALL command. To stop gathering source data, issue the /TRACE SET OFF PI command. A control statement for the utility can select a start or stop time relative to a specified date.
Tracing the program isolation function can create additional log records. These records contain the enqueue or dequeue requests issued by the program isolation function between sync points as a result of database updates, checkpoints, and message handling events.
The Program Isolation Trace Report utility reports only those events that require wait time. The report identifies the data management block (DMB) name, database control block (DCB) number, the relative byte address (RBA), the program specification block (PSB) name, and the transaction code. The utility sorts all activity by RBA number (shown as ID in the report). The report lists elapsed times for enqueues that required a wait during the trace interval, and totals the number of enqueues for each ID, DCB, and DMB. The requesting PSB or transaction is considered the holding PSB or transaction of the next enqueue waiting for the same segment. A sample report is shown in the following example. In this report, no elapsed wait time is recorded for Fast Path.
P R O G R A M I S O L A T I O N T R A C E R E P O R T PAGE 1
DATE: 08/10/04
TIME: 16:36 TO 16:37
DCB *** REQUESTING *** ELAPSED **** HOLDING *** ID TOTAL DCB TOTAL DMB TOTAL
DMB NAME NUM ID TRAN AND PSB NAMES TIME TIME TRAN AND PSB NAMES ENQ'S ENQ'S ENQ'S
TABLEDBQ 1 0022D020 DE1Q PROGDE1Q 16:36:54 0:00.061 DE2Q PROGDE2Q
1
003BE00C DE2Q PROGDE2Q 16:36:51 0:00.027 DE1Q PROGDE1Q
1
007D901C DE2Q PROGDE2Q 16:36:34 0:00.036 DE1Q PROGDE1Q
1
008EF014 DE2Q PROGDE2Q 16:36:49 0:00.038 DE1Q PROGDE1Q
1
0090401C DE1Q PROGDE1Q 16:36:50 0:00.072 DE2Q PROGDE2Q
1
00A06010 DE2Q PROGDE2Q 16:36:38 0:00.046 DE1Q PROGDE1Q
1
00A1401C DE1Q PROGDE1Q 16:36:50 0:00.008 DE2Q PROGDE2Q
1 7 7
TABLEDBR 1 002A901C DE2R PROGDE2R 16:36:40 0:00.034 DE1R PROGDE1R
1
0045801C DE2R PROGDE2R 16:36:41 0:00.043 DE1R PROGDE1R
1
0072F024 DE1R PROGDE1R 16:36:30 0:00.053 DE2R PROGDE2R
You can use the File Select and Formatting Print utility to select and print trace table and PI entries in the log records in the following ways:
- Specify an OPTION statement with the PRINT parameter and COND=E and EXITR=DFSERA40 keyword parameters. The output is a report containing the program isolation (PI) trace records formatted in sequential order.
- Select only the log records that contain the trace using the IMS Trace Table Record Format and
Print module (DFSERA60), which is an exit routine that receives type
X'67FA' log records from the File Select and Formatting Print utility
and formats the records on the SYSPRINT data set.
Specify an OPTION statement with the PRINT parameter and COND=E and EXITR=DFSERA60 keyword parameters. The output is a report containing the PI trace entries, the DL/I trace entries, and the lock trace entries formatted to show these entries in sequential order. For an explanation of the headings, see an assembly listing of the macro IDLIVSAM TRACENT.
You can use an output report from the IMS Trace Table Record Format and Print module to find out more information about:
- The level of control (LEV) column shows read only, share, exclusive control, and single update activity.
- The return code (RC) column shows return codes from DFSFXC10 or the IRLM. You can determine whether the caller had to wait for the requested resource, or if the transaction caused a deadlock situation.
- The PST post code (PC) column shows the cause of the wait. If the entry is X'60', a deadlock occurred.
You can reduce the number of records examined by specifying an additional OPTION statement to the File Select and Formatting Print utility so that only records confirming deadlock are printed.
IMS automatically resolves deadlock situations by using dynamic backout. But the detection of deadlocks is important so that you can modify your application design to prevent future deadlocks.
The advantage of the Program Isolation Trace Report is that it shows where contention for a particular segment or range of segments occurs. The report also shows which transactions are competing within a database. It also shows high wait times that might explain a delay in response time. One way to handle the segment contention might be change the database design to separate some of the fields into an additional segment type.