TAA Tools
CRTPRTPGM     CREATE PRINT PROGRAM                          TAADBFC

The CRTPRTPGM  command creates a  program that can  be used for  simple
printing requirements for any externally described data base file.

You  must have the  RPG compiler on  your system  to be able  to create
the  programs.   Once  a  program is  created, it  may  be used  on any
system that has the TAA Productivity Tools.

Once the print  program is  created, you can  issue the PRTDBF  command
and name  the program that you created.   This will print  a listing of
your  file and allow  you to  alter the order  in which  the fields are
printed (left  to right across  the page).   Three  control levels  are
supported.

The PRTDBF  command allows  a simple  method of  printing records in  a
formatted  manner from  a data  base  file.   The command  is primarily
aimed at:

     - Debugging
     - Problem determination
     - One time reports
     - Low volume production work

The command prints either  a single line per  record or control  totals
with the field names  used as the column headings.   Numeric fields are
converted  to character  values, zero  suppressed  and a  decimal point
shown.

Basic listing output
--------------------

**********************************************************************

  7:29:14    7/17/09     Run ID-*NONE          PRTDBF Command output

    File-CUSDTLP    Library-QGPL    Member-CUSDTLP   Program-ZCUSDTLP
    SEQ-*FILE L3CTL-*NONE   L2CTL-*NONE   L1CTL-*NONE    TOTONLY-*NO

 * SLSMAN  CUST          AMT       QTY   NAME               DATE

    010    12345      100.00        50   SMITH            04/15/09
    010    12345       35.15        12   SMITH            04/24/09
    010    20000       23.45         6   JOHNSON          04/06/09
    010    21345       34.00         9   MILLER           05/01/09
    010    30000      405.67       100   HORNER           06/10/09
    012    00346       94.50        17   HUMMER           05/03/09
    012    45674       75.00        20   WILLIAMS         04/15/09

 * SLSMAN  CUST          AMT       QTY   NAME               DATE

 Fn                   767.77       214
 Av                   109.68        31
 Mn                    23.45         6
 Mx                   405.67       100

      Record count-      7        Records requested-   60

**********************************************************************

  **   The DDS field names are used for the column headings.

  **   Any packed or binary fields are converted to character.

  **   Simple  editing occurs  for numeric  fields including  a decimal
       point for  non zero  decimal  fields and  separator slashes  for
       fields using the Y edit code.

  **   If the last  field is a character field  which exceeds the print
       line, the data is printed in a truncated manner.

  **   Any excess fields are truncated.

  **   Numeric  values are  added  up and  a final  total line  (Fn) is
       output.

  **   A line  of  column  headings  always  prints  before  the  final
       output to  allow easier  reading of  the totals  by DSPSPLF.   A
       new  page is forced  for the final  totals if they  are to print
       beyond line 55.   The line  of column headings  is indicated  by
       an * in position 1.

  **   An  average  line  (Av)  is  always  output  which  provides  an
       average for  each numeric field  (Final total divided  by number
       of records).

  **   A  minimum  value line  (Mn) shows  the  minimum value  for each
       numeric field.

  **   A maximum  value  line (Mx)  shows the  maximum  value for  each
       numeric field.

Options
-------

  **   The  default  is to  use  the fields  defined  in  the file  and
       spread  them across the printed  output left to  right.  You may
       also name  the  fields  in the  order  you want  printed  or  be
       prompted with a selection display of the existing fields.

  **   The default  is to process the  file in arrival sequence.   This
       allows  your to  frontend the function  with an  OPNQRYF command
       for specific  sequencing and  selection.   An option  exists  to
       use the sequence of  the file.  This causes  an internal OPNQRYF
       to be used.

  **   The command  defaults to use the DSPSPLF  command to display the
       printed  output.   After  the display  occurs, a  prompt appears
       asking the operator whether  the user wants to save  the spooled
       output  (the default  is 'N').   If  'N' is  entered,  the spool
       file  is deleted.   If  the command is  submitted to  batch, the
       output is  just sent  to a  spool file.   You  may request  just
       spooled output on an interactive request.

  **   The  command   defaults  to   print  60   records  if   executed
       interactively  (approximately  3 pages  of  DSPSPLF information)
       and 1000 if executed  in batch.  You  may request more or  less.

  **   The heading line  allows for a  run identification and  a title.
       If  no title is  specified on the  command, a default  (as shown
       in  the  example)  occurs.    The  command  parameters  and  the
       specific file being processed are also printed.

  **   The  command  defaults  to  use  the  file  that  was  named  on
       CRTPRTPGM.    An  option  exists  to use  a  different  file  or
       member.

