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 AssignmentOperator NumExpression

NumVarId H AssignmentOperator NumExpression


AssignmentOperator

   =    |    +=    |    -=    |    *=    |    /=   


Description

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


Assignment operators are considered to be arithmetic expressions where the variables are numerical. The variable located to the left of an assignment operator is always the result variable.


There are two types of assignment operators:

    • Simple assignment operator =
    • Compound assignment operators +=, -=, *=, /=


Simple assignment operator
NumVarId = NumExpression
Compound assignment operators
NumVarId += NumExpression <=> NumVarId = NumVarId  + (NumExpression)
NumVarId -= NumExpression <=> NumVarId = NumVarId - (NumExpression)
NumVarId *= NumExpression <=> NumVarId = NumVarId * (NumExpression)
NumVarId /= NumExpression <=> NumVarId = NumVarId / (NumExpression)


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


Expressions in brackets are evaluated before other expressions. For ADELIA programs, 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.


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 )


With compound assignment operators:

LENGTH = 2
LENGTH += 8
* LENGTH is now 10

LENGTH -= 3

* LENGTH is now 7

LENGTH *= 4

* LENGTH is now 28

LENGTH /= 2

* LENGTH is now 14


In an example illustrating expression priority:

LENGTH = 5
VARX = 7
LENGTH *= VARX -3

* LENGTH is now 20 not 32 as the calculated expression is LENGTH = LENGTH * (VARX -3) rather than LENGTH = LENGTH * VARX -3



↑ Top of page


Copyrights     Ι      ©Hardis Group 2025 - Any partial or total reproduction of the content, not expressly authorized by Hardis Group, is strictly prohibited.


  • Aucune étiquette