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

3. read N.COUNTRY and N.SHIP<br />

create each COUNTRY and SHIP<br />

list attributes of each COUNTRY<br />

4. list attributes of each SAILOR in CREW(QUEEN.MARY)<br />

5. list attributes of SHIP called 4<br />

4.14 Some Sample Programs<br />

The programs in this paragraph illustrate the concepts and statements described above. You can<br />

follow them closely and identify the features used in each one. As a useful exercise you can reformulate<br />

and reprogram the examples using different concepts and statements.<br />

4.14.1 An Inventory Control Example<br />

This simple model processes two transaction types — orders for goods and reception of new stock.<br />

The data associated with each are transaction type, an item code number, and a quantity. As this<br />

business deals with a fixed range of items, these may be modelled using permanent entities. Note<br />

the extensive reliance on implicit subscripting throughout.<br />

Program 4-1.<br />

_______________________________________________________________________________<br />

preamble<br />

normally mode is integer<br />

permanent entities<br />

every ITEM has an ITEM.NAME<br />

a REORDER.POINT,<br />

a CONTROL.LEVEL,<br />

a STOCK.LEVEL,<br />

a DUE.IN,<br />

a DUE.OUT<br />

define ITEM.NAME as a text variable<br />

end<br />

main<br />

define TRANSACTION as a text variable<br />

read N.ITEM<br />

create each ITEM<br />

for each ITEM<br />

read ITEM.NAME(ITEM), REORDER.POINT(ITEM),<br />

CONTROL.LEVEL(ITEM), STOCK.LEVEL(ITEM),<br />

DUE.IN(ITEM), DUE.OUT(ITEM)<br />

until data is ended<br />

do<br />

read TRANSACTION, ITEM, QUANTITY<br />

if TRANSACTION = "ORDER"<br />

176

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

Saved successfully!

Ooh no, something went wrong!