Log analysis (database related)

The IMS log is one of the most useful of all IMS service aids. Understanding log records and what information they contain can be very beneficial.

Log record analysis

For all changes, write a copy of the segment before it is changed as well as a copy of the segment after it is changed, if applicable. This process not only facilitates backout and recovery, but it also is useful for diagnosis.

Analyzing log records is helpful whenever you suspect bad data or a pointer problem. Determine where the error is by referring to error messages or to the contents of the dump. When you identify the location of the problem, use the File Select and Formatting utility (DFSERA10) to print the log records for the block in error. Refer to the following table to interpret the contents of the log records. You can determine what changes to the data have been made, and in what sequence the changes were made. This information is helpful in identifying the source of the error.

Sometimes, the error is caused by an internal IMS problem; other times, the error results from incorrect data that is entered by a user or by an application.

To obtain a complete listing of all control blocks, DB, DC, and log records, assemble module DFSADSCT.

CICS® puts a header on log records. To obtain the log records when running with CICS, the DD statement pointing to the CICS journal must specify DCB=RECFM=VB. This allows the File Select and Formatting utility to remove the header.

Example of log analysis

An abend is issued against a database. You have used other diagnostic tools to analyze the call. Now you must look at the database. Follow these steps when looking at the database:

  1. Analyze the buffer to identify what seems to be wrong. (See the following figure.) The first indication that something is wrong is usually found in the buffer.
  2. Look at the changes to that buffer (block) on the log.
  3. Determine if the bad data is actually on the database.
  4. If required, determine if the image copy is propagating the bad block.

The following figure shows the general areas of database analysis: Application, Buffer, Database, Image Copy, and Log.

Figure 1. General areas of database (DB) analysis
This figure shows the flow from Image Copy (on the far right) to Database, to Buffer (Block), to Log, to Application using DL/I Interface.

Database change log record DSECT

You can use the following table to assist you in the analysis of output from log record type X'50'.

If any differences are detected in the mapping of the DSECT, you can obtain a current copy by assembling the macro ILOGREC.

Table 1. Database change log record DSECT
Offset Field Length Description

DLOGB

DSECT    

00

DLENGTH

2

Length of log record

02

DLOGZZ

2

Zeros for QSAM

04

DLOGCODE

1

Log record type

05

DLOGSCDE

1

Log record subrecord (X'50' X'51' X'52')

06

DLOGPSTN

2

PST number

08

DLOGRTKN

16

Recovery token

18

DLOGSTCK

8

CPU store clock (STCK)

20

DLOGVIMS

1

DLOG IMS Version/Release:
X'82' Version 8 or later

28

DLOGDBF1

1

Flag 1
X'80' Record written during backout
X'40' Record from DB/DC
X'20' Record from batch region
X'10' New date/time from DFSFTIM0
X'08' Commit each GU call (Mode=SNGL)
X'04' First log record this sync interval
X'02' First log record of a segment
X'01' Last log record of a segment

29

DLOGDBF2

1

Flag 2
X'80' Database is nonrecoverable
X'40' KSDS ERASE prohibited
X'20' Bit map update for lock tracking

X'08' PHIDAM primary index; no REDO
X'04' DLOGSEQ has update sequence number
X'02' OLR non-backoutable; cursor not active yet
X'01' OLR ITASK

2A

DLOGDBOR

1

Database organization
X'70' DEDB direct organization
X'40' DL/I HDAM database
X'20' DL/I HIDAM database
X'10' Data entry database (DEDB)
X'08' Primary or secondary index database
X'04' HISAM or SHISAM database

2B

DLOGDSOR

1

Data set organization
X'80' VSAM access method
X'40' OSAM access method
X'08' Entry sequenced data set
X'04' Key sequenced data set

2C

DPGMNAME

8

PSB name

34

DDBDNAME

8

Database name

3C

DDSID

1

Data set ID (DCB number)

