Products Downloads


French version


 

 

ADELIA

VADELIA

SADELIA

WADELIA

MADELIA

(I/B)

(I/B) (C/S)

(B) (S)

(I/B) (C/S)

(I) (C/S)

 

Section for use

All

 

Syntax

VarId1 = VarId2

VarId = 'Constant'

VarId = NumericValue

VarId1 = PrototypeProgram (Parameter 1, ..., Parameter n) (with ADELIA (I/B) only.)

 

Description

Moving the value of a field into another field.

 

With ADELIA type programs generated in RPG:

    • If the assignment procedure is not managed in EVAL mode, the resulting variable (provided it is not a numeric variable) will not be cleared prior to loading.

    • If the assignment procedure is managed in EVAL mode and the left-hand part is alphanumeric, any data placed in a resulting field replaces any data already in the field.

See the 3GL generation tab in the environment attributes.

 

In a C context for ADELIA programs, and for VADELIA, WADELIA, MADELIA and SADELIA programs, the resulting variable is reset to blank.

 

Four situations are possible:

    • The resulting variable is alphanumeric: the transfer of one field to the other will begin on the left side.

    • The resulting variable is numeric, and the starting variable is alphanumeric: the transfer of one field to the other will begin on the right side.

    • The two variables are numeric, and the system begins by setting the target field to zero before transferring the other field.

    • If VarId1 is a DATE, TIME or TIMESTAMP type variable, VarId2 must be the same type and the value of VarId1 will be replaced with the value of VarId2.

 

Notes:

    • If an alphanumeric variable which does not contain only digits, is being transferred to a numeric variable field, the system will display a message during execution.
    • If the resulting field is too small to contain the result, the latter will be truncated on the right.
    • If the assignment is done between to class instance variables, the cast forcing instruction (CAST) can be used.

Example

a) Alphanumeric to alphanumeric

(Let's assume that FIELD_A = 'ZZZZZZZZZZ' and FIELD_B = 'ABCDE')

FIELD_A = FIELD_B

FIELD_A will be equal to 'ABCDEZZZZ'

in an ADELIA program generated in RPG that does not manage EVAL assignments.

FIELD_A will be equal to 'ABCDE'

in a VADELIA, WADELIA, SADELIA, MADELIA or ADELIA program using a C generator, or an ADELIA program using an RPG generator that manages EVAL assignments.

 

b) Numeric to alphanumeric

(Let's assume that FIELD_A = 'ZZZZZZZZZZ' and NUM_B = 000100)

FIELD_A = NUM_B

FIELD_A will be equal to '000100ZZZZ'

in an ADELIA program generated in RPG that does not manage EVAL assignments.

FIELD_A will be equal to '000100'

in a VADELIA, SADELIA, WADELIA, MADELIA or ADELIA program using a C generator, or an ADELIA program using an RPG generator that manages EVAL assignments.

 

c) Numeric to numeric

(Let's assume that NUM_A = 999999999 and NUM_B = 000100)

NUM_A = NUM_B

NUM_A will be equal to 000000100

 

d) Alphanumeric to numeric

(Let's assume that NUM_A = 999999999 and FIELD_C = '012' (alpha 3 characters long))

NUM_A = FIELD_C

NUM_A will be equal to 999999012

in an ADELIA program.

NUM_A will be equal to 000000012

in a VADELIA, SADELIA, WADELIA, MADELIA program.

↑ Top of page

  • Aucune étiquette