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

the for statement are bypassed. The control variable can be either local or global, and cannot be<br />

subscripted. Form 2a does the same task as form 1, except that it starts with the set member<br />

identified by the indicated expression. Form 2b is similar to 2a, but starts with the set member that<br />

follows the identified member. If the identified member is not in the set (denoted by a 0 in its<br />

membership attribute), the program terminates with an error message. In both 1 and 2, the words<br />

every and all can be used instead of each, and the words in, on, and at used as synonyms for<br />

of.<br />

To step backward through a set, the phrase:<br />

in reverse order<br />

is placed after the set name. Set control can range from simple statements such as:<br />

for every JOB in QUEUE<br />

to complicated statements such as:<br />

for all FISH after MINNOW(I) in POND in reverse order<br />

Many variations of for statements are possible. In the following illustrations, we assume that<br />

permanent entities with identification numbers 1, 2, 3, 4, 5, and 6 are filed in a set in the order<br />

of 1, 3, 2, 4, 6, 5. They may have arrived in this order and been stored as FIFO, or they may<br />

have been ranked on some attribute value. The method of ranking is not important in this example.<br />

Table 4-1 shows different control statements and indicates the sequence of entities that are passed<br />

on to the controlled statements by each. The entities are filed in a set named FILE. The local variable<br />

J is used within the control loop for the selected entity index numbers.<br />

Table 4-2 lists the set attributes that are required for the different set operations described.<br />

166

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

Saved successfully!

Ooh no, something went wrong!