The Convert to Binary 8 command converts a 20 byte character input
value to a binary 8 field. This is the inverse of the CVTBIN8 tool
function. Some system functions deal in 8 byte binary values.
Neither CL nor RPG III handles 8 byte binary values. RPG IV does.
The value to convert must be right adjusted and passed in a *CHAR
LEN(20) value.
A typical command would be:
DCL &INPVAL *CHAR LEN(20)
DCL &BIN8 *CHAR LEN(8)
.
CHGVAR &INPVAL 'nnnnnnnnnnnnnnnnnnnn'
CVTTOBIN8 INPVAL(&INPVAL) BINVAL(&BIN8)
The maximum input value that can be converted is:
18,446,744,073,709,551,615
An all 'FF' value would be returned. All values must be positive (no
commas or decimal points may appear in the value).
An error will occur if you input a value that is shorter than 20
bytes because blanks X'40' will fill the high order positions and are
not considered valid.
CVTTOBIN8 escape messages you can monitor for
---------------------------------------------
TAA9891 The input value is not all valid digits (0-9).
TAA9892 The maximum input value has been exceeded.
Escape messages from based on functions will be re-sent.
Command parameters *CMD
------------------
INPVAL Up to 20 digits of data may be input. The value
must be right justified in a variable described as
*CHAR LEN(20). The value to be converted must be
all digits (0-9). No signs are valid.
The maximum input value that can be converted is
18,446,744,073,709,551,615.
BINVAL The returned binary value. The variable must be
specified as *CHAR LEN(8).
Calling the CPP directly
------------------------
The TAACLQWR CPP can be called directly. The following is RPG III
code in a format that is ready to be copied:
C CALL 'TAACLQWR' CVTTOBIN8
C PARM INPVAL 20 Input value
C PARM RTNBIN 8 Return value
The following is RPG IV code in a format that is ready to be copied:
C CALL 'TAACLQWR'
C PARM INPVAL 20
C PARM BIN8 8
Restrictions
------------
The input value must be right justified, all digits (0-9), and may
not exceed the maximum value.
Because the command returns a variable, it may only be used in a CL
program.
Prerequisites
-------------
The following TAA Tools must be on your system:
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CVTTOBIN8 *CMD TAACLQW QATTCMD
TAACLQWR *PGM RPG TAACLQWR QATTRPG
|