TAA Tools
RTVSGNPOS       RETRIEVE SIGN POSITION                 TAACLRJ

The Retrieve  Sign Position command  allows input of  a *DEC LEN(15  0)
variable.  The  input value is changed to positive  if it is a negative
value.   The  low order digit  of the original  value is  returned as a
*CHAR LEN(1)  value  in  a zoned  format.    RTVSGNPOS is  useful  when
attempting to  convert a  negative decimal value  to a  character value
such as within the CRTCLPINS command.

A typical series of commands would be:

             DCL        &DECINP *DEC LEN(15 0)
             DCL        &LOWORDER *CHAR LEN(1)
              .
             RTVSGNPOS  DECFLD(&DECINP) LOWORDER(&LOWORDER)

If  the &DECINP  field has  a value  of -12345, an  N (X'D5')  would be
returned for  LOWORDER and  the &DECINP  field would  be  changed to  a
positive 12345.

If  the &DECINP  field has  a  value of  12345,  a 5  (X'F5') would  be
returned and the &DECINP value would remain unchanged.

Negative values in CL decimal variables
---------------------------------------

CL  decimal variables are  held in a  packed decimal format.   The sign
position is in  the low order  4 bytes  of the right  most position  of
the field.

A negative value is expressed  with a hex range of 'D1' to  'D9' in the
sign position.

A positive value  is expressed with a hex range of  'F1' to 'F9'.  'C1'
to 'C9' are also considered positive.

RTVSGNPOS escape messages you can monitor for
---------------------------------------------

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

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

   DECINP        The  decimal input value to  be checked and changed if
                 it is  negative.   The  variable must  be declared  as
                 *DEC LEN(15  0).  The  variable would be changed  to a
                 positive value if it is negative.

   LOWORDER      The   low  order  value  of   the  original  value  is
                 returned as a zoned field.

                 If the  &DECINP  field  has  a value  of  12345,  a  5
                 (X'F5') would be returned.

                 If  the &DECINP  field has  a  value of  -12345, an  N
                 (X'D5') would be returned.

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

The command may 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
   ------        ----    ---------      ----------    ----------

   RTVSGNPOS     *CMD                   TAACLRJ       QATTCMD
   TAACLRJR      *PGM       RPG         TAACLRJR      QATTRPG

Note that the RPG program is the CPP.
					

Added to TAA Productivity tools December 1, 2004


Home Page Up to Top