Note  that  the command  outputs  the name  of  the file/library/member
that was  used  on  the open.    This  can be  helpful  information  if
overrides are involved to determine the actual file/member opened.

Creating the program
--------------------

Assume you  have a file  named CUSTDLP  with fields SLSMAN,  CUST, AMT,
QTY,  NAME  and DATE.    You want  to  create a  print  program  so you
specify the following:

            CRTPRTPGM    FILE(CUSDTLP)

The command  submits a  job  to batch  to create  an  RPG program.    A
default  source member  and program  name  will be  assigned  with a  Z
followed by the FILE name (i.e.  ZCUSDTLP).

The  batch  program first  issues  the DSPFFD  command  to extract  the
field  definitions for  CUSDTLP.  The  member ZCUSDTLP is  added to the
PRTDBFSRC  file in  TAATOOL.    The  batch  program creates  a  set  of
generalized RPG  specifications for CUSTDLP.  The  CRTBNDRPG command is
then  issued to create ZCUSDTLP.  The  default is to create the program
in your current library and to  remove the source after the program  is
created.

To print the information in the file you would specify PRTDBF as:

            PRTDBF       PGM(ZCUSDTLP)

Controlling the fields to be printed and the order
--------------------------------------------------

The default order of  the command is to print the fields  left to right
according to  the sequence they were  specified in DDS.   You can alter
this by specifying the FIELDS parameter such as:

            PRTDBF       PGM(ZCUSDTLP)
                         FIELDS(CUST NAME AMT)

Note that you do not have to  print all the fields and any excess  data
after 132 positions will be truncated.

Sequencing
----------

By default  the file  will be processed  in arrival  sequence.   If the
file is  keyed, you may specify SEQ(*FILE).   This will use an internal
OPNQRYF  command  with  KEYFLD(*FILE) to  use  the access  path  of the
named file.   You should  not use SEQ(*FILE)  when you are  frontending
PRTDBF with your own OPNQRYF command.

            PRTDBF       PGM(ZCUSDTLP)
                         SEQ(*FILE)

Control levels
--------------

Up  to 3  control level  fields  may also  be specified.   The  program
assumes the  data is in sequence (it does not  sort the data).  See the
SEQ parameter  to  determine  the sequence  to  be used.    Assume  you
sequenced  the file  in  SLSMAN order  and  then  issued the  following
command:

            PRTDBF       PGM(ZCUSDTLP)
                         L1CTL(SLSMAN)

You would receive the following output:

**********************************************************************

  7:35:57    7/17/09     Run ID-*NONE          PRTDBF Command output

    File-CUSDTLP    Library-QGPL   Member-CUSDTLP    Program-ZCUSDTLP
    SEQ-*FILE L3CTL-*NONE   L2CTL-*NONE   L1CTL-SLSMAN   TOTONLY-*NO

 * SLSMAN   Count   CUST          AMT       QTY   NAME

    010             12345      100.00        50   SMITH
    010             12345       35.15        12   SMITH
    010             20000       23.45         6   JOHNSON
    010             21345       34.00         9   MILLER
    010             30000      405.67       100   HORNER
 1              5              598.27       177

    012             00346       94.50        17   HUMMER
    012             45674       75.00        20   WILLIAMS
 1              2              169.50        37

 * SLSMAN   Count   CUST          AMT       QTY   NAME

 Fn             7              767.77       214
 Av                            109.68        31
 Mn                             23.45         6
 Mx                            405.67       100

      Record count-      7        Records requested-   60


