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

Within the routine DISPLAY, an output unit is selected, the first page of the report is set to 1 by setting<br />

page.v to 1, and its lines.v are set to the number of lines per page required. Within the<br />

report section, skip statements are used to separate heading information.<br />

If the sequence of values read by this program is 50 100 7, a report will be printed on unit 7,<br />

which will display the values j, √j, j 2 , and log(j) for j = 1, 2, ..., 100 on three pages.<br />

Assuming that printing starts at the top of the first page, this page will start with the heading<br />

"Tabulation of Mathematical Functions," the page number, the heading I SQRT(I) I<br />

SQ LOG(I), and values for j = 1, 2, ..., 41. The second page will contain the page number,<br />

the heading I SQRT(I) I SQ LOG(I), and values for j = 42, 43, ..., 86. The third page<br />

will resemble the second, except that it will include values for j = 87, 88, ... 100.<br />

The sequence of input values 20 40 8 will produce a report similar to the first, except that it will<br />

display the values for j = 1, 2, ..., 40 on pages that contain only 20 lines. The heading<br />

"Tabulation of Mathematical Functions" will be printed on the current page, renumbered<br />

1, of output unit 8.<br />

Whenever it is necessary to begin each report section on a new page, as might be done in this example,<br />

the begin report statement can be written as:<br />

begin report on a new page<br />

which ejects a page on the current output device unless the current page has no text (line.v = 1,<br />

wcolumn.v = 0). This prevents blank pages from being ejected between report sections.<br />

The structure of a "typical" report-generating program, using the statements described thus far, is<br />

illustrated below. The end statements are inserted for clarity.<br />

begin report on a new page<br />

.<br />

program statements<br />

.<br />

begin heading<br />

.<br />

if page is first<br />

.<br />

always<br />

.<br />

skip N lines<br />

.<br />

end<br />

'' HEADING<br />

.<br />

more program statements<br />

.<br />

end<br />

'' REPORT<br />

128

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

Saved successfully!

Ooh no, something went wrong!