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>SIMSCRIPT</strong> <strong>II.5</strong> <strong>Programming</strong> <strong>Language</strong><br />

move from arithmetic expression<br />

The value of the arithmetic expression is stored in the variable referenced by the routine name and<br />

its arguments, if any. For example, EXAMPLE(I,J). The form of a typical left-handed monitoring<br />

routine is:<br />

left function EXAMPLE(I,J)<br />

enter with Q<br />

.<br />

.<br />

statements using I,Q<br />

.<br />

.<br />

move from expression<br />

end<br />

A value is transmitted to the function by the enter statement, computations are performed, and a<br />

value is assigned to the monitored variable by the move statement.<br />

The following short programs use monitored variables in several different ways for data editing,<br />

where the monitored variable feature provides two important benefits: (1) It keeps the main body<br />

of the program clear of data-checking and message printing statements, making it easier to understand;<br />

and (2) Conversion of the program to remove the editing feature can be accomplished by<br />

changing only one preamble statement and discarding two routines, with the main body of the program<br />

text unchanged. However, the program must be recompiled.<br />

This program first reads successive sets of data representing subscript values for a two-dimensional<br />

array and the associated data value. The subscripts are checked by the left-monitoring routine before<br />

values are assigned. Default values are computed for any unassigned values. The initialization<br />

data are delimited by a single non-numeric field, and followed by query data, requesting the value<br />

identified by two given subscripts. These subscripts are also checked, this time by the right-monitoring<br />

routine.<br />

284

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

Saved successfully!

Ooh no, something went wrong!