• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • File Members and the Library List

    May 25, 2005 Dominic Lefevre

    What happens when an RPG or COBOL program opens a file? For one thing, the system has to find the file. And where does it look for the file? Everyone knows the answer to that question. The system searches the libraries in the library list, beginning with the system library list, proceeding through the product libraries, the current library, and finally the user libraries. The system selects the first file it finds of the desired name, right? Not necessarily.

    The exception comes when the system is searching for a certain file member. If the system does not find the desired file member in a file of the desired name, the system will continue to search the libraries in the library list.

    Here’s a little test you can run for yourself. Create two files of the same name in different libraries. I suggest you use work libraries. You can use QTEMP for one of them. Give the members different names.

    crtpf qtemp/x rcdlen(48) mbr(one) 
    crtpf mylib/x rcdlen(48) mbr(two)
    

    Use a database utility, such as DFU, to load one record into each of the files. I suggest you key ONE in member ONE and TWO in member TWO.

    Use the Display Physical File Member (DSPPFM) command to display the files.

    dsppfm x one
    dsppfm x two
    

    You will see that the system will find the right member, no matter the order of the libraries in the library list.

    Source physical files also work well for this test. Give it a try with files of the same name, such as QRPGSRC, in different libraries.

    This same behavior holds true with RPG (and, I assume, COBOL) programs. RPG normally opens the first member of a file, but if you override a file to a certain member, or you add the EXTFILE and EXTMBR keywords in RPG F specs, the system will continue to scan through the libraries in the library list until it finds a file member of the proper name.


    The system is not consistent, however. The Run Query command chokes if it does not find the desired member in the first instance of the desired file.

    runqry qry(*none) qryfile((x two))  
    runqry qry(*none) qryfile((x one))  
    

    One of the two commands generates message QRY1612 (Member ONE not in file X in MYLIB).

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Computer Keyes

    Fax Directly from your IBM i

    KeyesFax is a full function automated IBM i fax system. Spooled files are burst by fax number and auto transmitted with overlays.  It combines both a send and receive facsimile processing system with a complete image package.

    The fax software will edit, send, receive, display, print, and track fax documents or images using any standard IBM i without additional expensive hardware, software or subscriptions.

    Computer Keyes has been developing Software Solutions since 1978!

    www.computerkeyes.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    WRQ Improves Security of Terminal Emulation Suite Intel Partnership Doesn’t Hurt iSeries Strategy, JDA Software Says

    Leave a Reply Cancel reply

Volume 5, Number 21 -- May 25, 2005
THIS ISSUE
SPONSORED BY:

ProData Computer Svcs
iTera
WorksRight Software

Table of Contents

  • Creating Pivot Tables on the iSeries
  • File Members and the Library List
  • Admin Alert: Configuring Windows Desktops to Use SSO

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • With Power11, Power Systems “Go To Eleven”
  • With Subscription Price, IBM i P20 And P30 Tiers Get Bigger Bundles
  • Izzi Buys CNX, Eyes Valence Port To System Z
  • IBM i Shops “Attacking” Security Concerns, Study Shows
  • IBM i PTF Guide, Volume 27, Number 26
  • Liam Allan Shares What’s Coming Next With Code For IBM i
  • From Stable To Scalable: Visual LANSA 16 Powers IBM i Growth – Launching July 8
  • VS Code Will Be The Heart Of The Modern IBM i Platform
  • The AS/400: A 37-Year-Old Dog That Loves To Learn New Tricks
  • IBM i PTF Guide, Volume 27, Number 25

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle