Using DataBasic to Examine a Clean Log or Error Log

Clean logs can be accessed from DataBasic by opening and reading them as for any standard Reality file.

Item IDs are hexadecimal offsets into the clean log, and are case sensitive. The following table lists the attributes.

Number

Name

Description

1

TYPE

Type of log image.

2

SERVICE

The Reality service which generated the image.

3

SIZE

The size of the image.

4

DATE

The date when the image was first logged.

5

TIME

Time when the image was first logged.

6

RLOGSEQ

Transaction id - Sequence number of transaction commit. All images in a committed transaction have the same sequence number. Independent updates have different sequence numbers.

7

CLOGSEQ

The sequence number of the image in the clean log.

8

PORT

Number of the port logging the image.

9

RESULT

Failure code which appears in the reject or error log. Indicates reason for failure to restore update. Zero indicates a successful recovery.

10

USER

Reality user-id that logged the image.

11

ACCOUNT

The Reality account being used when the image was logged.

12

FILENAME

The Reality file for which the image was logged.

13

INFO

Information field from Transaction boundary images, if 2 is "RXS"

13

ITEM

The item id of modified record, if 2 not "RXS"

13

ITEMINFO

Combines Item and INFO information.

14

OPERATION

Type of operation for which the image was logged.

15

16

PARALLEL

Synchronisation number used during multithreaded restore

17

HDRSIZE

Number of attributes in clean log header (including this one)

(17)+1

Start of item body if enabled

By default, only the header attributes are returned when reading a clean log item. However if it is required to see the item body then this can be achieved by writing “#FULL-VIEW#” to the clean log file handle after opening the log. The item body will appear at (attribute 17) +1 onwards.

The program below demonstrates accessing clean log images from a clean log file.

IF SYSTEM(20) THEN P = 1 ELSE P = 3
Name = SENTENCE(P)
Ofst = SENTENCE(P+1)
IF Name = '' THEN PRINT "No log name specified"; STOP
OPEN Name TO CLOG ELSE PRINT "Open failed ":Name; STOP
IF Ofst # '' THEN
   List = Ofst
END ELSE
   SELECT CLOG TO List
END
WRITE "" ON CLOG,"#FULL-VIEW#";   * Enable the full view feature
LOOP WHILE READNEXT IID FROM List
   READ FullImage FROM CLOG,IID ELSE CRT "Read of ":IID:" failed"; STOP
   PRINT
   PRINT "Image ":IID
   *
   * Print the header items - see the clean log DICT for header definition
   *
   HeaderSize = FullImage<17>
   FOR I = 1 TO HeaderSize - 1
      PRINT "Header ":I:": ":FullImage<I>
   NEXT
   PRINT
   *
   * Extract the image data from the full image.  This also works
   * if the image data is binary.
   *
   StartPos = DELIM.POS(FullImage<HeaderSize>, "E") + 1
   ImageData = FullImage[StartPos, -1]
   *
   *
   Len = DCOUNT(ImageData, @AM)
   FOR I = 1 TO Len
      PRINT "Item ":I:": ":ImageData< I>
   NEXT
REPEAT