Products Downloads


French version


 


ADELIA

VADELIA

SADELIA

WADELIA

EADELIA

(I/B)

(I/B)

(B)

(I/B)

(B)


Warning: In the case of ADELIA programs, this function is not compatible with C generator.


Description

This predefined function is used to convert an alphanumeric variable to a numeric variable.


Syntax

Result = &ALPHA_TO_NUM(Alphanumeric;Format)


Parameters


Description

Contents

Controls

Result

NUM_E, NUM_P, NUM_BIN_2, NUM_BIN_4 or NUM_BIN_8 numeric destination variable.

If the alphanumeric variable does not contain a numeric value, an error is returned and the result is 0.

If the integer part of the alphanumeric variable is greater than allowed by the numeric value's definition, the value is left-truncated.

If the decimal part of the alphanumeric variable is greater than allowed by the numeric value's definition, the decimal part is truncated.

An alphanumeric variable containing a valid numeric value can have any of the forms produced by the &NUM_TO_ALPHA function.


Alphanumeric

Alphanumeric constant or variable to be converted to a numeric type.

The integer part of the value must lie in the range (+231-1 , -(231-1)).

The value must not exceed 19 digits in length.


Format

Alphanumeric constant or variable.

Specifies the decimal separator used in the alphanumeric format.

If the format contains the "." character, a dot is used as the decimal separator.

If the format contains the "," character, a comma is used as the decimal separator.

If the format contains neither a dot nor a comma, the decimal separator will be the one defined: in the client workstation's system parameters for Visual Adelia applications, in the locale linked to the browser language for Adelia Web et Adelia Cloud applications, and in the job's DECFMT parameter for AS/400 5250 applications.

Optional parameter.


Example

ALPHA(15) ALPHA

NUM_E(9,5) RESULT


ALPHA='1234,567'

RESULT=&ALPHA_TO_NUM(ALPHA)

*RESULT gives 1234.567


ALPHA='1234.567'

RESULT=&ALPHA_TO_NUM(ALPHA;'.')

* RESULT gives 1234.567'


ALPHA='-1234,567'

RESULT=&ALPHA_TO_NUM(ALPHA;',')

* RESULT gives -1234.567


ALPHA='****1234.567-'

RESULT=&ALPHA_TO_NUM(ALPHA;'.')

* RESULT gives -1234.567


ALPHA='rezr****1234.567-'

RESULT=&ALPHA_TO_NUM(ALPHA;'.')

*RESULT gives 0


ALPHA='1234.567899'

RESULT=&ALPHA_TO_NUM(ALPHA;'.')

* RESULT gives 1234.56789


List of predefined functions by topic


↑ Top of page

  • Aucune étiquette