CVTBYTBIT       COVERT BYTE TO BITS                    TAACLPY

 The Convert Byte to  Bits command allows a single byte  to be converted
 to  8 different bit  values which are  returned as one  byte variables.
 You  may also return all 8  bits in a single 8  byte value.  The values
 are returned as 0 or 1.

 Note that the bits are numbered 1-8.

 A typical command would be:

            DCL           &CHAR1 *CHAR LEN(1)
            DCL           &BIT1 *CHAR LEN(1)
             .
            CVTBYTBIT     BYTE(&CHAR1) BIT1(&BIT1)
            IF            (&BIT1 *EQ '1') DO ...

 BIT1 is considered the first bit of the byte.

 All 8 bits may be returned  on a single command.  The  return variables
 are BIT1 - BIT8.  They will contain a value of 0 or 1.

 The  inverse function  of converting  bits  to a  byte is  done by  the
 CVTBITBYT tool.

 Calling the Function
 --------------------

 If  you are  going to  do a series  of conversions,  better performance
 would occur  if you  directly called  the RPG  program  which does  the
 conversions.   The  first 10  parameters that  must be  passed are  the
 same as on the command.

 The  last parameter controls the  setting of LR.   You may specify *ON,
 *OFF, or *IMMED (no  conversion occurs).  See  the member TAACLPYR  for
 a detail understanding.

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

    BYTE          The byte to be converted.

    ALL8          An optional  return  variable that  if specified  must
                  be declared  as *CHAR LEN(8).  All 8  bits of the BYTE
                  value are returned as 0s or 1s in an 8 byte field.

    BIT1          An  optional  return variable  that if  specified must
                  be declared  as *CHAR  LEN(1).   It  will contain  the
                  value of the first bit in the byte.

    BIT2          Similar to BIT1.

    BIT3          Similar to BIT1.

    BIT4          Similar to BIT1.

    BIT5          Similar to BIT1.

    BIT6          Similar to BIT1.

    BIT7          Similar to BIT1.

    BIT8          Similar to BIT1.

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

 Because return  variables are used, the  command can only be  used in a
 CL program.

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

 None.

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

 None, the tool is ready to use.

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

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

    CVTBYTBIT     *CMD                   TAACLPY       QATTCMD
    TAACLPYC      *PGM       CLP         TAACLPYC      QATTCL
    TAACLPYR      *PGM       RPG         TAACLPYR      QATTRPG

Added to TAA Productivity Tools May 1, 1996


Home Page

Last modified on March 10, 2014 © 1995, 2014 - TAA Tools, Inc.