space
Previous Page | Next Page

ACCESS Procedure Reference

UPDATE Statement



Updates a SAS/ACCESS descriptor file.
Optional statement
Applies to: access descriptor or view descriptor

Syntax
Details

Syntax

UPDATE libref.member.ACCESS | VIEW;


Details

The UPDATE statement identifies an existing access descriptor or view descriptor that you want to change. The descriptor can exist in a temporary (WORK) or permanent SAS library. If the descriptor has been protected with a SAS password that prohibits editing of the access or view descriptor, then the password must be specified on the UPDATE statement.

To update a descriptor, use its three-level name. The first level identifies the libref of the library where you stored the descriptor. The second level is the descriptor's member name. The third level is the type of SAS file: ACCESS or VIEW. For a view descriptor, you can specify the PSBNAME and PCBINDEX arguments.

You can use the UPDATE statement as many times as necessary in one procedure. Use these guidelines to write the UPDATE statement:

The following examples edit the access descriptor IMSLIB.CUSTS. Despite the order of the INSERT, DELETE, and REPLACE statements in the update sequence, the examples produce identical results.
/* ----example 1------ */
proc access dbms=ims;
  update imslib.custs.access;
   insert address;
      item=address2     lv=3 dbf=$12    se=custadd2;
   delete contact;   
   repl 23 se=custphon;
   ins 23;
      item=newitem      lv=3 dbf=$30    se=custlsti;
run;

/* ---example 2--- */
proc access dbms=ims;
  update imslib.custs.access;
   delete contact;   
   repl 23 se=custphon;
   ins 23;
      item=newitem      lv=3 dbf=$30    se=custlsti;
   insert address;
      item=address2     lv=3 dbf=$12    se=custadd2;
run;

The following example shows how index numbers are interpreted by different parts of an UPDATE statement. In the example, the DELETE statement processes the third item in the original descriptor. The DROP statement, however, processes the fourth item in the post-update order, which in this case would have been the fifth item in the original sequence.

proc access dbms=ims;
  update imslib.custs.access;
    delete 3;  /* pre-update item 3 */
    drop 4;    /* post-update item 4 */
  list all;
run;

Pre-update and post-update listings are shown below.

/* ---prior to UPDATE --- */
IMS Database: CUSTOMER
Function: Create Descriptors-access: CUSTS1  view:
   L# Item Name                DBFormat   Format
1  01 CUSTOMER                 *RECORD*   *RECORD*
2  02 CUSTOMER-INFO            *GROUP*    *GROUP*
3  03 CUSTOMER-CODE            $8.        $8.
4  03 STATE                    $2.        $2.
5  03 ZIP                      10.0       12.0
6  03 COUNTRY                  $20.       $20.

/* ---after UPDATE --- */
IMS Database: CUSTOMER
Function: Create Descriptors-access: CUSTS1  view:
   L# Item Name                DBFormat   Format
1  01 CUSTOMER                 *RECORD*   *RECORD*
2  02 CUSTOMER-INFO            *GROUP*    *GROUP*
3  03 STATE                    $2.        $2.
4  03 ZIP   *NON-DISPLAY*      10.0       12.0
5  03 COUNTRY                  $20.       $20. 

space
Previous Page | Next Page | Top of Page