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.

INSERT


COBOL

PL/I

Assembler

C Language

Description

The INSERT command is used to temporarily insert Code Debug TSO commands in the program. Only one inserted command per line is permitted and the inserted line must be less than 61 characters in length. Code Debug TSO interprets the inserted code and executes it as if it were part of your source code. With the INSERT command, you can try out several source code fixes before you actually modify and recompile the source code.

Inserted code is executed following the statement indicated in the command. Inserted lines do not update the actual source code. The inserted lines drop out when a DELETE command is issued or the test session ends. You can remove all unused inserted lines by entering a DELETE or RESET primary command with no keywords.

Important

If your site has Code Debug Db2 Extension installed, you can also use the INSERT command to insert SQL statements in your program.

You can enter the I (Insert) line command on a statement containing an executable verb and enter Code Debug TSO commands following the statement.

When commands are embedded at the end of a conditional structure that is delimited by a period or a scope terminator, the inserted statements will be executed when the code above them is reached. If you want the inserted statements to be executed only when the true path is taken, place the insert anywhere inside the true path. If you want the inserted statements to be executed only when the false path is taken, place the insert anywhere inside the false path.

Important

Use the primary command syntax outlined as follows only in an unattended batch test or in an INCLUDE test script. Use the I line command interactively to open a window in your code for manual insertion of commands.

Input

INSERT Primary Command Syntax (PL/I and C Language)

INSert statement-number
.
.
.
Any number of CODE DEBUG TSO commands or statements
.
.
.
END-INS

INSERT Primary Command Syntax (Assembler)

INSert statement-number or label-name
.
.
.
Any number of CODE DEBUG TSO commands or statements
.
.
.
END-INS

INSERT Primary Command Syntax (COBOL)

INSert statement-number or paragraph-name
.
.
.
Any number of CODE DEBUG TSO commands or statements
.
.
.
END-INS

INSERT Line Command Syntax

I - Insert one line below the current line
In - Insert n lines below the current line

The following is the parameter description for the INSERT command:

statement-number

A valid statement number.

label-name

A valid Assembler Label.

paragraph-name

A valid COBOL paragraph name.

Usage Notes

ALL Languages

  1. The I line command cannot be combined with other line commands.
  2. You cannot insert lines after a statement containing only ELSE, AT END, scope terminators (END-IF, END-READ, END-PERFORM), after the IF portion of an IF...THEN statement, an internal procedure call, an internal function call, or where a breakpoint cannot be set. The reason for this is that Code Debug TSO internally generates an after breakpoint on the statement where the I line command is entered and interpretively executes the inserted statements only if the internal after breakpoint is reached. The inserted statements are associated with the code above them.
  3. You can only insert at a line that has a statement number. No insertion is allowed at a line with dashes (------).
    Placing the I line command on branching verbs is not permitted. A message INSERT NOT PERMITTED FOLLOWING verb is issued when you attempt to do so. If you want to execute statements following the return from the actual performed paragraph, insert the statement after the last executable code in the out-of-line paragraph.

Examples

ALL Languages

  1. The following figure is the result of entering the I2 line command on statement 42 during an interactive test session.
    Result of Entering the I Line Command 

    =====> B  PROCEDURE DIVISION.
    000035    MAIN-PARA.
    000036         PERFORM INIT-PARA.
    000037         PERFORM ANALYZE-NEXT-REC
    000038            UNTIL OUT-OF-RECS =Y’.
    000039        PERFORM ENDING-PARA.
    000040 A      GOBACK.
    000041    INIT-PARA.
    000042         MOVE ZERO TO N-CNTR (1) N-CNTR (2).
    ’’’’’’
    ’’’’’’
    000043         OPEN INPUT INFILE.
    000044         MOVENTO OUT-OF-RECS.

  2. The following figure completes the previous line command example, showing the insertion of a program patch interactively. The two added MOVE statements are used to correct a logic error.
    Inserting a Program Fix 

    =====> B  PROCEDURE DIVISION.
    000035    MAIN-PARA.
    000036         PERFORM INIT-PARA.
    000037         PERFORM ANALYZE-NEXT-REC
    000038            UNTIL OUT-OF-RECS =Y’.
    000039        PERFORM ENDING-PARA.
    000040 A      GOBACK.
    000041    INIT-PARA.
    000042         MOVE ZERO TO N-CNTR (1) N-CNTR (2).
    ’’’’’’         MOVE ZERO TO N-CNTR (3)
    ’’’’’’         MOVE ZERO TO N-CNTR (4)
    000043         OPEN INPUT INFILE.
    000044         MOVENTO OUT-OF-RECS.

  3. To insert extra code after line 44, create a member in your INCLUDE data set containing the following test script. Then enter this command sequence with the command, INCLUDE test-script-name:

    INSERT 44
    IF SIDE_A NOT NUMERIC
    MOVE 'INVALID DATA' TO TRIANGLE_TYPE
    END-IF
    END-INS

Valid Commands With the Insert Command

COBOL

The following Code Debug TSO commands can be used within the INSERT command:

ACCEPT        EXIT                   KEEP         SET         WS
AFTER         GOTO                   MOVE         SHOW
BEFORE        IF/ELSE construct      ONETIME      SKIP
COUNT         IF/OR construct        PAUSE        TRACE
DELETE        INCLUDE                PEEK         WHEN

The following commands cannot be used within the INSERT command:

