VAR - Variable Assignment

(05/38/10)

PURPOSE

Assign values to Register (Numeric) or Symbolic (String) variables.

SEE ALSO

FR L [Read (sets) a local string variable]
FR G [Read (sets) a global string variable]
FR LS [Sets local string variable using current string values]
FR GS [Sets global string variable using current string values]
RR G [Read Register variables - Global]

USAGE

.OPERATION: [varname] = number
    <or>
[varname] = 'chars'
    <or>
[varname] = [old-varname]
    <or>
[varname] = 'opt-chars'[varname]'opt-chars'
    <or>
GLOBAL [varname] = 'chars'
    <or>
GLOBAL [varname] = number

[Where:

[varname]
Numerical (register) or string (symbolic) variable name which will be assigned a value. Variable names must start with an alphabetical letter and can contain the 36 alphanumerical characters, '-', and '_'. The [] brackets are necessary.

'chars'
A character string to be associated with the string (symbolic) variable. The quotes are necessary.

number
A numerical value to be associated with the numerical (register) variable.

[old-varname]
The name of an existing numerical (register) or string (symbolic) variable . The [] brackets are necessary. If [old-varname] is a string variable and [varname] does not already exist then [varname] will also be a string variable.

'opt-chars'
An optional character string to be become part of the string (symbolic) variable. The quotes are necessary.

GLOBAL (Abbreviate: GLO)
An optional flag indicating that the variable is visable in all procedures following its definition.

A 'chars' or 'opt-chars' can have embedded blanks or double (") quotes.

Anything within a 'chars' is evaluated (bound) only when the string is used.

Anything within an [old-varname] not surrounded by quotes is evaluated when variable is created (NOT used).

Some typical examples:

   [str_variable] = 'filename'
   [str_variable] = 'img{***[reg-variable]}'
   [str_variable] = 'img[old-str-variable]'
   [str_variable] = 'IMG{***[old-str-variable]}'
   [str_variable] = [old-str-variable]
   global [str_variable] = 'filename'
   GLOBAL [str_variable] = 'filename'

   [reg_variable] = 10
   [reg_variable] = 45.7*32
   [reg_variable] = -1.5678E-02
   GLOBAL [reg_variable] = -2.567
   GLO [reg_variable] = 3.14

Some more complex examples:

   [new_str_variable] = '[old-str-variable]dat'
   [new_str_variable] = [old-str-variable]'.dat'
   [new_str_variable] = 'IMG'[old-str-variable]
   [new_str_variable] = 'IMG'{***[old-reg-variable]}'
   [old_str_variable] = 'temp-dir/'[old-str-variable]

NOTES

  1. GLOBAL register variables can only be created/modified by a GLOBAL [varname] = number or the obsolete: 'RR G' operations. 'DO', 'UD', and 'UD IC', can not create/set a global register variable. This restriction is necessary to preserve backward compatibility.

SUBROUTINES

SYMPAR, SETSYMPAR, SUBSYMPAR, GETNEXTTOKEN

CALLER

SPIDER

© Copyright Notice /       Enquiries: spider@wadsworth.org