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>Programming</strong> <strong>Language</strong> Concepts<br />

Print statements appear in heading and report sections, and usually are controlled by for or<br />

while statements in the part of the report section labeled "program statements." The flow of control<br />

in a report section like the one which appears on this page is as follows:<br />

1. Execute statements between begin report and begin heading, if any<br />

2. Execute statements in the heading section, if any<br />

3. Execute statements between end ''HEADING and end ''REPORT if any, executing statements<br />

in the heading section every time a page is changed.<br />

These statements are adequate for many reports. A report for which they are not suited is one that<br />

must print more than 80 columns of information per line. Adding the word double to a print<br />

statement in the following way:<br />

print I double lines with expression list as follows<br />

specifies that 2i, rather than i, format lines follow that are to be read in pairs and interpreted as one<br />

format line 160 columns long. To fill an entire line on a printer 132 columns wide, write a statement<br />

such as:<br />

print 1 double line as follows<br />

AAAAAAAAAAAAA...................................AAAAAA<br />

AAAAAAAAA................AAAAAAAAA<br />

The first format record has an A typed in each of its 80 columns. The second format record has an<br />

A typed in its first 52 columns. "Double width" print statements are not restricted to report sections.<br />

Any print statement can be expanded to double width. If the last column statement is<br />

used, the first format record is scanned up to the specified column, instead of column 80.<br />

The inclusion of an optional clause in the begin report and print statements adds one more<br />

important report-generation feature. Figure 3-1 shows the kind of report the clauses handle—reports<br />

that have rows of data with more items in each row than a single page can contain.<br />

In preparing this type of report, a series of pages is printed with different column indices. In Figure<br />

3-1, pages 1 and 2 are printed with column indices ranging from 1 to 50, and pages 3 and 4 are printed<br />

with column indices ranging from 51 to 100. This feature, specifying an iteration sequence for<br />

column indices and having pages printed on a wide page, is known as column repetition, and is<br />

specified by an optional clause in the begin report statement:<br />

begin report printing for, in groups of e per page<br />

The word for represents a for, while, or until statement, perhaps qualified, that generates<br />

column indices. The arithmetic expression e specifies the number of indices in this iteration sequence<br />

to be used on each page. Thus, the statement:<br />

begin report printing<br />

for I = 1 to 50, in groups of 10 per page<br />

129

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

Saved successfully!

Ooh no, something went wrong!