Assign a value to one or more variables


      STORE <exp> TO <idVar list>
         <idVar> = <exp>
         <idVar> := [ <idVar2> := ...] <exp>


<exp> is a value of any data type that is assigned to the specified variables.

TO <idVar list> defines a list of one or more local, static, public, private, or field variables that are assigned the value <exp>. If any <idVar> is not visible or does not exist, a private variable is created and assigned <exp>.


STORE assigns a value to one or more variables of any storage class. The storage classes of Clipper variables are local, static, field, private, and public. STORE is identical to the simple assignment operators (=) and (:=). In fact, a STORE statement is preprocessed into an assignment statement using the inline operator (:=). Like all of the assignment operators, STORE assigns to the most recently declared and visible variable referenced by <idVar>. If, however, the variable reference is ambiguous (i.e., not declared at compile time or not explicitly qualified with an alias), it is assumed to be MEMVAR. At runtime, if no private or public variable exists with the specified name, a private variable is created.

To override a declaration, you can specify the <idVar> prefaced by an alias. If <idVar> is a field variable, use the name of the work area. For private and public variables, you can use the memory variable alias (MEMVAR->). To assign to a field variable in the currently selected work area (as opposed to a particular named work area), you can use the field alias (FIELD->).

As a matter of principle, all variables other than field variables should be declared. Preface field variables with the alias. Use of private and public variables is discouraged since they violate basic principles of modular programming and are much slower than local and static variables.

Note that the STORE command is a compatibility command and not recommended for any assignment operation. Clipper provides assignment operators that supersede the STORE command, including the inline assignment operator (:=), the increment and decrement operators (++) and (–), and the compound assignment operators (+=, -=, *=, /=). Refer to the Operators and Variables sections of the “Basic Concepts” chapter in the Programming and Utilities Guide for more information.


. Assigning a value to an entire array: In Clipper, neither the STORE command nor the assignment operators can assign a single value to an entire array. Use the AFILL() function for this purpose.

. Memo fields: Assigning a memo field to a variable assigns a character value to that variable.


      .  These statements create and assign values to undeclared
         private variables:

      STORE "string" TO cVar1, cVar2, cVar3
      cVar1:= "string2"
      cVar2:= MEMVAR->cVar1

      .  These statements assign multiple variables using both STORE
         and the inline assignment operator (:=).  The methods produce
         identical code:

      STORE "value" to cVar1, cVar2, cVar3
      cVar1 := cVar2 := cVar3 := "value"

      .  These statements assign values to the same field referenced
         explicitly with an alias.  The first assignment uses the field alias
         (FIELD->), where the second uses the actual alias name:

      USE Sales NEW
      FIELD->CustBal = 1200.98
      Sales->CustBal = 1200.98



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.