**********************************************************************

Note the following:

  **   The level number of the total line prints in position 1.

  **   The  control level  fields always  appear on  the left  with the
       high order first.

  **   A count field is always  provided just following the L1  control
       field.

  **   The total  fields  default to  be 2  positions  larger than  the
       field  size   in  the  record.    You   may  specify  additional
       positions.  Truncation occurs on any arithmetic overflow.

  **   Numeric control fields are never accumulated.

  **   Only  a  single field  can produce  a control  break (e.g.   you
       cannot specify multiple  fields making up the  L1CTL parameter).

Totals only
-----------

You  may also  request  'totals only'  in  which case  no detail  lines
would appear.  If you had specified:

            PRTDBF       PGM(ZCUSDTLP)
                         L1CTL(SLSMAN)
                         TOTONLY(*YES)

You would receive the following output:

**********************************************************************

  7:42:25    7/17/09     Run ID-*NONE          PRTDBF Command output

    File-CUSDTLP    Library-QGPL   Member-CUSDTLP   Program-ZCUSDTLP
    SEQ-*FILE L3CTL-*NONE   L2CTL-*NONE   L1CTL-SLSMAN   TOTONLY-*YES

 * SLSMAN   Count          AMT       QTY

 1  010         5       598.27       177

 1  012         2       169.50        37

 * SLSMAN   Count          AMT       QTY

 Fn             7       767.77       214
 Av                     109.68        31
 Mn                      23.45         6
 Mx                     405.67       100

      Record count-      7        Records requested-   60


**********************************************************************

Note the following:

  **   Each line contains the control field data.

  **   Any  fields which are not control  fields or not accumulated are
       automatically dropped.

  **   TOTONLY(*YES) is valid  with no  control fields  specified.   In
       this case you would receive only the final total line.

Field name prompting
--------------------

You may  prompt for  the fields  that exist in  the file.   If  you had
specified:

            PRTDBF       PGM(ZCUSDTLP)
                         FIELDS(*YES)

you would receive the following prompt:

**********************************************************************

  File- CUSDTLP     Library- QGPL       Select fields   Prt pos rqstd-

  Seq Ctl Field      Len  Dec  Text
  ___  _  SLSMAN       3       Salesman number
  ___  _  CUST         5       Customer number
  ___  _  AMT          7   2   Sales amount
  ___  _  QTY          5   0   Quantity sold
  ___  _  NAME        15       Customer name
  ___  _  DATE         6   0   Last sale date


  F3=Exit         F6=Use all fields   Help  ENTER-Refresh if changes or

**********************************************************************

Note the following on the prompt display:

  **   The fields and their text descriptions are displayed.

  **   You  may  enter into  the 'Seq'  field  any values.    After the
       enter key  is pressed,  the fields  are sorted  in the  sequence
       you specified.   Unspecified fields  appear last.   The sequence
       numbers  will  be  changed  to  010,  020  etc.    The  sequence
       determines  the order  in which the  fields will  appear left to
       right on  the printed output.   If  you specify control  fields,
       they  always   appear  as  the  first  fields   on  the  display
       (leftmost fields on the listing).

       One way  to use this function is to  first place X's next to all
       the fields  you  want  on  the  report and  press  Enter.    The
       display  is resequenced  and the  X'd fields  now have  sequence
       numbers.   You can also determine how  many print positions will
       be required by the  value in the upper  right hand corner.   You
       can now change the  sequence numbers to provide a  left to right
       positioning  and add or  delete fields.   When Enter  is pressed
       again,  your desired  sequence is shown.   When  you press Enter
       without making any changes, the command will execute.

  **   You may  modify the  display to reposition  fields, drop  fields
       (by  blanking  out  the  value)  or add  fields  that  were  not
       originally  specified.  Each  time you make a  change the screen
       will be  re-displayed.    When  no changes  have  occurred,  the
       fields will be passed to the processing function.

  **   You may specify  the control levels to  be used.  Any  value may
       be entered,  but only 3 control fields may  be named.  The first
       control field (per  the sequence entry)  is considered the  most
       major control field.   Entering a  1 does not signify  the L1CTL
       parameter.   The  sequence of  the  control fields  controls the
       major  (L3) to minor  (L1) order.   Two fields cannot contribute
       to the  same control  level.  After  the enter  key is  pressed,
       the  control fields will  be sorted  to appear  at the  top when
       the  screen  is re-displayed.   This  is  where the  fields will
       print.

  **   If  you   specify   a  control   field   on  the   command   and
       FIELDS(*YES),  the  prompt  will  display  your  control  fields
       first.  You may modify them prior to execution.

