Chapter Contents

Previous

Next
INSERT

INSERT



Adds new records, groups, or items to an existing access descriptor.

Optional statement
Applies to: access descriptor
Interacts with: UPDATE statement


Syntax
Details
Arguments
Example

Syntax

INSERT|INS index-number;
INSERT|INS item-name <... item-name-n>;


Details

The INSERT statement is a positioning statement; it inserts the RECORD=, GROUP=, or ITEM= statements following it after the item it references. The syntax and use of the RECORD=, GROUP=, and ITEM= statements are the same in update mode as they are in create mode.

Although the INSERT statement can reference only one item, more than one RECORD=, GROUP=, or ITEM= statement can follow an INSERT statement. The INSERT statement retains control until it encounters an editing, LIST, DELETE, or REPLACE statement, or the ACCESS procedure ends through a QUIT, RUN, or other procedure statement. Multiple INSERT statements can be used in one UPDATE statement. When more than one INSERT statement references the same item, the most recent update displays as first.


Arguments

The following arguments can appear in a INSERT statement:

item-number
is an index number that represents the item's place in the access descriptor. You can get the index number of an item by using the LIST statement described later in this section.

item-name
is the name of the IMS-DL/I group, record, or item after which subsequent groups, records, or items will be inserted. This field can also contain a quoted string.


Example

The following is an example of an INSERT statement. A new record and item are inserted at the beginning of access descriptor ADLIB.CUSTINS. "INSERT 0" inserts items at the beginning of the descriptor. The first item in an access descriptor must always be a record. Also in the example, note that the first LIST statement prints a pre-update listing of the database as defined by the access descriptor, while the second prints a post-update listing.

proc access dbms=ims;
   update adlib.custins.access;
      list all db;
      insert 0;
        record=newfrec sg=newrecsg sl=400;
        item=newfitem lv=3 dbf=$12. se=custfsti;
      list all db;
run;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.