DBLOG Trace Screen

The DBLOG Trace screen displays recorded log data on Adabas commands, SYNC/ROLB calls, SQL statements, or VSAM calls which are kept in the Natural DBLOG buffer.

This section covers the following topics:


DBLOG Trace Screen for Adabas Commands

Invoking DBLOG Trace for Adabas Commands

The following is an example instruction for invoking the DBLOG Trace screen for Adabas commands.

  1. Write the following Natural program:

    DEFINE DATA LOCAL
    1 EMP-VIEW VIEW OF EMPLOYEES
      2 NAME
    END-DEFINE
    READ (3) EMP-VIEW BY NAME
      DISPLAY NAME
    END-READ
    END
  2. Enter the following Natural system command

    TEST DBLOG

    The message DBLOG started now is displayed.

  3. Enter the following Natural system command:

    RUN

    The Natural program in the source area is executed.

  4. Enter again:

    TEST DBLOG

    Logging is deactivated and a DBLOG Trace screen similar to the example below appears:

    14:14:23             ***** NATURAL TEST UTILITIES *****              2015-11-03
    User SAG                      - DBLOG Trace -                  Library SAG
    M ________No Cmd ___DB __FNR _Rsp _______ISN ____ISQ CID(Hex) OP_ Pgm_____ Line
    _          1  S1    10  2430                         00000000     ATEST2   5470
    _          2  RC    10                               00000000 F   ATEST    0220
    _          3  L3    10   316             295         00500101  A  LOGTEST  0050
    _          4  L3    10   316             621         00500101  A  LOGTEST  0050
    _          5  L3    10   316             715         00500101  A  LOGTEST  0050
    _          6  RC    10   316                         00500101 SI  LOGTEST  0050
    _          7  RC    10                               00000000 F   LOGTEST  0080
    
    
    Command ===>
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help  Print Exit        Posi  --    -     +     ++                Canc

Screen Columns and Commands on DBLOG Trace

This section describes the columns of fields contained in the DBLOG Trace screen and the commands available to scroll in the screen or in a buffer window opened from the screen (see Displaying Adabas Buffers). You execute a command by either pressing a PF key or entering a direct command in the Command line.

Column PF Key Explanation
Direct Command
M   Input option for line commands that invoke extra windows with detailed information on buffers: see Displaying Adabas Buffers.
No   Sequence number. The commands are displayed in the sequence in which they were executed.
Cmd   Adabas command. If the command is prefixed with an asterisk (e.g. *S1), the database call was submitted in ACBX shape.
DB   Database ID.
FNR   File number.
Rsp   Adabas response code.
ISN   Internal sequence number of record.
ISQ   ISN quantity.
CID   Command ID.
CID (Hex)   Command ID in hexadecimal format.
OP   Adabas Command Options 1 and 2. If the left option is a less-than sign (e.g. <A), the record was taken from the multi-fetch buffer instead of being provided by the database.
Pgm   Program name.
Line   Source code line number.
  PF2 Prints a hardcopy of a screen shot.
  PF3 Exits the DBLOG Trace screen or closes a buffer window. The current log records are kept in the Natural DBLOG buffer.
  PF5

Moves log entries to the top of the screen:
In column M, position the cursor next to the desired command and sequence number listed in column No and choose PF5.
The logs are repositioned starting with the sequence number selected.

  PF6

or

--

Scrolls to the beginning of a list or the data in a buffer window.
  PF7

or

-

Scrolls up one page in a list or the data in a buffer window.
  PF8

or

+

Scrolls down one page in a list or the data in a buffer window.
  PF9

or

++

Scrolls to the end of a list or the data in a buffer window.
  PF10 Only available in a buffer window with multiple record/format buffers.

Displays the previous record/format buffer.

  PF11 Only available in a buffer window with multiple record/format buffers.

Displays the next record/format buffer.

  PF12 Clears the Natural DBLOG buffer and deactivates logging.

