18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

during program execution, before the data are read using a free-form read statement. These functions<br />

and logical values, sometimes called "look-ahead functions," are shown in table 2-4.<br />

Table 2-4. Look-Ahead Functions<br />

_______________________________________________________________________________<br />

Name<br />

data<br />

sfield.f<br />

efield.f<br />

mode<br />

Value<br />

End of data indicator: ended or not ended<br />

Starting column number of the next data field<br />

Ending column number of the next data field<br />

Mode of the next data field: integer, real, or alpha<br />

card<br />

First data field on card indicator: new or not new<br />

_______________________________________________________________________________<br />

Some examples illustrate the use of these system variables:<br />

1. Frequently, the logical condition for terminating processing is reaching the end of the input<br />

data. This condition may be tested for with logical comparisons of the form:<br />

if data is ended<br />

until data is ended<br />

while data is not ended<br />

2. Sfield.f can be used to distinguish input data records that appear in two formats. Some<br />

of the records contain data beginning in column 1, while in others the data fields start in<br />

column 25. These two record types are to be processed differently. A value for sfield.f<br />

is determined before each new value is read, but the data item itself is not read until a read<br />

statement is executed.<br />

if sfield.f eq 1<br />

read DATA1<br />

else<br />

if sfield.f eq 25<br />

read DATA25<br />

else<br />

skip 1 record<br />

always<br />

always<br />

3. Efield.f may be used in the same way to determine the last column position of the next<br />

data field. Using both functions, the number of characters in a data field may be determined<br />

before the field is read and processed.<br />

4. The mode property of a data field may be tested to discriminate between integer and<br />

real numeric data, or any non-numeric data, identified as alpha. A succession of name<br />

87

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

Saved successfully!

Ooh no, something went wrong!