Script Variables

A variable is a name for a place to store information. Specifically, a variable can store a number, a string of characters, a file name, or the L-number result of a search. Use a variable when a specific value is unknown or will change within a script. For example, if you write a script that performs an author search, make the script flexible by using a variable for the author’s name instead of typing the author’s name in the script.

Variables are named with an underscore followed by one to twelve alphanumeric characters. They are considered "declared" after their first use. Once a variable is declared, the same name may not be used to refer to another variable.

Variable names are not case-sensitive. For example, the variable named _var  is the same as the variable named _VAR.

Variables are always considered to be of type string (text), except for variables that represent search results (L-numbers). Variables are automatically converted to numbers (integers) when necessary for arithmetic operations or conditions. Attempts to perform arithmetic operations on non-numeric text result in errors when the script is run.

To give a variable a value, use an assignment statement  or the \> operator, described at the => statement. See also the # operator, explained under the => statement.

Up to 200 variables are permitted within a script. If there are more variables, this is noted when you run the script online rather than when you use Check Command File.

Variable values may not exceed 255 characters in length.

There are predefined logon setup variables and predefined STN variables.

Copyright © 2017 American Chemical Society. All Rights Reserved.