No matter how well you plan the design of a
database file, it will eventually need to be changed. When a file is
changed, all the programs using the file need to be re-compiled. If this
is not done, then while executing the program, you will get a level
check error (CPF4131).
To avoid this, either the (i) file needs to be compiled with Level Check
(*NO) or (ii) the programs using the file need to be re-compiled. The
first solution is very simple since you just need to set Level Check as
*NO while compiling the file.
If you need to maintain the data integrity, then it's better to
re-compile all the programs that are using the particular file(s).
If you choose to use the second method, the first thing you must know is all the programs that are using the particular
file(s). One way of finding this out is to check the sources of all
the programs for the particular file. This will be an easy task if you have only one library where the sources of all the programs are present.
But if the sources are spread across different libraries and there are
lots of libraries present, then it will be a tedious task to find all
the programs that are using the file(s) and there are always
possibilities that one or more programs might get missed out.
In order to overcome the above problem, iSeries provides us with the
DSPPGMREF command. This command provides us with the list of the objects
used by a specified program. Use this command and then take F4.
Type choices and press Enter.
Enter the values as given above and in the File to receive output Field,
give the name of the physical file to be created and in the Library,
give the name of the library where it should reside and press Enter.
This creates an outfile in the library mentioned (Lets say the
outfile is DSPOUTPUT created in the library QGPL...
To continue reading for free, register below or login
To read more you must become a member of Search400.com
');
// -->

).
Now, run a query on this file with the following selection criteria and
press Enter.
WHFNAM EQ 'Filename'
Where the 'Filename' was will be the physical, logical or the display file that needs to be delivered.
The output of this query shows all the programs that are using the
particular file. This helps you to determine all the programs that are
using the particular file and then you can re-compile the programs
accordingly.
This outfile also contains the information regarding the mode in which
the file is opened. This can be obtained with the WHFUSG field.
This outfile is not only used for finding the programs that are using a
particular file(s), but also the programs that are calling a particular
program. Example, if you want to find out all the programs that are calling
a particular program (lets say program ABC), then just give the
following selection criteria.
WHFNAM EQ 'ABC'
The output of this query will show all the programs that are calling
program 'ABC'.
Note:
The time taken for the creation of the outfile depends upon the
number of user libraries present in the iSeries server.
==================================
MORE INFORMATION ON THIS TOPIC
==================================
The Best Web Links: tips, tutorials and more.
Visit the ITKnowledge Exchange and get answers to your developing questions fast.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.