X'80'
  • When this high order bit is on, then this DCB number represents one of the M-through-V or Y data sets.
  • When this high order bit is off, then this DCB number represents one of the A-through-J or X data sets.
3D DDSID2 1 For ARID

3E

DLOGSLVL

1

Database share level (for DBRC-registered databases)
3F DLOGCALL 1 Describe DL/I call issued by application program X'80' ISRT call X'40' REPL call X'20' DLET call X'10' ROLL/ROLB/ROLS call (backout)

40

DLOGRBA

4

OSAM RBN or VSAM RBA (LRECL)

44

DLOGBLK0

2

Offset of RBA within block

48 DLOGSEQ 4 Update the sequence number when X'04' flag is on in DLOGDBF2

4C

DLOGXTOF

2

Database extension section offset (not used)1

4E

DLOGDSOF

2

Data sharing section offset1

50

DLOGIDOF

2

RACF® userid offset1

52

DLOGTKOF

2

Tracking (XRF) section offset1

54

DLOGDLOF

2

DL/I call section offset (not used)1

56

DLOGKYOF

2

Key data section offset1

58

DLOGSPOF

2

Space management section offset1

5A

DLOGUNOF

2

UNDO data offset1

5C

DLOGREOF

2

REDO data offset1

60

DDATE 4 Date in the format YYYYDDDF

64

DTIME 6 Time in the format HHMMSSTHMIJU
6A DZONE 2 Offset to local time

Data sharing section (DLOGDSHUR DSECT)

00

DLOGDSSN

4

Data set sequence number (DSSN)

04

DLOGLSN

6

Lock sequence number (LSN)

0A DLOGUSID 4 Update Set ID (USID)

RACF/SIGNON userid (DLOGID DSECT)

00

DLOGUSER

8

RACF userid

Buffer and lock tracking for DL/I in XRF-capable systems (DLOGTRCK DSECT)

00

DLOGPOOL

2

Pool size for buffer tracking

02

DLOGBUFF

2

Buffer number for buffer tracking

04

DLOGHASH

4

Root hash value

08 DLOGLOCK 4 Lock value

0C

DLOGLFL1

1

Change logger lock flag
X'80' Log record is for root segment
X'40' Log record is for dependent segment
X'20' Bypass reacquiring restart locks
X'10' Get bid lock on DDATAID
X'08' Function is erase
X'04' Index maintenance
X'02' Organization is SHISAM
X'01' Hash is for logical parent

0D DLOGLFL2 1 Reserved
0E DLOGDBDN 8 DBD name
16 DLOGSKID 4 Task ID

KSDS key data section (DLOGKEY DSECT)

00

DLOGKYF1

1


X'40' KSDS key
X'20' Key is being erased

02

DLOGKLEN

2

Length of key

04

DLOGKDAT

variable

Key data

Space management section for HD inserts and deletes (DLOGSPCE DSECT)

00

DLOGSPF1

1

Space management flags
X'40' Demand space request
X'20' Get free space request (ISRT)
X'10' Free space request (DLET)

02

DLOGSOFF

2

Offset of space management request

04

DLOGSLEN

2

Length of space management request

UNDO/REDO data section (DLOGDATA DSECT)

00

DLOGDFLG

1

  • X'80' Last data element in this section
  • X'40' Data is compressed using z/OS® services

01

DLOGDFUN

1

Describe physical function being logged by this request

X'80' Physical insert
X'40' Physical replace
X'20' Physical delete
X'10' Space management create
X'08' Free space element

02

DLOGDOFF

2

Offset of data in buffer

04

DLOGDLEN

2

Length of data (DLOGDDAT)

06

DLOGDDAT

variable

Variable length data

00


2
variable

Compressed data format in DLOGDDAT
Expanded data length
Compressed data

 

DBCKCHN

6

Back chain2

 

DBLGSEG

8

Logical logger sequence number2

Notes:
  1. To find each section, add the offset to the beginning of the log record.
  2. The log back chain and logical logger sequence number are at the end of the log record.