Displaying Adabas Buffers

The Adabas control block is recorded by default. If you want to record one or more Adabas buffers, you need to mark the buffer(s) required in the DBLOG Menu before executing the logging function as described in Specifying Adabas Buffers. For example, if only logging of the format buffer has been marked in the DBLOG Menu, you can only display the Format Buffer window but not the Record Buffer window.

Start of instruction set To display control block or buffer information

  1. In the input field next to the required command, enter the line command that corresponds to the required buffer and press ENTER:

    Line Command Requested Buffer
    C Control block
    F Format buffer
    R Record buffer
    S Search buffer
    V Value buffer
    I ISN buffer
    . A period (.) exits the DBLOG Trace screen. The current log records are kept in the Natural DBLOG buffer.

    A window opens with the log data of the control block or buffer requested. If you entered several line commands, you can press PF3 to view the control block or buffer of the next command.

    The following is an example of a window that contains data of a record buffer:

    16:50:05             ***** NATURAL TEST UTILITIES *****              2015-11-03
    User SAG                      - DBLOG Trace -                  Library SAG
    M ________No Cmd ___DB __FNR _Rsp _______ISN ____ISQ CID(Hex) OP_ Pgm_____ Line
    _          1  S1    10  2430                         00000000     ATEST2   5470
    _          2  RC    10                               00000000 F   ATEST    0220
    _          3  L3    10   316             295         00500101  A  LOGTEST  0050
    R          4  L3    10   316             621         00500101  A  LOGTEST  0050
    _ +------------------Page 1 of 1 (logged range:0x-0x4F)-------------------+ 050
    _ | _____ Seq No 4          Record Buffer (length:0x14)                   | 050
    _ | 0000 * C1C6C1D5 C1E2E2C9 C5E54040 40404040 * AFANASSIEV       * 0000  | 080
    _ | 0010 * 40404040 00000000 00000000 00000000 *                  * 0010  | 110
    _ +-----------------------------------------------------------------------+ 270
    
    
    Command ===>
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help        Exit              --    -     +     ++    <     >     Canc

    The fields provided in a buffer window are explained in the following table:

    Field Explanation
    Page The number of the current page and the total number of pages generated for the buffer (in the example above, 1 of 1).
    logged range The buffer length actually logged in hexadecimal format (in the example above, 0x0-0x4F).
    Seq No The sequence number of the command. In the example above, the command was executed in the third place (3).
    buffer-type

    num-current /num-total

    buffer-type denotes the type of buffer requested.

    In addition, for a format or record buffer, the number of record or format buffers is displayed:

     
    num-current Denotes the number of the record/format buffer currently shown.
     
    num-total Denotes the total number of the record/format buffers logged.

    For a database call that uses the extended Adabas control block (ACBX), multiple format/record buffers are logged.

    The example above shows the first record from a total of 13 records (1 / 13).

    For detailed information on ACBX, see Adabas Control Block Structures (ACB and ACBX) in the Adabas for mainframes documentation.

    length The total length of the record in hexadecimal format (in the example above, 0x7A).
    _____
    In the input field next to Seq No, you can enter one of the following line commands:
     
    C Displays the control block.
    F

    or

    R
    Displays the format (F) or record (R) buffer.

    If pairs of format and record buffers exist, entering F in a record buffer or R in a format buffer will display the matching record buffer or format buffer respectively. For example, if the second record buffer is currently displayed, entering F will invoke a window with the corresponding second format buffer.

     
    I Displays the ISN buffer.
    S Displays the search buffer.
    V Displays the value buffer.
     
    buffer-number You can enter the number of the record/format buffer you want to view.

    See also Step 2 below.

     
    . A period (.) closes the current buffer window.
  2. In a record/format buffer window that contains multiple record/format buffers, you can use one of the following methods to view each record/format buffer:

    Press PF10 to display the previous record/format buffer.

    Or:
    Press PF11 to display the next record/format buffer.

    Or:
    In the _____ input field, enter the number that corresponds to the record/format buffer you want to view.

