18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Programming</strong> <strong>Language</strong> Concepts<br />

Multiple-subscripted variables, both rectangular and ragged, may be printed using the list statement.<br />

Any row in an array that has not yet been reserved by a reserve statement, produces an<br />

output of the form:<br />

array name(i,j,...*) = ***unreserved***<br />

If more than one array is mentioned in a list statement, they are printed successively in the order<br />

in which they appear in the list.<br />

As the spacing conventions must constrain the number of character positions allocated to a noninteger<br />

number, those having very large or very small values are output in exponent or scaled scientific<br />

notation. In this format, the value is represented as a normalized value between 1.0 and 0.1<br />

scaled by a power of 10, which may be positive or negative. This exponent is usually indicated as<br />

E+xx or E-xx, where xx represents the power of 10, immediately suffixed to the normalized value.<br />

As a word of caution, the list statement can be misleading in respect of numeric precision. The<br />

number of significant figures printed by a list statement cannot be chosen, as in a print statement,<br />

to limit the apparent accuracy and thus reflect the true significance, but rather is selected to<br />

allow a wide range of values to be output. Thus, some interpretation of the printed values may be<br />

required.<br />

2.30 Subprogram Variables<br />

Thus far, all references to subprograms have used the defined subprogram name to identify the subprogram<br />

to be executed. It is possible, however, to reference a subprogram indirectly, through the<br />

use of a subprogram mode variable. Such a variable, like any other variable type, may be assigned<br />

various values during execution of a program. The values that may be assigned are the referencing<br />

values of routines within the program. As the only valid use of a subprogram variable is as a reference<br />

within an indirect call, the only operations permitted are assignment and comparison operations,<br />

and the only values that may be assigned or compared are other subprogram variables or<br />

subprogram literal values, or a zero, indicating a null value. A variable is declared as a subprogram<br />

mode in the usual way:<br />

define variable list as a subprogram variable<br />

A subprogram literal is formed by enclosing in single quotes the name of any routine used within<br />

the program, or any defined library routine, with some exceptions mentioned later. A<br />

subprogram variable, which has been assigned a value, may then be used in place of a routine<br />

name in a normal call statement. The example below demonstrates the assignment and use of a<br />

subprogram variable:<br />

define RVAR as a subprogram variable<br />

let RVAR = 'DATA.TRANSFORM'<br />

.<br />

.<br />

call RVAR giving DATA(*) yielding VALUE<br />

95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!