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

2.21.8 Blank Character Elimination: TRIM.F(string, flag)<br />

This function trims leading and/or trailing blanks from text string, according to the value of flag<br />

(an integer variable). Thus:<br />

Flag<br />

Action<br />

-1 Remove leading blanks only<br />

0 Remove leading and trailing blanks<br />

+1 Remove trailing blanks only<br />

Thus, for example:<br />

trim.f (" CAT ", 1)yields the string " CAT"<br />

trim.f (" DOG ", -1)yields the string "DOG "<br />

trim.f (" CAT AND DOG ",0)yields the string "CAT AND DOG"<br />

2.21.9 INTEGER to TEXT Conversion ITOT.F(integer)<br />

This function returns a text string representation of its single integer argument. The length of the<br />

returned string is determined by the number of digits required to represent the integer value. Strings<br />

representing negative integers are prefixed with a "-". Thus, for example, if INT = 26 and TVAR<br />

is a text variable:<br />

let TVAR = itot.f(INT)<br />

assigns "26" to TVAR.<br />

2.22 Alpha Variables<br />

As text variables may not be used in arithmetic expressions, <strong>SIMSCRIPT</strong> <strong>II.5</strong> provides for an<br />

alpha mode. An example of such a requirement might be the indexing of an array using a character<br />

subscript. An alpha variable provides for the representation of alphanumeric data which may be<br />

manipulated in a way similar to numeric data.<br />

Earlier implementations of <strong>SIMSCRIPT</strong> did not support a text mode, and hence did all character<br />

processing in alpha mode. The number of characters represented by each alpha variable was<br />

machine dependent. Although this interpretation of the alpha mode may still be supported for<br />

compatibility reasons, alpha variables should now be assumed to be restricted to a single character.<br />

Usage that requires multiple-character representation is provided by the text mode, and it is recommended<br />

that text mode be used for character processing where possible. Variables are defined<br />

to be alpha in the usual ways:<br />

or<br />

normally, mode is alpha<br />

74

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

Saved successfully!

Ooh no, something went wrong!