ATODBL: Converting an Alphanumeric String to Double-Precision Format

How to:

Available Languages: reporting, Maintain

The ATODBL function converts a number in alphanumeric format to decimal (double-precision) format.

Syntax: How to Convert an Alphanumeric String to Double-Precision Format

ATODBL(source_string, length, output)

where:

source_string

Alphanumeric

Is the string consisting of digits and, optionally, one sign and one decimal point to be converted, or a field or variable that contains the string.

length

Alphanumeric

Is the two-character length of the source string in bytes. This can be a numeric constant, or a field or variable that contains the value. If you specify a numeric constant, enclose it in single quotation marks, for example '12'.

output

Double precision floating-point

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.

Example: Converting an Alphanumeric Field to Double-Precision Format

ATODBL converts the EMP_ID field into double-precision format and stores the result in D_EMP_ID:

TABLE FILE EMPLOYEE
PRINT LAST_NAME AND FIRST_NAME AND
EMP_ID AND
COMPUTE D_EMP_ID/D12.2 = ATODBL(EMP_ID, '09', D_EMP_ID);
WHERE DEPARTMENT EQ 'MIS';
END

The output is:

LAST_NAME 
SMITH
JONES
MCCOY
BLACKWOOD
GREENSPAN
CROSS
FIRST_NAME
MARY
DIANE 
JOHN
ROSEMARIE
MARY
BARBARA
EMP_ID
112847612
117593129
219984371
326179357
543729165
818692173
D_EMP_ID
112,847,612.00
117,593,129.00
219,984,371.00
326,179,357.00
543,729,165.00
818,692,173.00