Information
Space announcement This documentation space provides the same content as before, but the organization of the content has changed. The content is now organized based on logical branches instead of legacy book titles. We hope that the new structure will help you quickly find the content that you need.

Expanding EXEC SQL and EXEC CICS Statements


The GEN command can be used to enable the debugging of EXEC SQL, EXEC DLI, and EXEC CICS statements. The GEN command lets you expand EXEC statements and display translator-related statements. You can see and place breakpoints on the translated code and debug the EXECs while the program is being executed.

If SET GEN is OFF (the system default), the unexpanded code is displayed. The GEN command can be used to selectively expand and display translated code. The SET GEN ON command globally expands and displays all statements. If SET GEN is ON, there is no requirement to use the GEN command since all EXECs have already been expanded. SET GEN ON remains operational across debugging sessions.

If GEN is entered as a primary command, the statement number must point to the start of the EXEC statement. You can specify a list or a range of statement numbers.

When a GEN is entered, the EXEC appears on the Source display screen as code that is commented out. The expanded code generated by the translator is also displayed. Any breakpoints that have been set on the EXEC statement appear in the expanded code. After expansion, breakpoints on the commented code are not allowed, but breakpoints on the expanded code are allowed.

On a TRACE or WHEN breakpoint, each statement within the expanded code receives the appropriate breakpoint.

On a COUNT, the expansion gives counts for all statements. When collapsed, the count on the first statement is moved to the EXEC statement.

An INSERT on an EXEC is moved after the last statement in the expanded code. If you insert on expanded code, the inserted data is lost when the expanded code is collapsed.

The G line command must be entered on the line at the start of the EXEC statement. The block command, GG, must begin and end on the first lines of EXEC statements. The line command, DG, removes the effects of the G or GG line commands, as does the DELETE GEN primary command.

Example 1—Expanding an EXEC SQL Statement Using a G Line Command:

As seen in the following figure, the G line command is entered on statement number 396, which results in the expanded text shown in Expanded EXEC SQL Statement.

Expanding an EXEC SQL Statement Using the G(en) Line Command

  000394                  OR   FIRSTNAME LIKE :FNAME-WORK
 000395            END-EXEC.
 G  396       EXEC SQL OPEN  DIRECTORY                   END-EXEC.
 000403       EXEC SQL FETCH DIRECTORY INTO :PDIRECTORY  END-EXEC.
 000410       IF SQLCODE = SQL-NOT-FOUND


Expanded EXEC SQL Statement

----------------------------- CODE DEBUG TSO - LOG -----------------------------
COMMAND ===>                                                    SCROLL ===> CSR

000394                  OR   FIRSTNAME LIKE :FNAME-WORK
000395            END-EXEC.
000396   *   EXEC SQL OPEN  DIRECTORY                   END-EXEC.
000397       PERFORM SQL-INITIAL UNTIL SQL-INIT-DONE
000398       CALLDSNHLIUSING SQL-PLIST6
000399       IF SQLCODE < 0 GO TO DBERROR ELSE
000400       IF SQLCODE > 0 AND SQLCODE NOT = 100
000401       OR SQLWARN0 =WGO TO DBERROR ELSE
000402       MOVE 1 TO SQL-INIT-FLAG.
000403       EXEC SQL FETCH DIRECTORY INTO :PDIRECTORY  END-EXEC.
000410       IF SQLCODE = SQL-NOT-FOUND


Example 2—Seeing the Effect of Breakpoints Set Against an EXEC:

In the following figure, note that before and after breakpoints have been entered on the EXEC SQL statement number 396, as denoted by the @ sign. If you gen this EXEC statement, you can see where the breakpoints are applied in the translated code, as seen in Before and After Breakpoints Shown on a Genned EXEC SQL Statement.

Before and After Breakpoints Set on an Unexpanded EXEC SQL Statement

  000394                  OR   FIRSTNAME LIKE :FNAME-WORK
 000395            END-EXEC.
 G  396 @     EXEC SQL OPEN  DIRECTORY                 END-EXEC.
 000403       EXEC SQL FETCH DIRECTORY INTO :PDIRECTORY  END-EXEC.
 000410       IF SQLCODE = SQL-NOT-FOUND


After expansion, a before breakpoint on the EXEC SQL appears on the first verb of the expanded code and an after breakpoint appears on the call to DSNHLI.

Before and After Breakpoints Shown on a Genned EXEC SQL Statement

----------------------------- CODE DEBUG TSO - LOG -----------------------------
COMMAND ===>                                                    SCROLL ===> CSR

000394                  OR   FIRSTNAME LIKE :FNAME-WORK
000395            END-EXEC.
000396   *   EXEC SQL OPEN  DIRECTORY                   END-EXEC.
000397 B     PERFORM SQL-INITIAL UNTIL SQL-INIT-DONE
000398 A     CALLDSNHLIUSING SQL-PLIST6
000399       IF SQLCODE < 0 GO TO DBERROR ELSE
000400       IF SQLCODE > 0 AND SQLCODE NOT = 100
000401       OR SQLWARN0 =WGO TO DBERROR ELSE
000402       MOVE 1 TO SQL-INIT-FLAG.
000403       EXEC SQL FETCH DIRECTORY INTO :PDIRECTORY  END-EXEC.
000410       IF SQLCODE = SQL-NOT-FOUND


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI DevX Code Debug for TSO and IMS 17.02