ISPF Online Monitor Source Explain

Use Source Explain to explain SQL statements that are embedded in a source program or SPUFI input. Source explain is performed from within the ISPF/PDF editor.

The following languages are supported:
  • Assembler
  • C
  • COBOL
  • FORTRAN
  • PL/I
  • SPUFI
Note: Ensure that Source Explain is installed at your site. Before you activate Source Explain, make sure that the DB2® load library is allocated to your TSO ISPF session.

To explain an SQL statement while editing a source program (or SPUFI input), specify the lines you want to have explained by using the ISPF/PDF editor line prefix command E, type EXPLAIN on the command line, and press Enter.

You can use the line prefix command E like this:
E
To explain a single line, type E in the prefix area of the line to be scanned for SQL statements.
EE
To explain a range of lines, type EE in the prefix area of the first line and the last line of the range of lines to be scanned for SQL statements.
E[n]
To explain a specific number of lines, type E[n] on the first line of the area to be scanned, where n is the number of lines to be scanned for SQL statements.

When you enter the EXPLAIN command, Source Explain scans the specified range for valid SQL statements. If a range is not specified, the entire source is scanned. The valid SQL statements are then listed on the SQL Statement Selection panel.

The following figure shows how to explain an SQL statement while editing COBOL source code.

To explain the SQL statements in the source code from line 3040 to 3160:
  1. In the line prefix area of lines 3040 and 3160, type EE.
  2. On the command line, type explain and press Enter.
Figure 1. Source Explain example
EDIT ---- SYS1.DSN610.SDSNSAMP(DSNBBC3) - 01.00 -------------- COLUMNS 001 072
003010       *** CURSOR LISTS ALL EMPLOYEE NAMES WITH A PATTERN (%) OR (_)
003020       *** FOR LAST NAME
003030
EE3040                 EXEC SQL DECLARE TELE2 CURSOR FOR
003050                          SELECT *
003060                          FROM   VPHONE
003070                          WHERE  LASTNAME  LIKE :LNAME-WORK
003080                            AND  FIRSTNAME LIKE :FNAME-WORK
003090                      END-EXEC.
003100
003110       *** CURSOR LISTS ALL EMPLOYEES WITH A SPECIFIC
003120       *** LAST NAME
003130
003140                 EXEC SQL DECLARE TELE3 CURSOR FOR
003150                          SELECT *
EE3160                          FROM   VPHONE
003170                          WHERE  LASTNAME   =   :LNAME
003180                            AND  FIRSTNAME LIKE :FNAME-WORK
003190                       END-EXEC.
003200       /
003210       /****************************************************
003220       * FIELDS SENT TO MESSAGE ROUTINE                    *
003230       *****************************************************
003240        01  MAJOR                     PIC X(07) VALUE 'DSNBBC3'.
003250
003260        01  MSGCODE                   PIC X(4).
COMMAND ===> explain                                          SCROLL ===> CSR
 F1=HELP      F2=SPLIT     F3=END       F4=RETURN    F5=RFIND     F6=RCHANGE
 F7=UP        F8=DOWN      F9=SWAP     F10=LEFT     F11=RIGHT    F12=RETRIEVE

If you previously selected the Always display this window field in the Source Explain Options window as shown in Source Explain Options window, the Source Explain Options window is displayed. If you did not select this field, the SQL Statement Selection panel is displayed.