The INSERT statement
is a positioning statement; it inserts the RECORD=, GROUP=, or ITEM=
statements following it after the item that 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.
The following is an example of an INSERT statement. A new record and item are inserted
at the beginning of the 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;