Displaying Adabas Commands that use Multi-Fetch

If the MULTI-FETCH clause is used in a FIND, READ or HISTOGRAM statement, only the Adabas commands that retrieve a set of records actually access the database. The records retrieved are moved into the multi-fetch buffer from where they are fetched during the execution of the database loop. The next database call is only made for the next set of records. For details, see MULTI-FETCH Clause in the Programming Guide.

The DBLOG Trace screen lists both database calls and non-database calls: a database call is marked with an M in the first position of the OP column, whereas a non-database call for the multi-fetch buffer is marked with the less-than sign (<). This is demonstrated in the following example.

Example of an Adabas Command with Multi-Fetch

Execute DBLOG for the following Natural program called MFETCH:

DEFINE DATA LOCAL
1 EMP-VIEW VIEW OF EMPLOYEES
  2 NAME
END-DEFINE
*
READ (5)  MULTI-FETCH OF 3  EMP-VIEW BY NAME = 'ADKINSON'
  DISPLAY *COUNTER NAME
END-READ
END

A DBLOG Trace screen similar to the example below appears:

10:04:46             ***** NATURAL TEST UTILITIES *****              2015-11-03
User SAG                      - DBLOG Trace -                  Library SAG
M ________No Cmd ___DB __FNR _Rsp _______ISN ____ISQ CID(Hex) OP_ Pgm_____ Line
_          1  S1    10  2430                         00000000     ATEST2   5470
_          2  RC    10                               00000000 F   ATEST    0220
_          3  L3    10   316             295         00600101 MA  MFETCH   0060
_          4  L3    10   316             621         00600101 <A  MFETCH   0060
_          5  L3    10   316             715         00600101 <A  MFETCH   0060
_          6  L3    10   316             535         00600101 MA  MFETCH   0060
_          7  L3    10   316            1038         00600101 <A  MFETCH   0060
_          8  RC    10   316                         00600101 SI  MFETCH   0060
_          9  RC    10                               00000000 F   MFETCH   0090


Command ===>
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Print Exit        Posi  --    -     +     ++                Canc

The L3 commands listed as sequence numbers 3 and 6 retrieve a set of records from the database (indicated by M in the OP column) and return the first record back to the program. The remaining records are cached in the multi-fetch buffer.

The L3 commands listed as sequence numbers 4, 5 and 7 retrieve the record from the multi-fetch buffer (indicated by < in the OP column) and return it to the program.

Contents of Record Buffer for Multi-Fetch Database Calls

The record buffer of a database call that uses multi-fetch contains the data of all records retrieved from the database. They are listed in the sequence in which they are processed.

When loading a set of records, Adabas overwrites the record buffer from the first byte to the extent of the records which are returned from the database. Any space left in the buffer is not cleared but still contains data of old records loaded during a previous database call. This means, for example, that if a field defined as NAME(A20) is read and a multi-fetch factor of 5 is used, the record buffer has a length of 100 (20 * 5) bytes. If only 3 records are returned from the database, the record buffer is only filled properly with the first 3 records (bytes 1 to 60), whereas the last 2 records (bytes 61 to -100) remain unchanged.

DBLOG Trace Screen for SQL Statements

Invoking DBLOG Trace for SQL Statements