Considerations
--------------

The  CRTPRTPGM  command operates  on an  externally  described physical
file or a logical file  which has only a single  format.  If more  than
250  fields exist,  the  excess  are  dropped.   Any  files  containing
floating  point  fields,  decimal  fields  exceeding  15  digits  or  9
decimals  cannot  be used.    Only 20  fields  may be  requested  to be
printed using  PRTDBF.   A maximum  size of  130 bytes  may be  printed
which is  a combination of field  names, values and spacing  (The print
line  is 132 positions,  but includes the special  entries in positions
1-2 to indicate the total lines).  Any excess data is truncated.

The default program  name assigned is  'Z' followed by  the file  name.
If  your file  name is  PAYMST, the  default program  name is  ZPAYMST.
The intent of this is twofold:

  **   To provide  a convention to follow so that  if you know the name
       of the  data base  file, you  will know  the name  of the  print
       program.

  **   To isolate  all of  the programs  for this function  so that  it
       does not interfere with your normal production objects.

The  default source file  for CRTPRTPGM is  PRTDBFSRC in TAATOOL.   The
SAVSRC  parameter on  CRTPRTPGM defaults to  *NO meaning  the member is
removed after the  create.  The  intent of these  defaults is to  place
the source where  it will not interfere with  any production source and
then  to remove it.   If the  CRTBNDRPG command fails,  the source will
remain in the source member.

The source code  generated is RPG, but  it is complex  code and is  not
written to  be maintained.   If  the format  of the  file changes,  you
should just re-execute the CRTPRTPGM command.

In  most cases, the generated  source is of little  value and therefore
it is removed as a  default.  There are  situations where you may  want
to modify  some of the functions  such as a  column heading or  an edit
code.   These types  of changes can  be made without  understanding the
logic  of the program.  If  you choose to make  such a change, you will
need to specify  SAVSRC(*YES).  See  the later discussion on  modifying
the source.

Caution must  be taken if you assign  a program name or  change the RPG
source  file to  be used.   CRTPRTPGM  will delete  any program  of the
same name and will clear any  existing member without a warning.   This
allows you  to easily recreate  the print program  if you  make changes
to  the file, but  requires that you  have a good  naming convention so
that your production objects are not accidentally destroyed.

The created  program  will  automatically add  up  all  numeric  fields
which are  not control fields  or do not  use an edit  code of X  or Y.
Numeric fields  which have an edit  word are also added.   This results
is  some  nonsense  totals  such  as  totalling  time  of  day  fields,
telephone numbers etc.

You may avoid totalling these fields by:

  **   Specifying a X or Y edit code in the data base file.

  **   Modifying the  created  source to  eliminate  the L  edit  code.
       See the later discussion on the created source.

In  some cases  you  may prefer  a  different column  heading than  the
field name used in your file.  This can be achieved by either:

  **   Specifying  a logical  file format  with the DDS  RENAME keyword
       and then using CRTPRTPGM against the logical file.

  **   Modifying the  created source  to change  the field  name.   You
       can have up to a 10 character field name.

An  option on  the CRTPRTPGM  command  determines the  number of  extra
digit  positions  for   the  total  fields.    Arithmetic  overflow  is
ignored.