AA SNAP     DOWN        GO          LOCATE         REVERSE     USE
ALLOC       DRIGHT      GO n        LOG            RIGHT       WHEREIS
AT          END         GPREGS      MEMORY         RUN         XCHANGE
BROWSE      EXCLUDE     HELP        MONITOR        SOURCE      XPED
CCHILITE    EXPLAIN     INSERT      NOLINES        STATUS
CONNECT     FADB2       INTERCEPT   PSEUDOSOURCE   TEST
DLEFT       FIND        LEFT        RESUME         TSO
DLI         GEN         LOAD        RETEST         UP

Assembler

The following Code Debug TSO commands can be used within the INSERT command:

AFTER         GOTO                   MOVE          SHOW
BEFORE        IF/ELSE construct      ONETIME       SKIP
COUNT         IF/OR construct        PAUSE         TRACE
DELETE        INCLUDE                PEEK          WHEN
EXIT          KEEP                   SET

Important

The KEEP and PEEK line commands cannot be used on lines of inserted code in Assembler.

The following commands cannot be used within the INSERT command:

AA SNAP      DLI          GEN          INTERCEPT    PSEUDOSOURCE   TSO
ALLOC        DOWN         GETMAIN      LEFT         RETEST         UP
AT           DRIGHT       GO           LOAD         RIGHT          USING
BROWSE       END          GO n         LOCATE       RUN            VERIFY
CCHILITE     EXCLUDE      GPREGS       LOG          SOURCE         WHEREIS
CONNECT      FADB2        HELP         MEMORY       STATUS         XCHANGE
DLEFT        FIND         INSERT       NOLINES      TEST           XPED

PL/I

C Language

The following Code Debug TSO commands can be used within the INSERT command:

AFTER        GOTO                   ONETIME       SHOW
BEFORE       IF/ELSE construct      PAUSE         SKIP
COUNT        INCLUDE                PEEK          TRACE
DELETE       KEEP                   RETURN        WHEN
EXIT         MOVE                   SET

Important

The KEEP and PEEK line commands cannot be used on lines of inserted code in PL/I and C.

The following commands cannot be used within the INSERT command:

AA SNAP        DOWN           GO n           LOG            STATUS
ALLOC          DRIGHT         GPREGS         MEMORY         TEST
AT             END            HELP           NOLINES        TSO
BROWSE         EXCLUDE        INSERT         PSEUDOSOURCE   UP
CCHILITE       EXPLAIN        INTERCEPT      RETEST         WHEREIS
CONNECT        FADB2          LEFT           RIGHT          XCHANGE
DLEFT          FIND           LOAD           RUN            XPED
DLI            GO             LOCATE         SOURCE

Inserting SQL Statements

COBOL

PL/I

If you have Code Debug Db2 Extension and File-AID for Db2 installed at your site, you can dynamically insert SQL statements in your source. Each inserted SQL statement must be prefixed by EXEC SQL and suffixed by END-EXEC. Otherwise, Code Debug TSO issues a syntax error message. Any data entered after the END-EXEC statement (on the same line) is ignored.

Important

Inserted SQL statements are not supported in Db2 Call Attach Facility (CAF).

The following SQL statements can be inserted in your source and are valid in a test:

ALTER INDEX

Changes the description of an index.

ALTER STOGROUP

Changes the description of a storage group.

ALTER TABLE

Changes the description of a table.

ALTER TABLESPACE

Changes the description of a table space.

BEGIN DECLARE

Marks the beginning of a host variable declaration section.

CLOSE

Closes a cursor.

COMMENT ON

Replaces or adds a comment to the description of a table, view, or column.

COMMIT

Terminates a unit of recovery and commits the database changes made by that unit of recovery.

CREATE DATABASE

Defines a database.

CREATE INDEX

Creates an index on a table.

CREATE STOGROUP

Defines a storage group or set of volumes, controlled by a VSAM catalog, on which storage can later be allocated for table spaces and indexes.

CREATE SYNONYM

Defines an alternate name for a table or view.

CREATE TABLE

Creates a table.

CREATE TABLESPACE

Allocates and formats table spaces.

CREATE VIEW

Defines a view of one or more tables.

DECLARE CURSOR

Defines an SQL cursor.

DECLARE STATEMENT

Declares a statement for dynamic SQL.

DECLARE TABLE

Declares a table.

DELETE

Deletes one or more rows from a table.

DESCRIBE

Provides a description of the columns in a table or view.

DROP

Removes an object and its description from the Db2 catalog.

END DECLARE

Marks the ending of a host variable declaration section.

EXECUTE

Executes a prepared SQL statement.

EXECUTE IMMEDIATE

Prepares and executes an SQL statement.

EXPLAIN

Obtains information about how an SQL statement will be executed.

FETCH

Positions the cursor on the next row of the result table and assigns the values of that row to host variables.

GRANT

Grants privileges.

INSERT

Inserts rows into a table or view.

LABEL ON

Adds or replaces labels in the catalog descriptions of tables, views, columns, or sets of columns.

LOCK TABLE

Acquires a shared or exclusive lock on a table.

OPEN

Opens a cursor so that it can be used to fetch rows from the result table.

PREPARE

Dynamically prepares an SQL statement for execution.

REVOKE

Revokes privileges.

ROLLBACK

Terminates a unit of recovery and backs out database changes made by that unit of recovery.

SELECT

Specifies a result table and selects rows to view.

SET

Changes the value of the authorization ID.

UPDATE

Updates the values of specified columns in rows of a table or view.

 

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