The following is an example of invoking the DBLOG Trace screen for SQL statements.

  1. Write the following Natural program:

    DEFINE DATA LOCAL
    01 EMP VIEW OF DSN8810-EMP
      02 EMPNO
      02 FIRSTNME
      02 MIDINIT
      02 LASTNAME
      02 EDLEVEL
      02 SALARY
    01 EMPPROJACT VIEW OF DSN8810-EMPPROJACT
      02 EMPNO
      02 PROJNO
      02 ACTNO
      02 EMPTIME
    END-DEFINE
    FIND (1) EMP WITH EMPNO > '000300'
      FIND (1) EMPPROJACT WITH EMPNO = EMPNO(0150)
        MOVE 0.75 TO EMPTIME
        UPDATE
      END-FIND
      ADD 1 TO EDLEVEL
      UPDATE
    END-FIND
    *
    FIND (1) EMP WITH EMPNO > '000300'
      FIND (1) EMPPROJACT WITH EMPNO = EMPNO(0240)
        DISPLAY EMPPROJACT EMP.EDLEVEL
      END-FIND
    END-FIND
    ROLLBACK
    END
  2. Enter the following Natural system command:

    TEST DBLOG Q

    The message DBLOG started now is displayed.

  3. Enter the following Natural system command:

    RUN

    The Natural program in the source area is executed.

  4. Enter again:

    TEST DBLOG Q

    Logging is deactivated and a DBLOG Trace screen for SQL statements similar to the example below appears:

    11:28:58              ***** NATURAL Test Utilities *****             2008-07-28
    User SAG                        - DBLOG Trace -                Library SAG
    M No   R SQL Statement (truncated)     CU SN SREF M Typ SQLC/W Program  Line LV
    _    1   SELECT EMPNO,FIRSTNME,MIDINIT 01 01 0150 D DB2        LOGSQL   0150 01
    _    2     FETCH CURSOR NEX            01 01 0150 D DB2        LOGSQL   0150 01
    _    3   SELECT EMPNO,PROJNO,ACTNO,EMP 02 02 0160 D DB2        LOGSQL   0160 01
    _    4     FETCH CURSOR NEX            02 02 0160 D DB2        LOGSQL   0160 01
    _    5   UPDATE DSN8810.EMPPROJACT SET 02 03 0160 D DB2        LOGSQL   0180 01
    _    6   CLOSE CURSOR                  02 02 0160 D DB2        LOGSQL   0160 01
    _    7   UPDATE DSN8810.EMP SET EDLEVE 01 04 0150 D DB2        LOGSQL   0210 01
    _    8   CLOSE CURSOR                  01 01 0150 D DB2        LOGSQL   0150 01
    _    9   SELECT EMPNO,FIRSTNME,MIDINIT 05 05 0240 D DB2        LOGSQL   0240 01
    _   10     FETCH CURSOR NEX            05 05 0240 D DB2        LOGSQL   0240 01
    _   11   SELECT EMPNO,PROJNO,ACTNO,EMP 06 06 0250 D DB2        LOGSQL   0250 01
    _   12     FETCH CURSOR NEX            06 06 0250 D DB2        LOGSQL   0250 01
    _   13   CLOSE CURSOR                  06 06 0250 D DB2        LOGSQL   0250 01
    _   14   CLOSE CURSOR                  05 05 0240 D DB2        LOGSQL   0240 01
    _   15   ROLLBACK                      00 00 0000 D DB2        LOGSQL   0290 01
    _
    _
    Command ===>
    
    
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help  Print Exit  Top   Posi  Bot    -     +                      Canc

Screen Columns and Commands on DBLOG Trace

The columns of fields and commands provided on the DBLOG Trace screen for SQL statements are described in the following section. You execute a command by either pressing a PF key or entering a direct command in the Command line.

Column PF Key Explanation
Direct Command
M  
Input option for line commands:
   
E Executes the EXPLAIN command which provides information on the Db2 optimizer's choice of strategy for executing SQL statements.

See also subsection Using the EXPLAIN Command with Natural for Db2 in the documentation on the LISTSQL command in the System Commands documentation.

   
L Executes the LISTSQL command which lists the Natural statements in the source code of an object and the corresponding SQL statements into which they have been translated. An SQL statement is identified by the library name, program name, and line number taken from the Natural DBLOG buffer.

See also LISTSQL Command in the System Commands documentation.

 

