Products Downloads


French version


 

 

ADELIA

VADELIA

SADELIA

WADELIA

MADELIA

(I/B)

(I/B)

(B)

(I/B)

(I)

 

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

 

Description

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

 

Syntax

Result = &NUM_TO_ALPHA(Numeric;Format)

 

Parameters

 

Description

Contents

Controls

Result

Destination alphanumeric variable.

The alphanumeric variable is filled from left to right.

 

Alphanumeric

Numeric variable or constant to be converted to an alphanumeric type.

Only NUM_E, NUM_P, NUM_BIN_2, NUM_BIN_4 and NUM_BIN_8 variables are permitted.

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

The value must not exceed 15 digits in length.

Mandatory parameter.

Format

Alphanumeric variable or constant.

Describes the format of the alphanumeric result variable. Refer to the table below for details of the possible formats.

Optional parameter.

 

Possible alphanumeric variable formats:

The alphanumeric variable's format is a combination of the following three types of format:

Decimal separators

.

A dot is used as the decimal separator.

,

A comma is used as the decimal separator.

None

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.

Supplementary characters used with the integer part

The integer part is expanded (packed) to match the numeric variable's definition as specified by the characters described below.
NUM_BIN_4 variables are treated as having a definition of 10.0 and NUM_BIN_2 variables a definition of 5.0.

0

The integer part is packed with zeros.

#

The integer part is packed with hashes (#).

*

The integer part is packed with asterisks (*).

None

The integer part is not packed.

Formatting of positive and negative numbers

"-" in final position

A minus sign (-) is placed to the right of the alphanumeric variable if the number is negative.
No sign is displayed with positive numbers.

"-" in first position

A minus sign (-) is placed to the left of the alphanumeric variable if the number is negative.
No sign is displayed with positive numbers.

"+" in final position

A minus sign (-) is placed to the right of the alphanumeric variable if the number is negative.

A plus sign (+) is placed to the right of the alphanumeric variable if the number is positive.

"+" in first position

A minus sign (-) is placed to the left of the alphanumeric variable if the number is negative.

A plus sign (+) is placed to the left of the alphanumeric variable if the number is positive.

None

 

With negative numbers, the minus sign (-) is placed as dictated by the client workstation's system parameters, in the case of Visual Adelia applications, and to the left of the number with AS/400 5250 applications.
No sign is displayed with positive numbers.

 

Example

ALPHA(15) RESULT

NUM_E(9,5) NUMERIC

 

NUMERIC=-12,45

RESULT=&NUM_TO_ALPHA(NUMERIC;'+0.')

*RESULT gives '-0012.45000'

 

RESULT=&NUM_TO_ALPHA(NUMERIC;'+*.')

*RESULT gives '-**12.45000'

 

NUMERIC=12,45

RESULT=&NUM_TO_ALPHA(NUMERIC;'+0.')

*RESULT gives '+0012.45000'

 

RESULT=&NUM_TO_ALPHA(NUMERIC)

*RESULT gives '12,45000'

 

RESULT=&NUM_TO_ALPHA(NUMERIC;'-')

*RESULT gives '12,45000'

 

NUMERIC=-12,45

RESULT=&NUM_TO_ALPHA(NUMERIC;'0.-')

*RESULT gives '0012.45000-'

 

ALPHA(4) RESULT

NUMERIC=12,45

RESULT=&NUM_TO_ALPHA(NUMERIC)

*RESULT gives '12,4'

 

RESULT=&NUM_TO_ALPHA(NUMERIC;'+')

*RESULT gives '+12,'

 

List of predefined functions by topic

 

↑ Top of page

  • Aucune étiquette