18.08.2013 Views

LINC Programming Reference Manual - Public Support Login - Unisys

LINC Programming Reference Manual - Public Support Login - Unisys

LINC Programming Reference Manual - Public Support Login - Unisys

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

COMPUTE (COMP) and COMPUTE.FROM (CMP, CF)<br />

COMPUTE (COMP) and COMPUTE.FROM (CMP, CF)<br />

Syntax<br />

The COMPUTE; and COMPUTE.FROM; commands enable the entry of free-form<br />

expressions involving arithmetic operations and data items.<br />

The result of the calculation is stored in a numeric data item.<br />

$ For the COMPUTE; command, the data item is named as part of the command.<br />

$ For the COMPUTE.FROM; command, the data item must be a Setup Data item, defined<br />

immediately before the COMPUTE.FROM; command.<br />

Note: The COMPUTE.FROM; command is not implemented in LDA Run<br />

Time.<br />

Calculations are performed in the standard mathematical order of precedence for<br />

arithmetic operators, and from left to right.<br />

When using the COMPUTE; and COMPUTE.FROM; commands:<br />

$ The System Data item GLB.STATUS is not affected by either of these commands. Use<br />

the GLB.STATUS; command (in LDA, the GS; command) to test for a divisor of zero or<br />

arithmetic overflow. If either occurs, the result is set to zero. (You could include logic<br />

to test for a divisor of zero before the COMPUTE; or COMPUTE.FROM; commands are<br />

executed.)<br />

$ A maximum of fifteen operands may be used in a COMPUTE; command.<br />

In LDA, the maximum is 98 operators and 99 operands.<br />

$ Data items and operators in the COMPUTE; or COMPUTE.FROM; command must be<br />

separated by at least one space.<br />

$ If the receiving data item in a COMPUTE; or COMPUTE.FROM; command does not<br />

allow sufficient decimal places for precision, the result will be truncated (rather than<br />

rounded).<br />

$ In host <strong>LINC</strong>, if you do not use the GLB.STATUS; command in your arithmetic logic<br />

and you divide by zero, your program will abort.<br />

DDDDD DDDDDDDDDDBD DDDD <br />

3<br />

DDDDD DD DDY<br />

ZDDDD?<br />

ZDDDDDDDDDDDY @DDDDDDDDDDDDD?<br />

3 3<br />

DDDDDDDADDD DD DDAD DDDDDDD4<br />

data item<br />

A previously defined data item into which the result is to be placed.<br />

v 1-65

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

Saved successfully!

Ooh no, something went wrong!