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

able, the first character of the input field will be read. In some earlier implementations, and where<br />

an alpha variable may represent more than one character, a number of characters up to the maximum<br />

representation size will be read. The column position pointer is advanced by the specified<br />

field width.<br />

When used in output statements, the A format will normally print the single character represented<br />

by the alpha variable in the first column of the output field, padding any further positions with<br />

blank spaces. When more than one character alpha representation is supported, a number of characters,<br />

up to either the maximum representation, or the field width, may be printed.<br />

3.4.2.6 C (Computer Representation) Descriptor<br />

Few computers use decimal notation internally. Most use binary coding schemes that represent decimal<br />

numbers as sequences of zeros and ones. Generally, a group of binary bits constituting a character<br />

in a number system other than binary or decimal is used as an input/output character. Because<br />

strings of such numbers are short, they are easy to interpret. Commonly used representations are<br />

octal and hexadecimal, for groups of 3 and 4 binary bits, respectively.<br />

The format n C e interprets characters read or written in the unit of the computer on which a particular<br />

<strong>SIMSCRIPT</strong> <strong>II.5</strong> system is implemented. The field width, e, specifies the number of character<br />

positions occupied. Each position corresponds to a single octal or hexadecimal symbol, depending<br />

on the particular machine implementation.<br />

3.4.3 Format Lists<br />

Format lists are composed of sequences of format descriptors separated by commas. During the<br />

execution of read and write statements, format lists are scanned from left to right and individual<br />

format descriptors are used as needed to match the variables named in the variable list. With few<br />

exceptions, variables being read or expressions being written must agree in mode with their format<br />

descriptors. The exceptions are integer and alpha modes that can be used interchangeably.<br />

When they are interchanged, the mode of the format descriptor governs. When a format descriptor<br />

is preceded by a repetition character n, n consecutive read and write statements that use formatted<br />

data follow. Some examples of format lists are given below.<br />

1. read X, ANSWER and Y as I 3, I 2, I 2<br />

If one assumes they have data in an input data file, and the above statement — the first in<br />

a program — starts reading at column 1 of the first input record, the value appearing in columns<br />

1-3 is assigned to X, that in columns 4-5 is assigned to ANSWER, and the value in columns<br />

6-7 is assigned to Y. The data might appear as:<br />

column 0 1 ...<br />

number 12345678901234<br />

160 3 8<br />

110

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

Saved successfully!

Ooh no, something went wrong!