TAA Tools

 EDTVAR3         EDIT VARIABLE 3                        TAARPGY

 The Edit Variable  3 tool provides  a similar function as  EDTVAR2, but
 allows up to  30 digits (EDTVAR2 allows up to  15).  Both tools provide
 edited  values  by using  an Edit  Code such  as specified  in RPG.   A
 testing command (DMOEDTVAR3) is provided.

 EDTVAR3 is intended to be used as:

       - A sub program that can be called
       - A subroutine within an RPG program

 A typical use of the program would be the following RPG code:

      C                     MOVE decval    DECINP           Input field
      C                     MOVE '1'       ZEEDTC           Edit code
      C                     MOVE '2'       ZEDECP           Dec pos
      C                     CALL 'TAARPGYR'                 Entry
      C                     PARM           DECINP 300       Input field
      C                     PARM           EDTDS            Ext descrbed
      C                     MOVELZEOUT     EDTVAL 44        Edited field

 The DECINP parameter must  be a packed decimal  field of 30 digits  and
 must have  0 decimals.   The DECPOS  parameter describes the  number of
 decimal positions that should exist in the return value.

 The  return value  must be  specified as character  field of  44 bytes.
 The  edited  value  is  returned  left  adjusted  by  default.    Other
 parameters allow you to specify the editing symbols.

 An additional  edit code  of W  is supported  to allow  for editing  of
 time fields (such as 10:15:00).

 When a  date or time field  is used as the  DECINP value, the DATTIMLEN
 parameter must describe  a length between  3 and 9 digits.   If  excess
 non-zero data exists, an error message is sent.

 The EDTVAR3  function cannot  be used in  a CL  program as  CL programs
 only provide for up to 15 digits (RPG allows up to 30).

 A  sample use  to call  the function  as a  sub  program exists  in the
 TAACLQMR4  RPG member in  the TAA Archive.   You may  access the source
 by first  using CPYTAA.   The  typical solution  would be  to copy  the
 source to  QATTRPG in TAATOOL  where it could  then be copied  into any
 program.

 TAACLQMR4  is a working  program, but has  no function other  than as a
 test vehicle.   If you  call the  program, a display  will appear  with
 the edited value.  Use F3 to end the program.

 Differences with other editing tools
 ------------------------------------

   **   The  EDTVAR tool  provides a  command  interface for  use in  CL
        programs.

   **   The EDTVAR2  tool provides the same function  as EDTVAR3, but is
        limited to 15 digit field sizes.

   **   EDTVAR3 is  not a  command because  CL only  supports  up to  15
        digit decimal fields.

   **   The ZEDIT tool is  documentation only and includes the  RPG code
        to be used  as a subroutine to strip off  the leading zeros of a
        field.

 Demonstration command
 ---------------------

 A  demonstration  command is  available  to allow  you  to see  how the
 functions will perform on various parameters.

              DMOEDTVAR3

 A display file will  appear and you can  enter various values.  The  F6
 command may be used to access DSPEDTCDE.

 TAARPGYP Externally described data structure
 --------------------------------------------

 The  following fields  exist  in  the data  structure  (all fields  are
 character):

                              Default
      Field name    Length    if blank     Description
      ----------    ------    --------     -----------

       ZEOUT         44                    Edited return value
       ZEEDTC         1          Z         Edit code
       ZEDECP         1          0         Decimal positions
       ZEDTLN         1          6         Date/time length
       ZEADJR         1          b         Right adjust (b or R)
       ZEDECS         1          .         Decimal symbol
       ZESEPS         1          ,         Decimal separator
       ZEDATS         1          /         Date separator symbol
       ZETIMS         1          :         Time separator symbol
       ZESTLR         8          *ON       Set LR
       ZERSVD        40                    Reserved

 Using the EDTVAR3 function as an RPG subroutine
 -----------------------------------------------

 The  intent of the EDTVAR3 function as  a subroutine is if your program
 needs to edit  thousands of times and  the Call to  the sub program  is
 too inefficient.

 Calling a  sub program is not  significant overhead if you  return with
 LR  off.  You  do not need  to consider the  subroutine approach unless
 you are doing a large amount of editing.

 The TAARPGYR3 source in the TAA Archive  can be copied out to a  member
 using CPYTAA  such as to  file QATTRPG  in TAATOOL.   You may then  use
 the  SEU  browse/copy  function  to  access the  TAARPGYR3  source  and
 follow the instructions which are marked as C*++ comments.

 You should only copy in the code and not the C*++ comments.

 Only  a few comments appear in the  subroutine in order to minimize the
 amount of source  to be included.   For a  better understanding of  how
 the logic  of the  subroutine works, see  the TAARPGYR source  which is
 the processing function for the EDTVAR3 command.

 TAARPGYR3  is a working  program, but has  no function other  than as a
 test vehicle.   If you  call the  program, a display  will appear  with
 the edited value.  Use F3 to end the program.

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

 The DMOEDTVAR3 command has no parameters.

 The  intended  use of  EDTVAR3  is  either  as  a subroutine  or  as  a
 subprogram.

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

 There  are minor  differences with  the  Y edit  code handling  of very
 short or long fields.

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

 The following TAA Tools must be on your system:

      DSPEDTCDE       Display edit code
      SNDESCMSG       Send escape message

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

 None, the tool is ready to use.

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

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

    DMOEDTVAR3    *CMD                   TAARPGY2      QATTCMD
    TAARPGYR      *PGM       RPG         TAARPGYR      QATTRPG
    TAARPGYR2     *PGM       RPG         TAARPGYR2     QATTRPG
    TAARPGYR3     *PGM       RPG         TAARPGYR3     QATTRPG
    TAARPGYR4     *PGM       RPG         TAARPGYR4     QATTRPG
    TAARPGYD      *FILE      DSPF        TAARPGYD      QATTDDS
    TAARPGYP      *FILE      PF          TAARPGYP      QATTDDS

 The TAARPGYR3  program is  the source  to  be copied  if you  want  the
 EDTVAR3 function as  a subroutine.  The  program can be called,  but is
 only used for testing.

 The  TAARPGYR4  source  is  a  sample  of  how  to  call  the  TAARPGYR
 processing  program as a sub  program.  The program  can be called, but
 is only used for testing.

 Structure
 ---------

 EDTVAR3 as a program (no command or CL program exists)
    TAARPGYR

 DMOEDTVAR3  Cmd
    TAARPGYR2   CL pgm
        TAARPGYD    Display file

Added to TAA Productivity Tools May 1, 1997


Home Page

Last modified on November 19, 2014 © 1995, 2014 - TAA Tools, Inc.