Download SIMSCRIPT III reference Manual
Transcript
whereas a saved local variable is initialized to zero at the beginning of the program and retains its value from one call of the routine to the next. All recursive instantiations of a routine share the same group of saved local variables, but have separate recursive local variables. Arguments are recursive local variables and may not be declared as saved. The variable holding the pointer to a local array is treated as saved or recursive. It is necessary to define the mode of a variable if it differs from the background mode or if the background mode is set to "undefined". It is necessary to define the dimensionality of a variable if it differs from the background dimensionality. It is necessary to define the type (recursive or saved) of a local variable if it differs from the background type. An array is dynamic structure which elements can be accessed using indexes. They can be 1-dim, 2-dim, etc. All elements of an array have the same mode. Each array has a pointer to the array as it is structured in memory. This pointer is accessed by simply using the name of the array, as in X, or X(*), or X(*,*), etc. A variable should be defined by one define variable statement. A global variable is defined in a preamble; a local variable is defined in a routine. The names of local variables within a routine have local scope and must be unique; however, the same names can be used for local variables in different routines and refer to different variables. A local variable can be defined with the same name as a global variable; however, the global variable is accessible using its qualified name. The "define variable" statement may appear anywhere in a routine, and may even appear within a do...loop block. A monitored variable has both a storage location and a function associated with it having the same name and mode, with left and/or right implementations. The function has as many integer arguments as the dimension of the monitored variable. A monitored variable defined as "real" is treated as "double." Local variables cannot be monitored. A function object method is defined for a monitored object attribute, and a function class method is defined for a monitored class attribute. A subprogram variable holds the address of a non-method subroutine or right function, or contains zero (the initial value) to indicate that it does not refer to any routine. It may refer to routines in library.m. A 0-dim subprogram variable may be called using a Call statement. A random variable uses stream 1 unless a different stream is specified in a "define variable" statement. A stream variable may be specified in the "define variable" 52