TAA Tools
TRNVAL          TRANSLATE VALUE                        TAACLQB

The  Translate Value  command  provides a  command  front end  for  the
QDCXLATE API.   TRNVAL allows a  simple translation of a  field using a
translate  table.   A  second command  TRNVAL2 is  even simpler  and is
designed to be used in a HLL program by calling XLATE.

A typical TRNVAL command use would be:

             DCL        &TRNVAL *CHAR LEN(1000)
              .
             TRNVAL     INPVAL(xxxx) TRNVAL(&TRNVAL) LENGTH(10)

The default for TRNVAL is  to use the system supplied  QSYSTRNTBL table
which translates  from lower to upper  case.  Therefore,  the result of
the  example  would be  that the  value in  TRNVAL  would be  all upper
case.  The  LENGTH parameter describes  the length of  the field to  be
translated.

The second  command TRNVAL2  (XLATE program) is  designed to  be called
from  a  HLL program.    XLATE is  passed  two parameters.    The first
parameter may be  up to 1000  bytes and is returned  as the  translated
value.   The second  parameter must  be defined  as *DEC  LEN(5 0)  and
describes the  length to translate.   XLATE uses  the QSYSTRNTBL system
supplied translate table.  A typical use of XLATE would be:

     C                     MOVE 'xxxx'    INPVAL
     C                     CALL 'XLATE'
     C                     PARM           INPVAL 10
     C                     PARM 10        LENGTH  50

The  value  passed in  INPVAL  would be  translated  to upper  case and
returned.

Mismatch of value to translate and length
-----------------------------------------

You  must ensure  that  the  length  specified matches  what  you  want
translated.

For example, if the  value to be translated is 'abc' and  a length of 2
is described, the return value will be 'ABc'.

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

   INPVAL        The  input value to  be translated.   It can  be up to
                 1000 bytes in length.  The value is not changed.

   TRNVAL        The return translated value.   It must be declared  as
                 *CHAR LEN(1000).

   LENGTH        The  length to  be  translated.   The  default is  10.
                 The  value must  be  between 1  and 1000.    The exact
                 length is not required,  but a smaller value  improves
                 performance.   A  shorter length  only translates  the
                 number of characters specified.

   TRNTBL        The  qualified name of  the translation table  to use.
                 The   default  is  QSYSTRNTBL   which  is  the  system
                 supplied  table that  converts  lower  case  to  upper
                 case.  The library defaults to *LIBL.

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

   INPVAL        The  input value to  be passed  and translated  in the
                 same  field to upper case.   It must  be a *CHAR field
                 up to 1000 bytes.

   LENGTH        The length to be translated.   The default is 10.   If
                 the CPP XLATE  is called directly, the  parameter must
                 be  specified as  *DEC LEN(5  0).   The value  must be
                 between 1 and 1000.

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

Because both commands return a variable,  they can only be executed  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
   ------        ----    ---------      ----------    ----------

   TRNVAL        *CMD                   TAACLQB       QATTCMD
   TRNVAL2       *CMD                   TAACLQB2      QATTCMD
   TAACLQBC      *PGM       CLP         TAACLQBC      QATTCL
   XLATE         *PGM       CLP         TAACLQBC2     QATTCL


Structure
---------

TRNVAL      Cmd
   TAACLQBC   CL pgm

TRNVAL2     Cmd
   XLATE       CL pgm
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top