Products Downloads


French version


 


ADELIA

VADELIA

SADELIA

WADELIA

EADELIA

(I/B)

(I/B) (C/S)

(B) (S)

(I/B) (C/S)

(B) (C/S)


Section for use

All


Syntax

NumVarId = Expression


Description

Arithmetic instructions can only be used with numeric variables. Arithmetic calculations are performed algebraically.


The = operator is considered to be an arithmetic operator where the variables are numerical. The variable located to the left of the sign = is always the result variable.


The following operations can be used: + , - , * , / (multiplication and division take priority over addition and subtraction operations).


Expressions in brackets are evaluated before other expressions. Up to 16 sets of brackets can be nested.


Any data placed in a result field replaces any data already in the field. Operands are not modified by operations.


In the following cases:

- with the Java generated part (Web client, Java client, Java server),

- with the AS/400 server part of VADELIA, SADELIA, EADELIA et WADELIA programs,

a processing error is returned if the resulting field is too small to contain the result.


For intermediate calculations of an arithmetic expression:

- in Adelia-type programs, use the intermediate variables defined as follows:

in C

Length 15 including 9 decimal points,

in RPG

Length 63 including x decimal points with x defined as follows:

x = Max(  Min(9, 63-Lgth_R+Dec_R) , Dec_R, Min(63-Lgth_R+Lg_R, Dec_E))

where

Lg_R is the length of the result variable.

Dec_R is the no. of decimals in the result variable.

Dec_E = the max. no. of decimals used by a calculation expression variable.


-in VADELIA, WADELIA, SADELIA and EADELIA programs, use the intermediate variables defined as follows:

on an AS/400 platform

Corresponds to the RPG *RESDECPOS mode: the system will calculate a sufficient level of precision for the calculation with a maximum length of 63, if necessary reducing the number of decimals to favour the value of the whole part, but the number of decimals cannot be lower than the result variable's number of decimals.

on a Windows C platform

xxxxx

on a Java platform

xxxx


The decimal alignment is performed for all decimal operations.


The rounding for result fields (half adjustment) can be specified except for REMAINDER and for / immediately followed by REMAINDER.

To obtain rounded figures, enter letter H in front of the = sign: results in the range 0 to 0.49 will be rounded down to 0, and results between 0.50 and 0.99 will be rounded up to 1.


Example:

RESULT H = VAR_1 / VAR_2

* RESULT is a 6-position numeric variable with 0 decimal positions.

* If ( VAR_1 / VAR_2 ) is contained between 0.00 and 0.49

* then RESULT is equal to 000000;

* If ( VAR_1 / VAR_2 ) is contained between 0.50 and 0.99

* then RESULT is equal to 000001.


In an analytical expression, you can only use variables defined in the data environment. Functions can also be used (see the example below).


Example

TOTAL_VALUE = NBR_MONTHS * MONTHLY_VALUE


RESULT = ( ( TOTAL_1 + TOTAL_2 ) / RATE ) * ( DISCOUNT - ( DISCOUNT * 3 / 100 ) )


NBR_DAYS = CALDAY(BEGIN_DATE,END_DATE;2)

(uses a function called CALDAY)


To round up:

CAPITAL H = ( CAPITAL * ( 1 + INTEREST_RATE ) ) * ( 1 - INFLATION_RATE )


↑ Top of page

  • Aucune étiquette