Compiler Library/XL Reference Manual (32650-90029)
4- 9
Possible Traps
Invalid ASCII digit (2)
Invalid decimal operand length (5)
HPPACCVBD
HPPACCVBD converts a binary number to packed-decimal.
Declaration
PROCEDURE HPPACCVBD (
ANYVAR target :decimal_type;
targetdigs :INTEGER;
ANYVAR source :binary_type;
sourcewords :INTEGER;
VAR comparison_code :INTEGER;
VAR pacstatus :INTEGER)
OPTION
DEFAULT_PARMS (
comparison_code :=NIL,
pacstatus :=NIL)
UNCHECKABLE_ANYVAR;
EXTERNAL;
Comments
* The source field is converted to packed-decimal and stored in the
target field. The source is considered to be a two s-complement
binary number; its length is specified in sixteen-bit "words."
* If the "word" count is not in the range 0<=n<=6, a trap occurs.
* If the target digit count is not in the range 0<=n<=28, a trap
occurs.
* After the binary source is converted, leading zeros are stored until
the target field is filled.
* If the number of digits generated is greater than the target digit
count, the partial result is stored and a decimal overflow trap
occurs.
* If either the target digit count or the source word count is zero, no
conversion is performed.
Possible Traps
Decimal overflow (1)
Invalid source word count (4)
Invalid decimal operand length (5)
HPPACCVDA
HPPACCVDA converts a packed-decimal number to ASCII.
Declaration
PROCEDURE HPPACCVDA (
ANYVAR target :ascii_type;
targetdigs :INTEGER;
ANYVAR source :decimal_type;
sign_control :INTEGER;
VAR comparison_code :INTEGER;
VAR pacstatus :INTEGER)
OPTION
DEFAULT_PARMS (
sign_control :=0,