ave you ever spent time trying to solve an apparent
data or program problem on your AS/400, only to find out that
your logical file was based on the wrong physical file? How much
time did you spend before you figured it out? How much damage
was done to your production data before you discovered the problem?
You can search for this type of file dependency problem
routinely and find it before it becomes a bigger issue.
My assumption is that when you create logical and
physical files destined for production libraries, you have a standard
placement for these files. For instance, many companies like
to have physical files and their associated logical files in the
same library. I am going to assume for the purposes of my examples
throughout this article that you always place your payroll files
(both physical and logical) in a library called PAYFILES.
For each library you analyze, it will be necessary to check for two file dependency problems. If you have physical and logical files in the same library, and check in only one of the following ways, you could easily miss about half of the problems that could occur.
First, look for situations where the physical file is in the library you are analyzing (PAYFILES in this example), but the logical file is in a different library.
Second, check for cases where the logical
file is in the library being examined (PAYFILES), but its physical
file is in a different library.
Use command DSPDBR and direct the output to a file. For example:
FILE(PAYFILES/*ALL) OUTPUT(*OUTFILE)
OUTFILE(mylib/myfile)
The record format for the DSPDBR outfile will be
QWHDRDBR. Use the select records feature of query to print any
records in the file where the library name for the physical file
is not the same as the library name for the logical file. There
will be an exception for situations where the physical file has
no logical file, and therefore the library specified for the logical
file is blank. In the situation I have assumed, the query select
records tests would be:
WHRLI NE WHRELI
AND WHRELI NE ' '
Use command DSPFD with the output sent to a file. For example:
DSPFD
FILE(PAYFILES/*ALL)
TYPE(*MBR)
OUTPUT(*OUTFILE)
FILEATR(*LF) OUTFILE(mylib/myfile2)
The record format for the second file will be QWHFDMBR. Use the select records feature of query to print any records in the file where the library name for the logical file is not the same as the library name for the physical file.
In the situation I have assumed, the query select
records test would be:
MBLIB NE MBBOL
Since each *LF must have a *PF, there is no need to check for blanks.
The AS/400 will provide information for only the files to which you have sufficient authority. You will need to ensure that you have enough authority to obtain information on all of the files in the library being analyzed. It is unlikely that you will be able to have access to the QSECOFR password every time you want to check your file dependencies.
It is preferable to create commands and command-processing
programs which adopt QSECOFR authority. Create new commands and
command-processing programs called, for instance DSPDBRALL and
DSPFDALL. Have the security officer compile these new objects
with USRPRF(*OWNER) and make the owner QSECOFR.
When you use the commands DSPDBRALL and DSPFDALL,
you will get information reported on all files in the requested
library, but will not have permanent access to them or their contents.
Because record selection tests were used in the queries,
your reports will include only those situations where the physical
and associated logical file are not in the same library.
Consider using this method of checking file dependencies
whenever promotions to production involve file changes. You could
also use it routinely to find problems before they occur. Maybe
then, you really could depend on your logical files!
T
<
G