omron — GLOBAL program instruction

GLOBAL program instruction GLOBAL program instruction Syntax GLOBAL type variable, ..., variable Function Declare a variable to be global and specify the type of the variable. GLOBAL statements must appear before any executable statement in the program. Parameters type Optional parameter specifying the type of a variable. The acceptable types are: LOC Location variable (transformation, precision point, belt) REAL Single-precision real variable DOUBLE Double-precision real variable See the Details section for the default type. variable Variable name (belt, precision point, real-value, string, and transformation). Each variable can be a simple variable or an array.

If the type parameter is specified, all the variables must match the specified type. Array variables must not have their indexes specified. Details Variables that are not declared to be AUTO or LOCAL are GLOBAL by default. Undeclared scalar variables default to double precision. Thus, double-precision and location global variables do not need to be declared. Global variables can be seen by any program that does not declare a LOCAL or AUTO variable of the same name. Thus, if program_a declares var1 to be a GLOBAL variable and program_b declares var1 to be AUTO, program_b cannot use or alter GLOBAL var1.

A new copy of variable var1 that is specific to program_b is created each time program_b executes. eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 269