For the  fields that  are accumulated,  an edit  code of  L is  forced.
This provides for the  stripping of leading zeros, a  decimal point (if
decimal  positions exist), a  minus sign  and zero balances  are forced
to  print.    The  Y  edit  code  fields  are  printed  with separating
slashes.  The X edit code is handled by performing no editing.

Because  the CRTPRTPGM  generates  RPG  source with  your  field  names
included, there  is a potential  conflict between your field  names and
the  standard names used within the program.   This is minimized by the
use of  the  @ character  to precede  any  names in  the  pre-specified
source.   If a conflict exists,  the program create step  will probably
fail.   If you normally  use the @  character to begin  field names you
could consider  modifying the  source in  the TAADBFR3/4/5  members  to
begin with a different character.

The PRTDBF command can  be used on a file  which is either a full  or a
shared  open.   PRTDBF  works well  with  files opened  by  the OPNQRYF
command.   If you  want to reprocess  the file using  the same OPNQRYF,
you can use the POSDBF command after each PRTDBF command.

  **   If OPNQRYF is used, the FROMRCD parameter must not be used.

  **   If OPNQRYF is used, the SEQ(*FILE) option must not be used.

CRTPRTPGM command parameters                          *CMD
----------------------------
   FILE          The qualified file  name to  be used.   It must be  an
                 externally  described   physical  file  or   a  single
                 format  logical file.   Only  an 8 character  name may
                 be used as the value  will be used in an RPG  program.

   PGM           The  qualified  program  name  to  be  created.    The
                 default  is *DFT  in *CURLIB.   When  *DFT is  used, a
                 'Z' will be the first  character followed by the  file
                 name.   This  is a  convention to  assist in  avoiding
                 specifying one  of your production objects  as well as
                 easily  remembering  the  name.   If  you  already use
                 'Z', you could consider a different convention.

                 The member  name will  be cleared for  the RPG  source
                 generated by  the CRTPRTPGM command.   See the RPGSRCF
                 parameter discussion.

                 You  could consider changing the  default library name
                 in the command to place  all of the print programs  in
                 a special library.

   JOBD          The qualified  JOBD name  to use  to submit to  batch.
                 *USRPRF  is the  default which means  to use  the JOBD
                 in the user profile.   The command  is designed to  be
                 entered   interactively   with   the    create   being
                 submitted  to batch.   If the  command is  executed in
                 batch, the JOBD parameter is ignored.

   RPGSRCF       The  source  file to  be  used to  hold  the generated
                 source.   The member name  defaults to  the same  name
                 as the  program name.   If the member  already exists,
                 it will be cleared for the new generated source.

                 The  default  source  file  is  PRTDBFSRC  in TAATOOL.
                 This  is  a  special  source  file  that   is  created
                 automatically  as  part of  the  CRTTAATOOL  function.
                 Since    the   source    member   will    be   cleared
                 automatically, you should  be careful about  assigning
                 a  different value  to  RPGSRCF  as  it may  delete  a
                 production member.

   ADDLPOS       Totals  will  be  taken  during  the  PRTDBF  command.
                 This  entry determines the  additional positions to be
                 used to hold  the total.  For  example, if you have  a
                 7  digit field,  the default  is 2  meaning  the total
                 will  be appear in  a 9 digit  field.  If  this is not
                 large  enough,  you  should  increase  the  additional
                 positions.   If  a total  overflows,  no error  occurs
                 and the  value is truncated.   The total field created
                 will not exceed 15  digits.  The additional  positions
                 entry cannot be greater than 5 positions.

   SAVSRC        An  option   to  save   the  generated  source   which
                 defaults to  *NO.  In most cases  the generated source
                 is  of little value  and is removed  by the *NO option
                 if the CRTBNDRPG  command completes successfully.   If
                 you  want to  change some  of the  column  headings or
                 editing, you should specify *YES.

   RMVOBS        A  *YES/*NO  option  that  defaults  to  *YES.    *YES
                 specifies   to   remove   the   observability   (debug
                 information)  after  it  is   created.    This  has  a
                 dramatic   impact  upon   the  size  of   the  program
                 created.  *NO  should only  be used when  you need  to
                 debug the created program.

   TEXT          The  text  description  for  the   source  which  also
                 becomes the  text description of  the created program.
                 The  default  is  *DFT  which  causes  the  command to
                 generate a text description such as:

                      CRTPRTPGM created pgm for file yyyy/xxxx

                 If *DFT is  specified, it is  only used when a  member
                 is  added.   If  a  value  is  specified, it  is  used
                 either  when  the  member  is  added  or  when  it  is
                 modified.

PRTDBF command parameters                            *CMD
-------------------------

   PGM           The qualified program  name to be  executed.  It  must
                 be  a  program  that  was  created  by  the  CRTPRTPGM
                 command.

   FIELDS        The  default  is *NO  meaning  use the  fields  in the
                 order in which they  are defined to the  file.  Up  to
                 20 field  names can also  be entered.   If the  option
                 *YES is  specified, a field  selection prompt appears.

                 The  field selection  prompt allows  for the selection
                 and ordering of  fields to be  printed as well as  the
                 designation  of  control  fields.   When  the  command
                 completes,   the  command   as  it  would   have  been
                 specified at  command  entry is  written back  to  the
                 command entry  display.   This allows  you to  use the
                 command  entry  functions (e.g.    F9/F4)  to re-enter
                 the command or a modified version of the command.

   SEQ           The  sequence  to  use  to  process  the  file.    The
                 default is  *ARR for arrival  sequence.  *FILE  may be
                 used if  the file is  keyed to use the  access path of
                 the  file.   *FILE  causes  an OPNQRYF  command  to be
                 executed  with  KEYFLD(*FILE).    This  will  use  the
                 access path of  the file and not build  an access path
                 (unless  the file  is very small).   Do  not use *FILE
                 if you are  frontending PRTDBF  with your own  OPNQRYF
                 command.

   L3CTL         L3 is the  highest control break.  If  you specify L3,
                 you  must specify  L2 and L1.   Control  fields always
                 appear on  the left  of the  printed output.   If  you
                 specify  the same  name in  the  FIELDS parameter,  it
                 only appears once.

                 Your  data must  be in  the  proper sequence  in order
                 for  control  level parameters  to  produce meaningful
                 results.   When  a control  break occurs,  the  fields
                 which  are being  added will  appear  as a  total.   A
                 count  field always appears  of the  number of records
                 in each group.

   L2CTL         The second control break.  Like L3.

   L1CTL         The first control break.  Like L3.

   TOTONLY       This  allows  you  to  specify  'totals  only'.    The
                 default is  *NO meaning  each record read  is printed.
                 If  *YES is  specified, a print  line will  occur only
                 for a  total.   If no  control levels  are  specified,
                 only a final total will appear.

                 If *YES  is specified,  the control  fields will  also
                 appear on each total line.

   NBRRCDS       This   defaults  to  *DFT   meaning  60   records  for
                 interactive  jobs and 1000 for  batch.  When the value
                 is reached,  the command terminates.   The value  used
                 is printed  as part of  the final totals.   A specific
                 value may be entered.

   DSPSPLF       A  default  of *YES  is  used meaning  to  display the
                 printed output  using  DSPSPLF.    After  the  display
                 occurs,   a  separate   prompt   appears  asking   the
                 operator  if the spooled  output should be  saved.  If
                 the command is  entered in batch,  or *NO is  entered,
                 the output is printed.   The name of the  spooled file
                 will   be  the   same  name   as  the   program  (e.g.
                 ZPAYMST).

   FROMRCD       This  defaults to *START which  is the first record in
                 the file.   A specific relative  record number can  be
                 entered  to start  the program  reading at  a specific
                 record.    This parameter  should  not be  used  for a
                 file that  has  been opened  by the  OPNQRYF  command.
                 You may  receive a  level check indication  or attempt
                 to access a record which has not been selected.

   RUNID         This  is a 10  character identifier with  a default of
                 *NONE.  It  prints on  every page and  is intended  to
                 allow a  brief description  to alter  repeated use  of
                 the same function.

   TITLE         This is  a 50 character  field that will  print at the
                 top  of  each page  of output.    The default  is *DFT
                 which  causes  'PRTDBF  Command  Output'  to   be  the
                 title.

   FILE          This is  an optional qualified name which  can be used
                 if  the file you want is in  a library which is not on
                 your library list  or the file has  a name other  than
                 that used on  the CRTPRTPGM command.   The default for
                 the  file is *PGM meaning  use the file  name that was
                 used on CRTPRTPGM.   The  default for  the library  is
                 to use the library list (*LIBL).

                 If you  use a specific  name, the  file must have  the
                 same   format   as   that   used   on   CRTPRTPGM   or
                 unpredictable results will occur.

   MBR           This  is an optional parameter  to designate a member.
                 The default is *FIRST.

   HEADINGS      A *YES/*NO value that  defaults to *YES.  When  *NO is
                 specified, neither  the headings nor  the final totals
                 print.    This allows  the  output to  be  spooled and
                 copied into  a text  document.   You  supply your  own
                 column headings.

DSPDBD command                                        *CMD
--------------

The DSPDBD  command exists  as an  independent display  to display  the
existing fields  in a file.   The command uses the  same program as was
created by CRTPRTPGM.   This is  the same function as  exists with  the
FIELDS(*YES) option  on  the PRTDBF  command except  that  the user  is
only  allowed to view  the fields in  the file.   When PRTDBF  is used,
the  user is allowed to select the fields  so they may be passed to the
PRTDBF function.

DSPDBD is intended  as a fast  method of determining  a summary of  the
file's  field descriptions.   It  is faster  and simpler  to  read than
DSPFFD.

The DSPDBD command supports the following parameters:

   PGM           The  qualified program name  to be executed.   It must
                 be  a  program  that  was  created  by  the  CRTPRTPGM
                 command.

   FILE          This is an  optional qualified name which  can be used
                 if the  file you want is in a  library which is not on
                 your library list or  the file has  a name other  than
                 that used on  the CRTPRTPGM command.  The  default for
                 the file  is *PGM meaning  use the file  name that was
                 used  on CRTPRTPGM.   The  default for  the library is
                 to use the library list (*LIBL).

                 If you  use a specific  name, the  file must have  the
                 same   format   as   that   used   on   CRTPRTPGM   or
                 unpredictable results will occur.

Performance implications
------------------------

In  general, the use  of the PRTDBF  command should be  limited to such
functions as:

    - Debugging
    - Problem determination
    - One time reports
    - Low volume production applications

The  PRTDBF command  must  operate  on  a  generalized  basis  such  as
allowing any character in  the data base to be  printed at any location
in  the  output.   This  is achieved  by  using arrays  and  moving one
character at a  time to the  output area.  Because  of the  generalized
nature, a performance degradation occurs.

A  sample  comparison  of  the  same   program  coded  using  different
techniques produced the following results:

         Specifically written RPG program    1.0
         S/38 Query                          2.0
         PRTDBF command                      6.0

The  sample was  a  typical report  type of  program  involving several
fields across the page and three control levels.

Assuming   these   relationships   occur  for   any   typical   use,  a
specifically  written  RPG  program  which  would  take  2  minutes  to
execute,  would  take approximately  4  minutes  using  S/38 Query  and
approximately 12 minutes using PRTDBF.

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

You  must have  the RPG compiler  on your  system to  use the CRTPRTPGM
command.   Programs already created  by CRTPRTPGM  may be  used on  any
system that has the TAA Productivity Tools.

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

The following TAA Tools must be on your system.

      PMTOPR        Prompt operator
      SNDCOMPMSG    Send completion message
      SNDESCMSG     Send escape message
      TAAARC        TAA Archive

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

None, the tool is ready to use.

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

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

   CRTPRTPGM     *CMD                      TAADBFC        QATTCMD
   PRTDBF        *CMD                      TAADBFC2       QATTCMD
   DSPDBD        *CMD                      TAADBFC3       QATTCMD
   TAADBFCD      *FILE         DSP         TAADBFCD       QATTCMD
   TAADBFCC      *PGM          CLP         TAADBFCC       QATTCL
   TAADBFCC2     *PGM          CLP         TAADBFCC2      QATTCL
   TAADBFCC3     *PGM          CLP         TAADBFCC3      QATTCL
   TAADBFCC4     *PGM          CLP         TAADBFCC4      QATTCL
   TAADBFCR      *PGM          RPG         TAADBFCR       QATTRPG
   TAADBFCR2     *PGM          RPG         TAADBFCR2      QATTRPG
     No object                             TAADBFCR3      QATTRPG
     No object                             TAADBFCR4      QATTRPG
     No object                             TAADBFCR5      QATTRPG

Structure
---------

   CRTPRTPGM Command
     TAADBFCC    submits   TAADBFCC2
                             TAADBFCR

   PRTDBF
     TAADBFCC3
       may use the TAADBFCR2 pgm

   DSPDBD
     TAADBFCC4
        TAADBFCR2
          TAADBFCD

Modifying the source
--------------------

The created  source can  be modified  for individual requirements,  but
the code  is so general purpose that  it is generally non-maintainable.
If the file changes in definition,  the CRTPRTPGM command must be  used
again.

Modifications should be  done by using CRTPRTPGM SAVSRC(*YES)  and then
modifying the generated source.

There  are  some typical  functions  that can  be  easily changed  that
relate  to  the  description  of  the  fields  to  be  printed.    This
information is kept  in an array  as part of  the generated source  and
can be changed  without understanding the logic of  the program.  These
include:

  **   Accumulation  - Any numeric  field that is not  specified in DDS
       as  an X  or  Y  edit  code  is  accumulated.    You  can  avoid
       accumulating  nonsense  fields  (e.g.    telephone  numbers)  by
       blanking out the A in position 17 of the array.

  **   Edit  code -  The program  will assume  an L  edit code  for any
       numeric field that does  not have a  DDS EDTCDE of X  or Y.   If
       an edit  word  exists, it  is ignored  and  the L  edit code  is
       used.   In some cases you  may prefer to specify an  X edit code
       (no  editing) which can be done  by modifying position 16 of the
       array.

  **   Column heading - The  default column heading is the  field name.
       You  may change the  name to  any value  that you  want printed.
       It  does not have to be  a valid field name  nor are you limited
       to the RPG 6  character requirement.  For  example, if you  have
       a field name  like AC123 you could change the  name in positions
       1-10 of the array to any of the following type values:

             CUST
             CUSTOMER
             CUST NAME
             CUST-NAME

       If  you change  the length  of the  name, you  may also  want to
       consider changing  the indentation  positions  for the  data  or
       column heading.  See positions 18-19 and 20-21 of the array.

The following describes  the information in  the array data  which will
appear for the @FL array at the end of the created source:

      Position      Description
      --------      -----------

       1 - 10       Field name - used for both column heading and
                      and on DSPDBD. It does not have to be a valid
                      field name.
      11 - 11       Field type (DDS types eg A=Char, P=Packed)
      12 - 14       Field length - also used on DSPDBD
      15 - 15       Decimal positions - also used on DSPDBD
      16 - 16       Edit code - only the following are supported
                       blank = no editing (used on character fields)
                           X = no editing (used on numeric fields)
                           L = edit per RPG L edit code
                           Y = edit per RPG Y edit code (only / used)
      17 - 17       Field addition (A = add, blank = do not add)
      18 - 19       Field start relative location - how far to indent
                      the detail field
      20 - 21       Column heading relative location - how far to
                      indent the column heading
      22 - 24       Field width
      25 - 27       Field beginning location in the record
      31 - 80       Text for DSPDBD
					

Added to TAA Productivity tools April 1, 1995


Home Page Up to Top