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

To title all pages of output on the foregoing example, the program can be written as:<br />

begin report<br />

begin heading<br />

print 1 line as follows<br />

I X(I)<br />

end '' HEADING SECTION<br />

for I = 1 TO N,<br />

print 1 line with I, X(I) as follows<br />

** **.***<br />

end '' REPORT SECTION<br />

The statements in a heading section are executed the first time they are encountered and thereafter<br />

every time a page is changed. Pages are changed whenever the current line count exceeds the number<br />

of printed lines a page can contain. Two system-defined variables line.v and lines.v, maintained<br />

for each logical output unit, hold the values of the current line count and the permitted<br />

number of lines per page, respectively. Line.v is initialized to 1 when an output device is first<br />

used. It is stepped from 1 to the current maximum value, specified by lines.v, each time a new<br />

line is printed. You may change lines.v at any time to vary the number of lines that may appear<br />

on each output page. The <strong>SIMSCRIPT</strong> <strong>II.5</strong> system usually sets lines.v = 55 for the default<br />

output unit, and for units selected for print output, at the start of program execution. This may vary<br />

on different <strong>SIMSCRIPT</strong> <strong>II.5</strong> implementations.<br />

Pages are numbered sequentially, starting from 1, with the number of the page currently being written<br />

contained in a system variable page.v. As with line.v, a separate count of page.v is kept<br />

for each output device. Page.v may be reset at any time. When this is done, numbering continues<br />

in sequence from the new value. Page.v and line.v always refer to the current output unit. A<br />

unit should be selected with a use statement before any explicit reference to these variables.<br />

Page changing can be disabled at any time by setting lines.v = 0.<br />

Within a heading section, the statement:<br />

if page is first<br />

may be used to select statements to be executed only on the first page of a report section's output.<br />

The following program illustrates one way of using the report facilities described thus far.<br />

126

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

Saved successfully!

Ooh no, something went wrong!