TAA Tools
CVTBITBYT       CONVERT BITS TO BYTE                   TAACLQX

The Convert  Bits to Byte  command converts 8  one byte values  ('0' or
'1') to a  single byte.  The command is useful  if you need to generate
a byte with meaningful codes that are made up of bit settings.

A typical command would be:

             DCL           &BIT2 *CHAR LEN(1)
             DCL           &BIT5 *CHAR LEN(1)
             DCL           &BIT6 *CHAR LEN(1)
             DCL           &RTNTYPE *CHAR LEN(1)

             CHGVAR        &BIT2 '1'
             CHGVAR        &BIT5 '1'
             CHGVAR        &BIT6 '0'
             CVTBITBYT     BIT1(&BIT1) BIT5(&BIT5) BIT6(&BIT6) +
                             RTNBYTE(&RTNBYTE)

By  default,  any bits  that are  not described  are set  to '0'.   The
value of &RTNBYTE  following the  command as 8  bits would be  10001000
or X'88'.

If any  of the &BITn  variables are not  '0s' or '1s', CPF9898  is sent
as an escape message.

CVTBITBYT  escape messages you can monitor for
----------------------------------------------

      CPF9898    One of the bit values is not a valid '0' or '1'.

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

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

   BIT1          The  setting of  the first bit.   The  default is '0'.
                 The value must be '0' or '1'.

   BIT2-BIT8     Like BIT1

   RTNBYTE       The  return byte.    It  must  be  declared  as  *CHAR
                 LEN(8).   BIT1 will be in  the first bit, BIT2  in the
                 2nd bit, etc.

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

Because  the command returns a  CL 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
   ------        ----    ---------      ----------    ----------

   CVTBITBYT     *CMD                   TAACLQX       QATTCMD
   TAACLQXC      *PGM       CLP         TAACLQXC      QATTCL
   TAACLQXR      *PGM       RPG         TAACLQXR      QATTRPG
					

Added to TAA Productivity tools September 1, 1999


Home Page Up to Top