Progress
Database Design
Guide


Using the 4GL ASSIGN Statement

When you want to make changes to several indexed components in a 4GL procedure, use the ASSIGN statement to define these new values. This method allows you to change several values with minimum I/O processing. Otherwise, Progress re-indexes records at the end of each statement that changes the value of an index component.

The following code demonstrates how you can change two index values with the ASSIGN statement:

r-sgn2.p 
  DEFINE VARIABLE neword LIKE order-line.order-num
      LABEL "New Order".
  DEFINE VARIABLE newordli LIKE order-line.line-num
      LABEL "New Order Line".
  REPEAT:
    PROMPT-FOR order-line.order-num line-num.
    FIND order-line USING order-line.order-num AND line-num.
    SET neword newordli.
    FIND order WHERE order.order-num = neword.
   ASSIGN order-line.order-num = neword
          order-line.line-num = newordli.
  END. 

This procedure changes the order number and line number of an order-line record. (It copies an order-line from one order to another.) It sets the new values into variables and modifies the record with a single ASSIGN statement that contains two assignment phrases in the form field=expression. So both fields are changed within a single statement. Because order-num and line-num are used jointly in one index, this method avoids having the indexing done until both values change.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095