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.
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.
Input
INSERT Primary Command Syntax (PL/I and C Language)
.
.
.
Any number of CODE DEBUG TSO commands or statements
.
.
.
END-INS
INSERT Primary Command Syntax (Assembler)
.
.
.
Any number of CODE DEBUG TSO commands or statements
.
.
.
END-INS
INSERT Primary Command Syntax (COBOL)
.
.
.
Any number of CODE DEBUG TSO commands or statements
.
.
.
END-INS
INSERT Line Command Syntax
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 |
- The I line command cannot be combined with other line commands.
- 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.
- 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 |
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 MOVE ’N’ TO OUT-OF-RECS.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 MOVE ’N’ TO OUT-OF-RECS.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:
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:
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:
BEFORE IF/ELSE construct ONETIME SKIP
COUNT IF/OR construct PAUSE TRACE
DELETE INCLUDE PEEK WHEN
EXIT KEEP SET
The following commands cannot be used within the INSERT command:
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:
BEFORE IF/ELSE construct PAUSE SKIP
COUNT INCLUDE PEEK TRACE
DELETE KEEP RETURN WHEN
EXIT MOVE SET
The following commands cannot be used within the INSERT command:
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.
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.