UNSIGNED( ) function

Returns numeric data converted to the Unsigned data type.

Syntax

UNSIGNED(number, length_of_result)

Parameters

number

Numeric. The value to convert.

length_of_result

Numeric. The number of bytes to use in the output string.

Output

Numeric.

Remarks

The Unsigned data type is used by mainframe operating systems to store numeric values in a format that uses minimal space, storing two digits in each byte. The Unsigned data type is the same as the Packed data type, but it does not use the last byte to specify whether the value is positive or negative. You can use the UNSIGNED( ) function to convert numeric data to the Unsigned format for export to mainframe systems.

If the length_of_result value is shorter than the length of the number value, the additional digits are truncated.

Examples

The output of this function cannot be displayed in ACL. The Return value column below shows the value as it would be stored on a mainframe operating system.

Example Return value (hexadecimal)

UNSIGNED(75, 3)

000075

UNSIGNED(-75, 3)

000075

The minus sign is not retained in the return value.

UNSIGNED(7.5, 3)

000075

UNSIGNED(12456, 2)

2456

The 1 is truncated because only 4 digits can be stored when the length_of_result is 2.

UNSIGNED(-12.456, 6)

000000012456

The minus sign is not retained in the return value.

Related reference
PACKED( ) function


(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback