Home > AS/400 Tips > iSeries programmer tips > Find the programs that use a particular file using DSPPGMREF
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Find the programs that use a particular file using DSPPGMREF


Sasi Kumar Damodharan
03.04.2005
Rating: -4.22- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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...

Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries programmer tips
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Implementing a browser interface in COBOL: Displaying database fields
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
Making the most of RPG data handling on IBM i
Groovy programming on IBM i

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


).

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.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts