Home > AS/400 Tips > iSeries administrator tips > How to use DB2's cross-reference files to help manage your database -- Part II
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

How to use DB2's cross-reference files to help manage your database -- Part II


Ron Turull
06.23.2004
Rating: -4.00- (out of 5)


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



Ron Turull

In the first installment, I introduced you to the eight database cross-reference files that the AS/400-iSeries automatically maintains for the database files on your system. These eight files contain exhaustive information about each and every database file on your AS/400-iSeries. Now let's look at a real-life example of how you can put these cross-reference files to work in your shop.

A utility to help you find the right logical file

We've all gone through the time-consuming searching that is sometimes involved when trying to locate an existing logical file to use in an application. We know what physical file the data is in, but we need to access the data by a certain key. Some of us have purchased third-party utilities or have put together in-house programs to do the job. For those who haven't, I've put together my own utility to save you time.

The Find Logical File utility (FNDLF), takes advantage of the cross-reference files to accomplish the task. You pass the program the name of the library and the name of the physical file over which you want to find a logical file. The program first uses the QADBFDEP file to find all the dependent files (i.e., logical files, SQL views, etc.) built over the physical file. Then, using the logical files ADBKFLD0 and ADBIFLD0, it prints a list of all the dependent files along with their key fields.

Important note: The logical files ADBKFLD0 and ADBIFLD0 are not pre-defined. You must build these logical files yourself over the cross-reference files QADBKFLD and QADBIFLD, respectively, using the DDS source at the following links: ADBKFLD0.LF and ADBIFLD0.LF.

Besides the two parameters mentioned above (library and file name), the program accepts two others:

  • LFONLY -- Include only logical files in the listing. When set to '1', only logical files are included in the listing. Other types of dependent files, such as SQL views, are not included . When you set the LFONLY parameter to '1' the program uses the DBIATR field from the QADBXREF file to check whether dependent files are logical files.
  • PRINT -- Print or display report. When set to '1', the report is printed. When set to anything other than '1', the report is displayed on your screen.

Compiling reminder: Many of the fields in the cross-reference files are null-capable and, in fact, many records contain null values in one or more of these fields. Also, some fields are defined as variable-length character fields. To alleviate having to do any special coding to handle these fields, remember to specify CVTOPT(*VARCHAR) and ALWNULL(*YES) on the RPG compiler commands (either CRTBNDRPG or CRTRPGMOD). That forces the compiler to declare variable-length character fields as fixed-length fields and allow fields containing null values to be retrieved.

Note: Putting a command interface on the front end of this utility is a simple exercise and is left to the reader if desired.

For more information on DB2's cross-reference files, see "DB2 for OS/400 Database Programming" (SC41-3701).

-----------------------------------
About the author: Ron Turull is editor of Inside Version 5. He has more than 20 years' experience programming for and managing AS/400-iSeries systems.


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




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



RELATED CONTENT
iSeries administrator tips
Researching high availability for your System i shop
Translating Linux for IBM i admins: Using GUI to make it easy
Translating Linux for IBM i admins: Working with jobs and networking
OpenOffice: What to know before making the transition from Microsoft Office
OpenOffice: An enterprise open source solution
Database performance comparisons on IBM i
Translating Linux for IBM i admins: User profile commands
Modern System i reports using Client Access
Tips for installing Lotus Domino server on a System i partition
The iSeries Blog has a new home on IT Knowledge Exchange

Systems Management
Can you trust all those trigger programs?
Are your backups complete?
Controlling remote command processing
Watch your profiles
Avoid locking issues
Send message to users at a remote site
Security journal receiver management
Top 10 backup commands
Create an iSeries Access image and update it with the latest Service Pack
Tracking critical file access in real time

DB2 UDB for iSeries
Expert advice on DB2
Make your database easy to read
Top 10 tips from our experts
DB2 expert Kent Milligan offers advice
Schedule stored procedures in DB2 UDB
Special features make creating tables simple
How to use DB2's cross-reference files to help manage your database -- Part I
Revisit your database naming conventions
DB2/400 and DB2 UDB
'Twas the Night Before Christmas in IT

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

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