TAA Tools
CVTBIN4DEC      CONVERT BINARY 4 TO DECIMAL            TAABINC

         **************************************************
         *                                                *
         *   The CVTBIN4DEC tool exists only for          *
         *    compatibility reasons with an old version   *
         *    in the QUSRTOOL tools.  It is no longer     *
         *    needed because CL now supports the          *
         *    %BIN function.                              *
         *                                                *
         *    CVTBIN4DEC does support better error        *
         *    messages than the %BIN function.            *
         *                                                *
         **************************************************

The Convert Binary  to Decimal command converts  a binary 4 field  to a
decimal 9 field.

A typical command would be:

             DCL        &FROMBIN *CHAR LEN(4)
             DCL        &TODEC *DEC LEN(9 0)
              .
             CVTBINDEC  FROMBIN(&FROMBIN) TODEC(&TODEC)

CL  now  supports  the %BIN  function  which  is  more  efficient.   To
achieve the same results, you would specify:

             CHGVAR     &TODEC %BIN(&FROMBIN 1 4)

CVTBIN4DEC escape messages you can monitor for
----------------------------------------------

      TAA9893    A blank binary value cannot be converted.
      TAA9894    The binary value exceeds what can be converted.

Escape messages from based on functions will be re-sent.

Command parameters                                    *CMD
------------------

   FROMBIN       The  binary  field  to be  converted.   It  must  be 4
                 characters  in  length.    The  value   cannot  exceed
                 X'3B9AC9FF' which is 999,999,999 in decimal.

   TODEC         The  return  variable with  the  decimal  result.   It
                 must be specified as *DEC LEN(9 0).

Restrictions
------------

Because  the command returns  a variable, it  can only be used  in a CL
program.

Large binary values  will not  convert to a  *DEC LEN(9 0)  field.   An
error message will occur.

Prerequisites
-------------

None.

Implementation
--------------

None, the tool is ready to use.

Objects used by the tool
------------------------

   Object        Type    Attribute      Src member    Src file
   ------        ----    ---------      ----------    ----------

   CVTBIN4DEC    *CMD                   TAABINC       QATTCMD
   TAABINCC      *PGM       CLP         TAABINCC      QATTCL
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top