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.

Advanced Topics<br />

Program 6-2.<br />

_______________________________________________________________________________<br />

preamble<br />

temporary entities<br />

every JOB has a VALUE, a RANKING.FUNCTION, owns a<br />

ROUTING, and belongs to a QUEUE<br />

every PATH has an ORIGIN, a DESTINATION, a DISTANCE,<br />

and belongs to a ROUTING<br />

permanent entities<br />

every MACHINE owns a QUEUE<br />

define QUEUE as a set ranked by high RANKING<br />

define ROUTING as a set ranked by low DISTANCE<br />

define RANKING as an integer function<br />

end<br />

routine RANKING(J)<br />

define J as an integer variable<br />

return with ORIGIN(F.ROUTING(J))<br />

end<br />

_______________________________________________________________________________<br />

6.8 Using “Optional” Attributes<br />

In certain situations involving the processing of large amounts of data, the programmer may need<br />

to define entities with a large number of attributes, many of which, however, are constant. For example,<br />

in census data records the code n/a (not applicable) may appear in several places. When it<br />

is desired to conserve the amount of space allocated to individual entity records, function attributes<br />

may be used to define "optional attributes." These are actually represented by entities stored in a<br />

special set only if their values differ from specified default values. Thus, in the following example,<br />

if the optional attribute RAPID.TRANSIT is other than zero for a particular city, a record for it will<br />

appear in that city's optional attribute set. Otherwise, the value of RAPID.TRANSIT would be found<br />

in the default list (DEFAULT(1)=0).<br />

The following declarations and programs show how to set up and use optional attributes.<br />

275

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

Saved successfully!

Ooh no, something went wrong!