PTOA: Converting a Packed-Decimal Number to Alphanumeric Format

How to:

The PTOA function converts a number from numeric format to alphanumeric format. It retains the decimal positions of the number and right-justifies it with leading spaces. You can also add edit options to a number converted by PTOA.

When using PTOA to convert a number containing decimals to a character string, you must specify an alphanumeric format large enough to accommodate both the integer and decimal portions of the number. For example, a P12.2C format is converted to A14. If the output format is not large enough, the right-most characters are truncated.


Top of page

x
Syntax: How to Convert a Packed-Decimal Number to Alphanumeric Format
PTOA(number, '(format)', output)

where:

number

Numeric P (packed-decimal) or F or D (single and double precision floating-point)

Is the number to be converted.

format

Alphanumeric

Is the format of the number enclosed in parentheses.

output

Alphanumeric

The length of this argument must be greater than the length of number and must account for edit options and a possible negative sign.



Example: Converting From Packed to Alphanumeric Format

PTOA converts PGROSS from packed-decimal to alphanumeric format.

PTOA(PGROSS, FMT, 'A17')

iWay Software