Important:
Since both commands obtain their information from the Natural system file, unwanted results may occur if the corresponding Natural program has been recataloged after the logging function was executed with the TEST DBLOG Q command. These unwanted results may be caused by statements modified after the logging.

No   Sequence number; the statements are displayed in the sequence in which they were executed.
R   Only applicable if the Natural file server for Db2 is in use.

Indicates by an asterisk in front of the corresponding statement that a reselection has been performed; if not, the column is left blank.

See also Concept of the File Server in the Natural for Db2 documentation.

SQL Statement   The first 29 characters of the logged SQL statement.
CU   Cursor number.
SN   Internal statement number.
SREF   Statement reference number.
M   Mode: D for dynamic or S for static.
Typ   Database type: Db2 or /DS.
SQLC/W   Either the SQL return code in the SQLCODE field of the SQLCA, or the warning in the SQLWARN0 field of the SQLCA if SQLCODE is 0.
Pgm   Natural program name.
Line   Source code line number.
LV   Program level.
  PF2 Prints a hardcopy of a screen shot.
  PF3 Exits the DBLOG Trace. The current log records are kept in the Natural DBLOG buffer.
  PF4 Scrolls to the beginning of the list.
  PF5 Moves log entries to the top of the screen: In column M, position the cursor next to the desired command and sequence number listed in column No and choose PF5. The logs are repositioned starting with the sequence number selected.
  PF6 Scrolls to the end of the list.
  PF7

or

-

Scrolls up one page in the list.
  PF8

or

+

Scrolls down one page in a list.
  PF12 Clears the Natural DBLOG buffer and deactivates logging.

DBLOG Trace Screen for VSAM Calls

Invoking DBLOG Trace for VSAM Calls

The following are example instructions for invoking the DBLOG Trace screen for VSAM calls.

  1. Write the following Natural program:

    DEFINE DATA LOCAL                
    01 EMPVSAM VIEW OF EMPLOYEES-VS  
       02 NAME (A20)                 
       02 CITY (A20)                 
       02 PERSONNEL-ID (A8)          
    END-DEFINE                       
    READ (10) EMPVSAM BY PERSONNEL-ID
       WRITE PERSONNEL-ID NAME CITY  
    END-READ                         
    END
  2. Enter the following Natural system command:

    TEST DBLOG V

    or

    TEST DBLOG V START

    The message DBLOG started now is displayed.

  3. Enter the following Natural system command:

    RUN

    The Natural program contained in the source area is executed.

  4. Enter again:

    TEST DBLOG V

    or

    TEST DBLOG V SHOW

    Logging is deactivated and the DBLOG Trace screen for VSAM calls is displayed:

    11:21:41          ***** Natural Test Utility *****                 2019-10-14 
    User SAG                 - DBLOG V Trace -                   Library SAG   
                                                                                  
    Seq Number VSAMCall Cmd Resp NRet Key (10)   RecID(10)  FileName Program  Line
    ---------- -------- --- ---- ---- ---------- ---------- -------- -------- ----
                                                                                  
             1 SETL     L3                                  EMPLVS   VSAM01   0050
             2 GETNXT   L3            11100102   11100102   EMPLVS   VSAM01   0050
             3 GETNXT   L3            11100105   11100105   EMPLVS   VSAM01   0050
             4 ESETL    RC                                  EMPLVS   VSAM01   0050
                                                                                  
                                   ***** End of Log *****

Screen Columns on DBLOG Trace

The columns of fields provided on the DBLOG Trace screen for VSAM calls are described in the following section.

Column Explanation
Seq Number Sequence number. The calls are displayed in the sequence in which they were executed.
VSAMCmd VSAM call issued.
Cmd Equivalent Adabas command.
Resp Return code after the VSAM call.
NRet Natural return code, if any.
Key (10) First 10 bytes of the VSAM key.
RecID (10) First 10 bytes of the record ID.
FileName VSAM file accessed.
Program Natural program name.
Line Source code line number of the Natural program.