RTVVALA         RETRIEVE VALUE ATTR                    TAACLQF

 The  Retrieve Value  Attributes  command  returns information  about  a
 value  (a variable).   Optional return  values exist to  determine such
 things  as the length  of the data  in the variable,  the type of data,
 and is it a valid name.

 A typical command would be:

              DCL           &LENGTH *DEC LEN(3 0)
              DCL           &DATA *CHAR LEN(1)
               .
              RTVVALA       VALUE(&xxxx) LENGTH(&LENGTH) DATA(&DATA)

 The &DATA return variable will describe:

            C = Character data or all blanks
            D = All digits
            P = All digits with a single decimal pos character

 You can also specify  a character to scan  for and return the  location
 such as:

              DCL           &CHKPOS *DEC LEN(3 0)
               .
              RTVVALA       VALUE(&xxxx) CHKCHR(*) CHKPOS(&CHKPOS)

 A leading  minus sign may exist  for decimal data  if LDGMINUS(*YES) is
 specified.

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

    VALUE         The  value to be  checked.  It  may be up  to 50 bytes
                  in length.

    LENGTH        The length  of the  data in  the value.   An  optional
                  return  variable that  if  used  must be  declared  as
                  *DEC  LEN(3  0).   A  scan from  the  right  occurs to
                  determine the last non-blank value.   If the value  is
                  all blank, a zero will be returned.

    DATA          The  data type  of  the  value.   An  optional  return
                  variable  that  if  used  must  be declared  as  *CHAR
                  LEN(1).

                  If  the value  contains character data  or all blanks,
                  a C is returned.

                  If  the value  contains  only digits  (0-9)  excluding
                  the trailing blanks, a D is returned.

                  If the  value contains only  digits (0-9) or  a single
                  single   decimal  format   value  and   excluding  the
                  trailing  blanks,  a  P  is  returned.    The  decimal
                  format  is determined  by accessing  the system  value
                  QDECFMT.   A P means the  data is valid to  be used as
                  decimal data for the CHGVAR command.

    DECPOS        The leftmost position  within the  data that  contains
                  a  decimal  format  character.    An  optional  return
                  variable that  if used must be declared  as *DEC LEN(3
                  0).   The  decimal format  is determined  by accessing
                  the system value QDECFMT.

    NBRDEC        The number of digits  to the right of the  the decimal
                  format  character.  An  optional return  variable that
                  if  used  must be  declared  as  *DEC LEN(3  0).   The
                  decimal format is determined  by accessing the  system
                  value QDECFMT.

    DGTVAL        The value of  the digits if the TYPE returned  is D or
                  P.   This excludes  any decimal format  character.  If
                  TYPE =  D  is  returned and  the  value  is  positive,
                  DGTVAL would be  the same as the input  value (VALUE).
                  If  -123 is  input,  DGTVAL would  contain  a negative
                  123.   If  123.45 is  input, DGTVAL  would be returned
                  as 12345.   An optional return  variable that if  used
                  must be declared as *DEC LEN(15 0).

    NAME          Whether the  characters are a  valid name.   This does
                  not  include generic names (see  GENNAM).  An optional
                  return variable  that  if  used must  be  declared  as
                  *CHAR LEN(1).   It  will contain  Y or  N.  The  first
                  position  of the value  must be A-Z  or $, #,  @ to be
                  considered  a  valid  name.    Note  that  the   first
                  position cannot  be  blank.   The remaining  positions
                  must  be  the  same characters  or  0-9  or  '_'.   No
                  embedded  blanks must  exist to be  considered a valid
                  name.

    GENNAM        Whether the characters are  a valid generic name.   An
                  optional  return   variable  that  if   used  must  be
                  declared as *CHAR LEN(1).  It will contain Y or N.

                  See  the  rules for  the  NAME parameter.    A generic
                  name follows  these rules  and ends  with an  *.   The
                  characters after the * must be blank.

    LDGBLK        Whether the  first character  is blank.   An  optional
                  return  variable  that  if used  must  be  declared as
                  *CHAR LEN(1).  It will contain Y or N.

    EMBEDBLANK    Whether the  value contains  an  embedded blank.    An
                  optional  return  variable   that  if  used   must  be
                  declared as *CHAR LEN(1).  It will contain Y or N.

    APOSTROPHE    Whether any  character in the value  is an apostrophe.
                  An  optional  return  variable that  if  used  must be
                  declared as *CHAR LEN(1).  It will contain Y or N.

    MAXINPLEN     The  maximum  input  length  of  the  variable.    The
                  default  is 50.   It must  be a  number between  1 and
                  999.   50 was the old  maximum.  The number determines
                  where  to  start  the  scan  from  the  right  of  the
                  variable.

    CHKCHR        Whether  to check  for  the  existence of  a  specific
                  character.   *NONE is the default.   A non-blank value
                  may be  checked  for.   The  first location  found  is
                  returned in the CHKPOS parameter.

    CHKPOS        The leftmost  position within  the data that  contains
                  the  value  to be  checked  for.   An  optional return
                  variable  that if used must  be declared as *DEC LEN(3
                  0).

    ALWMINUS      A  *YES/*NO value  for  whether  to  allow  a  leading
                  minus  sign.  *NO  is the  default.   A value  such as
                  -123 would be considered a character field.

                  *YES  may be specified  to allow a  leading minus sign
                  and still consider the value  to be numeric.  A  value
                  such as -123  would be considered type D  (digits).  A
                  value such as -100.15 would be considered type P.

    LDGMINUS      Whether  a leading minus  exists.   An optional return
                  variable that  if  used  must  be  declared  as  *CHAR
                  LEN(1).  It will contain Y or N.

    DECFMT        Which decimal  format type  to consider when  checking
                  for  a decimal notation.   *SYSVAL  is the  default to
                  use   the  system  value   QDECFMT  to  determine  the
                  decimal notation character.

                  *JOBFMT may  be specified  to use  the RTVJOBA  DECFMT
                  value.

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

 Because the  command returns  variables, it  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
    ------        ----    ---------      ----------    ----------

    RTVVALA       *CMD                   TAACLQF       QATTCMD
    TAACLQFC      *PGM       CLP         TAACLQFC      QATTCL

Added to TAA Productivity Tools May 1, 1996


Home Page

Powered by AS/400Powered by AS/400 Last modified on July 15, 2010 © 1995, 2010 - Jim Sloan, Inc.