The Print Data Base file command allows you to print specific fields
from a file without creating a program or query. The field name is
used as the column heading with an option for the DDS COLHDG
information. Any decimal fields are added, averaged, and the maximum
and minimum values are shown. PRTDB is useful for programmers or
simple reports.
The default sequence of the data is based on the access path of the
file. A specific relative record number may be used as the start
record.
The SORTDBF TAA command may be used before listing.
Six commands are provided.
** PRTDB. Prompts for fields to be listed.
** PRTDB2. Lists all fields.
** PRTDB3. Lists all fields and outputs spooled file.
** PRTDBS. Prompts for SORTDBF and fields to be listed.
** PRTDB2S. Prompts for SORTDBF and lists all fields.
** PRTDB3S. Prompts for SORTDBF, lists all fields and outputs a
spooled file.
A typical command would be:
PRTDB FILE(xxx)
By default, a subfile of the fields in the file would be displayed.
You may select those that you want to print and use the 'Sel' field
to sequence the fields as they will be printed left to right across
the page.
A technique that can be used is to enter 'X' in the 'Sel' column for
the desired fields and then press Enter. The selected fields appear
at the top and the 'Sel' column is filled with 010, 020, etc. You
can then key over the entry to change the sequence.
When no more changes occur in the 'Sel' field, the selected fields
are passed to the print program.
You may optionally use the F6 key to request 'all fields' or specify
FIELDS(*ALL) on the command.
Decimal fields are edited using the Edit Code assigned to the field.
If none exists:
** If the field has 0 decimals, the Z edit code is used.
** If the field has some decimals, the 1 edit code is used.
If PRTDB is run interactively, the spooled file is displayed by
default using DSPSPLF and will still exist when DSPSPLF is ended.
If any decimal fields are printed, totals are automatically
accumulated and printed (X and Y Edit Code fields are excluded). If
no edit code exists, L is used. When the last record is processed
and there is still room on the page, a special record is output with
a dash in position 2. This assists in reading the next set of lines
with DSPSPLF. If there is not enough room on the page, a new page is
used for the totals and appears with the normal heading. The column
heading lines are output followed by 4 lines with the following
description appearing in positions 1-3.
Tot = Totals of the decimal fields
Avg = Average amount in the decimal fields
Max = Maximum value in the decimal field
Min = Minimum value in the decimal field
If you had taken the default to prompt for the fields in the file,
the actual generated command will appear as a message on the command
entry line. This simplifies re-running with the exact same values or
allows a modification of the values or inclusion in a CL program (see
the CPYJOBLOG TAA Tool).
You may also name a list of fields or use the special value *ALL to
print all fields in the file.
The LINEWIDTH parameter which defaults to 378 controls how wide a
print line will be generated. The default allows you to display a
wide print line. Any data beyond the value specified will be
truncated. If you want to print the data and do not have a printer
that will print 378 wide, you may:
** Use PRTDB again and specify the correct line width value.
** Use the TCTSPLF to truncate the spooled file. The command
re-prints the spooled file to a shorter width.
Considerations
--------------
** Because the RPG processing program must allow for any length
of file (up to 9999), PRTDB cannot be used with OPNQRYF. The
PRTDBS, PRTDB2S, and PRTDB3S commands provide a similar
function as OPNQRYF by prompting for the TAA SORTDBF command.
** Because PRTDB must be very general purpose, it should not be
used on a large number of records. A specific program will be
much more efficient in processing a large number of records.
PRTDB2 Command
--------------
The PRTDB2 command is the same function as PRTDB except the default
for FIELDS is *ALL rather than *PROMPT. This allows you to simply
name a file and get results such as:
PRTDB2 FILEA
PRTDB3 Command
--------------
The PRTDB3 command is the same function as PRTDB except the default
for FIELDS is *ALL rather than *PROMPT and DSPSPLF(*NO) is used as a
default. This allows you to simply name a file and spool the results
such as:
PRTDB3 FILEA
The intent of PRTDB3 is for use with the JOBTALK tool.
PRTDBS, PRTDB2S, and PRTDB3S commands
-------------------------------------
The commands with an S on the end are the same function as the
command without the S except that a prompt for the TAA SORTDBF
command will appear.
For example, the PRTDBS command is the same function as PRTDB with
the addition of a prompt for the TAA SORTDBF command.
PRTDBS begins with the use of DSPFMT to list the fields in the file.
This allows a review of the fields that will need to be specified for
the SORTDBF command. After reviewing or if you already know the
field names to be used, press F3.
The SORTDBF prompt will appear which will allow you to specify
selection and sort criteria. The output file is always TAATMPDBF in
QTEMP.
When the SORTDBF function is complete, a prompt will appear for the
PRTDB command. Additional options may be taken on the command.
If FIELDS(*PROMPT) is used (it is the default), the list of fields
will appear for the file and you may select those to be printed as
with PRTDB.
All commands which use SORTDBF, support an option to retain the
TAATMPDBF file in QTEMP which contains the selected and sorted data.
The default is to delete the file. If *YES is specified, you may use
or copy the TAATMPDBF file for additional usage.
PRTDB, PRTDB2, and PRTDB3 Commands *CMD
----------------------------------
FILE The qualified file name of the file. The library
value defaults to *LIBL. *CURLIB may also be used.
FIELDS The list of fields to be processed.
The default for PRTDB is *PROMPT to prompt for the
list of fields in the file. If the command is run
in batch, *ALL is used instead.
The default for PRTDB2 is *ALL to provide as many
fields as can be shown in the print width.
*ALL may be specified to cause all fields in the
file to be printed.
A specific list of fields (up to 50) may also be
entered.
MBR The member to be processed. The default is *FIRST.
COLHDG The type of column heading to be used.
*FLDNAM is the default to use the field names from
the file as a one line column heading.
*COLHDG may be specified to use the information from
the COLHDG DDS keyword for up to 3 lines of column
headings.
LINEWIDTH The width of the print line to be used. The default
is 378.
The intent of the large default is to allow you to
display as much data as possible. If you want to
print the data to a printer that does not support
378 wide, you may either:
Use PRTDB again and specify the line width to
fit your printer or
Use the TCTSPLF TAA Tool to re-print the
spooled file and truncate at a specified
position.
Any field columns that will be partially or
completely past the maximum width are truncated and
do not appear in the printed output.
TOTONLY A *YES/*NO value for whether only the final totals
should be printed. The default is *NO which causes
every data base record read to be printed.
A *YES entry will cause only the final totals to
appear. *YES may only be used if some decimal
fields exist to accumulate.
MAXFLDWTH The maximum width of a field for printing. The
default is 99. This allows large fields to be
truncated so you can see some of the data. The
value must be in a range of 20 to 99.
NBRRCDS The number of records to print. The parameter
defaults to *DFT which means that a maximum is
assigned depending on the environment. If PRTDB is
used interactively, a maximum of 1000 records is the
default. If PRTDB is used in batch, a maximum of
5000 records is the default.
A specific number or *MAX (all records) may be
entered.
DSPSPLF Whether to display the spooled file. This defaults
to *YES. The parameter is ignored if the command is
run in batch.
FROMRCD The record to start from. *START is the default
which means the first record according to the access
path of the file.
If the file is keyed, arrival sequence processing
will be used if 1 is specified. A specific relative
record number may be entered to start printing at
that number.
RUNID The Run ID of the report. The default is *NONE.
The Run ID is printed at the top of every page and
allows a 10 character ID.
TITLE The Title of the report. The default is 'PRTDB TAA
Tool Output' Up to 50 characters may be entered.
The title appears on every page of the report.
PRTDBS, PRTDB2S, and PRTDB3S Commands *CMD
-------------------------------------
FILE The qualified file name of the file. The library
value defaults to *LIBL. *CURLIB may also be used.
MBR The member to be processed. The default is *FIRST.
RTNSORT A *YES/*NO parameter for whether the TAATMPDBF file
in QTEMP should be retained.
*NO is the default to delete the file after the data
is processed.
*YES may be specified to retain the file to allow
further processing or copying.
Restrictions
------------
** OPNQRYF cannot be used to front end PRTDB because the shared
open requirement does not allow the hard coded file size used
in the processing program to be used. The PRTDBS, PRTDB2S,
and PRTDB3S commands provide the same function with the
SORTDBF prompt.
** Up to 50 fields may be named. If FIELDS(*ALL) is specified,
the first 50 fields in the file are used. Any combination of
decimal and character fields may be used.
** The maximum width of the print line is 378.
** The maximum width of a field is 99.
** The maximum number of fields that can exist in a file is 998.
** A maximum file length of 9999 may be processed. Fields that
begin and end in less than 9999 may be processed.
** The maximum length of a decimal field is 28 digits. This
allows 2 to be added for any total fields.
** A maximum of 99 bytes can be printed from any character field.
** Files with null capable fields are not supported.
** Not all field types are supported. Typical types such as
character, variable length, packed, zoned, binary, date, time,
or timestamp are supported.
Prerequisites
-------------
The following TAA Tools must be on your system:
DSPFMT Display format
EDTVAR Edit variable
EXTLST2 Extract list 2
HLRMVMSG HLL Remove message
PMTFLD Prompt field
RTVFLDARR Retrieve field array
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDDIAGMSG Send diagnostic message
SNDESCMSG Send escape message
SORTDBF Sort data base file
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
PRTDB *CMD TAADBID QATTCMD
PRTDB2 *CMD TAADBID2 QATTCMD
PRTDB3 *CMD TAADBID3 QATTCMD
PRTDBS *CMD TAADBID4 QATTCMD
PRTDB2S *CMD TAADBID5 QATTCMD
PRTDB3S *CMD TAADBID6 QATTCMD
TAADBIDC *PGM CLP TAADBIDC QATTCL
TAADBIDC4 *PGM CLP TAADBIDC4 QATTCL
TAADBIDC5 *PGM CLP TAADBIDC5 QATTCL
TAADBIDC6 *PGM CLP TAADBIDC6 QATTCL
TAADBIDR *PGM RPG TAADBIDR QATTRPG
Structure
---------
PRTDB/PRTDB2/PRTDB3
TAADBIDC CL Pgm
TAADBIDR RPG Pgm
PRTDBS
TAADBIDC4 CL Pgm
PRTDB2S
TAADBIDC5 CL Pgm
PRTDB3S
TAADBIDC6 CL Pgm
|