INSERT

Use

INSERT ( <table>[<row index>] ).

INSERT ( <table>[<row index>] , <work area> ).

The INSERT command inserts a row into a table parameter. The table can be a field of a complex structure. After the INSERT command has been executed, &TFILL contains the current number of rows.

You can specify the index of the row to be inserted. If a row already has this index, it and rows with higher indexes have their indexes increased by 1. If the index of the row to be inserted is higher than any currently in the table, the row is inserted at the specified index and empty rows are inserted between it and the existing rows.

The first argument must be a row in a table, not a complete table.

See also APPEND and DELETE.

Without Work Area

If no work area is specified, an empty row is inserted in the table.

With Work Area

A row is inserted in the table. If the structure of the work area differs from that of the table, fields with the same name are filled.

Example

Here, we use a table parameter with parameter reference SPFLI[] and a structure parameter with parameter reference SPFLI.

INSERT ( SPFLI_TAB[2] ).

LOG ( &TFILL ).

LOG ( SPFLI_TAB ).

INSERT ( SPFLI_TAB[2] , SPFLI_WA ).

LOG ( &TFILL ).

LOG ( SPFLI_TAB ).