Progress
Language Reference


= Assignment Operator

Interfaces
OS
SpeedScript
All
All
Yes

Assigns the value of an expression to a database field or variable.

DATA MOVEMENT

SYNTAX

field = expression [ NO-ERROR ] 

field

The name of a database field or variable to which you want to assign the value of the expression. If the field is an array, and you do not name a particular element, Progress stores expression in each element of the array. If you name a particular element, Progress stores expression in that element.

The left side of an assignment can also an attribute or one of the following Progress keywords: FRAME-VALUE, SUBSTRING, or OVERLAY. (See the FRAME-VALUE Statement, SUBSTRING Statement, or OVERLAY Statement reference entries for more details.)

expression

An expression with a data type that is consistent with the data type of the field. If field is integer and expression is decimal, then Progress rounds the value of the expression before assigning it. If field is decimal and expression is decimal, then Progress rounds the value of the expression to the number of decimal places defined for the field in the Dictionary or defined or implied for a variable.

NO-ERROR

Specifies that any errors that occur as a result of the assignment are suppressed. After the assignment statement completes, you can check the ERROR-STATUS system handle for information on any errors that might have occurred. In any case, if an error occurs the assignment is canceled and any changes to field values within the assignment are undone. If the assignment occurs within a transaction, any changes to variables, work table fields and temporary tables fields are also undone, unless you define the variable or field with the NO-UNDO option.

EXAMPLE

This procedure resets all the monthly quota values to 0 in all salesrep records. If you want to set values for individual array elements, you can do so by making an explicit assignment using the assignment statement and a specific array reference, such as month-quota[1] or month-quota[i].

r-asgmnt.p
DEFINE VARIABLE ctr   AS INTEGER.

FOR EACH salesrep:
  DO ctr = 1 TO 12:
    salesrep.month-quota = 2500.
  END.
END. 

NOTES

SEE ALSO

ASSIGN Statement, Data Types


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