I am looking for the SAVF of the Program or the Source for the LSTFFD
Utility <F15> key. The BRWOBJSRC is not a part of the actually LSTFFD
utility but was an outbound call to the separate program that was published
in 1987 by Midrange Computing.
Browse Source F15 Display the source that was used to create the file. This
is a call to the Browse Object Source
(BRWOBJSRC) command that was published in the June 1997 issue of Midrange
Computing (see "TechTalk: Browse the Source Code for an Object"). If you
don't have this command installed, an error message will alert you that
there was an error running the command
Here is the full description of LSTFFD as published in a MCPressOnline
article:
http://www.mcpressonline.com/mc?50@xxxxxxxxxxxxxxxx@.214a30f3
The List File Field Description (LSTFFD) Utility
Published November 1998
LSTFFD does everything IBM's DSPFFD command does and more. It displays a
file's record layouts in an easy-to-read format, a file's DDS source code,
links to displays of database relations, and triggers. Use this one command
instead of several other ones.
Have you ever wished IBM's Display File Field Description (DSPFFD) command
would display a record layout in an easier-to-read manner? Do you ever get
tired of exiting one display to get to another one? For example, if you're
looking at the record description of a physical file and you decide you'd
like to see lists of both fields and dependent logical files, you have to
use two commands, Display File Field Descriptions (DSPFFD) and Display
Database Relations (DSPDBR).
Because of situations like this, I developed the List File Field
Descriptions (LSTFFD) command a few years ago to display file information in
a format that's easy to read. It not only shows the common information, such
as field name, size, and type, but gives more detail, such as which fields
are key fields, whether or not the key is unique, and what positions the
fields occupy. If the file is a logical file, this command will display the
name of the physical file on which it is based.
Over time, LSTFFD grew and became more functional. It started out simply
displaying the information I've mentioned. As more features became available
in DB/400, I added more options to LSTFFD.
Here is a list of things LSTFFD will do:
. Display the record descriptions of physical and logical files
. Display database relations
. Display trigger information
. Display a database file, formatted in columns, with optional prompting for
record selection
. Display the source code used to create a file You will find more
information about these capabilities in the table in Figure 1.
How It Works
The LSTFFD utility consists of these objects:
. Command LSTFFD
. CL program FFD001CL
. RPG IV program FFD001RG
. Display file FFD001DF
. Printer file FFD001P1 You can get the source code for these objects at
http://www. midrangecomputing.com/mc/98/11. I won't try to explain the code
in detail, but I would like to hit a few high points.
CL program FFD001CL's purpose is to prepare the environment for RPG IV
program FFD001RG. The CL program handles most of the error processing and
builds outfiles of access path and database relations data so that the RPG
program doesn't have to. For example, if you try to run LSTFFD against a
device file, the CL program will trap the error.
FFD001RG handles most of the work. It must be compiled using the options
Default Activation Group DFTACTGRP(*NO) and Activation Group ACTGRP(*NEW)
because of the option to press F9 to display database relations. Selecting
to perform the LSTFFD option from the Display Database Relations window will
cause LSTFFD to call itself. Creating a new activation group with each call
allows you to use LSTFFD without getting an error message that the program
tried to use recursion where it wasn't allowed.
This program uses two APIs and two files to display the file information.
The APIs used are the List Fields (QUSLFLD) API and the Display Database
Relations (QDBLDBR) API. The two files used are the ones that the CL command
created using different formats of the Display File Description (DSPFD)
command with the OUTPUT(*FILE) option.
The QUSLFLD API fills a user space with the file field information. The
Header and List data structures are used to retrieve the data you need for
this command. First, position the header pointer (HeaderPtr) to retrieve
information about the data received-most importantly, the number of entries
in the list information portion of the user space. Once this information is
retrieved, simply process a DO loop the number of times that is stored in
the NumLstEnt variable and fill the subfile with the information needed.
The QDBLDBR API retrieves information about the database relations of the
file being displayed. The same Header data structure contains the header
information as used in the QUSLFLD API since the header information is in
the same layout. Again, a loop is processed to fill the second subfile with
the information.
The two files used in the FFD001RG program contain the key information and
the trigger information. The first file, FFD001PF, contains the key
information for the file. The information is read and loaded into an array.
During the loading of the first subfile, a LOOKUP operation is performed on
this array to determine if it is a key field. If it is, the key information
is loaded for this subfile record. The FFD001PF file is loaded in the
FFD001CL front-end program with the Display File Description (DSPFD) command
using the TYPE(*ACCPTH) parameter.
The second file, FFD002PF, contains information about the triggers attached
to a physical file. At this point in the CL program, you don't know if the
file in question is a physical file or not, so use the Monitor Message
(MONMSG) command after the DSPFD command to catch the error that is produced
when the DSPFD command requesting trigger information is performed on a
logical file.
Printing the file information, whether it is the list of fields or the
trigger information, is pretty straightforward. I named the fields in the
printer files, FFD001P1 and FFD001P2, the same as the fields in the
subfiles, which allows me to simply process the subfile and write the
information out to the printer file. The #Fields variable holds the number
of fields in the subfile after loading, and the #Triggers field holds the
number of triggers loaded. These two variables determine how many times you
process through each subfile.
Accessing File Information Is Now That Much Easier
I think that you will find that the LSTFFD command will become second nature
after you've used it a few times. The information is presented in a simple,
easy-to-read format, and it's available from one command. Whether you're
looking for key information, database relationships, trigger information, or
the file that a logical file is based on, LSTFFD has it all.
LSTFFD will also take you one step closer to the goal of having a
"paperless" office. Instead of printing out file descriptions and keeping
them in a binder, you simply use this command each time you want to see file
information. Another plus is that you will be displaying current file
information, and this information will be available to all employees.
Printouts of file layouts tend to become out-of-date as fields are added or
changed unless you mark up the hard copy or print out a new layout with each
modification. Since this information is available to all employees that you
give access to, no one has to be responsible for maintaining the file layout
information. It will all be available at your fingertips, without ever
having to leave your desk.
Function Command Key Description
Exit F3 End the program. Clear F5 Remove the highlight from fields selected
by the search options. Print F6 Print the file layout exactly as seen on the
screen. Search By Field F7 Display a window that allows you to search for a
field by field name. All matching records will have the field name
highlighted.
Search By Description F8 Display a window that allows you to search for a
field by the description. All matching records will have the field name
highlighted.
Display Database Relations F9 Display a window subfile containing all
dependent files. This display includes an option to perform
LSTFFD on any or all of the particular files listed. After viewing a
dependent file, LSTFFD will return to the original file layout.
Display Triggers F10 Display trigger information for a physical file. This
display lists all pertinent information about any triggers attached to the
file, such as program name, library, and when the trigger is performed.
Display Data Without F13 Display data for physical and logical files using
the RUNQRY command. This option displays the data Record Selection in an
easier-to-read format than the DSPPFM command.
Display Data With F14 Display data using the RUNQRY command. Like F13, but,
before displaying the data, the system Record Selection prompts for record
selection criteria.
Browse Source F15 Display the source that was used to create the file. This
is a call to the Browse Object Source
(BRWOBJSRC) command that was published in the June 1997 issue of Midrange
Computing (see "TechTalk: Browse the Source Code for an Object"). If you
don't have this command installed, an error message will alert you that
there was an error running the command.
Top F17 Reposition the display to the top of the field list. Bottom F18
Reposition the list to the bottom of the field list
William N. Harrell, Jr.
As an Amazon Associate we earn from qualifying purchases.