%ZONED

Convert expression to decimal in zoned numeric representation

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
zoned_numeric = %ZONED(expression)

Return value

zoned_numeric

The zoned numeric representation of expression. (d)

Arguments

expression

The expression to convert to decimal. (a or n)

Discussion

%ZONED returns the zoned numeric representation of the specified expression.

The conversion follows the rules for moving data to a decimal destination. (See Assignment statements for a description of these rules.)

On OpenVMS and 64-bit systems, the size of the decimal field returned by %ZONED depends on the contents of the expression. On all other systems, %ZONED always returns a d19.

Examples

The following example uses alpha input as data for a zoned numeric arithmetic computation. Note that if the alpha variable contains any nonnumeric data other than a blank, a decimal point, or a sign (+ or –), a “Bad digit encountered” error ($ERR_DIGIT) is generated.

subroutine math 
    a_avar      ,a 
record 
    val1        ,d5
    val2        ,d5
    result      ,d10
proc 
    result = (val1 * val2) / %zoned(a_avar) 
    .
    .
    .
    xreturn 
endsubroutine