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 />

every MAN and WOMAN owns a FAMILY and has a<br />

BANK.ACCOUNT<br />

the statement:<br />

create each MAN and WOMAN<br />

reserves arrays for the attributes of MAN and WOMAN and the compound entity MAN, WOMAN. The<br />

create statement is in fact interpreted as several reserve statements:<br />

reserve JOB(*) and SALARY(*) as N.MAN<br />

reserve F.INVESTMENTS(*),L.INVESTMENTS(*) and<br />

N.INVESTMENTS(*) as N.WOMAN<br />

reserve F.FAMILY(*,*),L.FAMILY(*,*), N.FAMILY(*,*) and<br />

BANK.ACCOUNT(*,*) as N.MAN by N.WOMAN<br />

Attributes of permanent compound entities can be released in the normal way with a destroy<br />

each statement such as:<br />

destroy each MAN and WOMAN<br />

4.12 Implied Subscripts<br />

Preceding sections described how attributes are defined and illustrated their use. Examples showed<br />

that attributes resemble subscripted variables when they appear in programs. Every attribute reference<br />

is of the form:<br />

attribute name(entity identification)<br />

For attributes of individual entities, the entity identification is either an index or a pointer value. For<br />

attributes of compound entities, the entity identification is a list of index or pointer values.<br />

The automatic definition of global variables with the same names as declared entities was also mentioned.<br />

It was seen that in the context of create, destroy, and for each, where no variable<br />

was explicitly named, the name of the appropriate global variable was understood.<br />

Because all attributes of permanent or temporary entities are declared in the program preamble, either<br />

explicitly, or implicitly by declaring set membership or ownership, it is possible to assume a<br />

default or implied subscript if one is omitted from an attribute or set reference. The implied subscript<br />

used is the variable having the same name as the entity associated with the attribute or setreferenced.<br />

In the case of compound entities, subscripts are implied in the order they appear in the<br />

defining every statement. For obvious reasons, common attributes, shared by more than one entity,<br />

cannot have implied subscripts. Some examples of entity definitions and implied subscripts follow.<br />

172

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

Saved successfully!

Ooh no, something went wrong!