• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Where Do Library Lists Reside?

    August 4, 2015 Ted Holt

    I often sit and ponder the mysteries of life. For example, why do some people use C to write business applications? Why does the text of message SQL6789 end in a period instead of a question mark? And, recently, why do people circumvent powerful features of the robust IBM i operating system? Let me show you what I mean.

    The circumvented feature that is on my mind at present is the library list. In case you’re new to the IBM i world, the library list is a list of libraries that the system searches when looking for an object. It’s similar in concept to the path variables that are used in less robust operating systems, which are more or less a collection of utilities.

    IBM i searches the library list for any type of object: programs, files, data areas, data queues, output queues, and so forth. This allows users to do their jobs without stepping all over each other’s feet.

    For example, consider a manufacturer with factories in two cities: New Yolk and Lost Angeles. The users in both factories can share the same program library, but use separate data libraries.

    The New Yolk users have a library list like this:

    NYLIB
    PGMLIB
    QGPL
    QTEMP
    

    Lost Angeles users have a library list like this:

    LALIB
    PGMLIB
    QGPL
    QTEMP
    

    Recent source code listings that I have seen have made me painfully aware that people often hard code library names rather than letting the system search the library list. I thought everyone had quit hard coding library names eons ago, but being my usual naive self, I was wrong.

    Here’s an example that illustrates.

    ADDLIBLE LIB(MYLIB) POSITION(*FIRST)
    

    The programmer thought, “This program needs library MYLIB because that’s where file XYZ is. Since MYLIB is not in the library list, I’ll just add it.”

    Here’s another.

    OVRDBF FILE(MYFILE) TOFILE(HISLIB/HISFILE)
    

    Maybe HISLIB was not in the library list. Maybe HISLIB was in the library list, but another library higher in the list also had HISFILE. Who knows?

    Here’s one more for good measure.

    CALL PGM(THEIRLIB/THEIRPGM)
    

    Maybe THEIRLIB is not in the library list. Maybe THEIRLIB is in the library list and the programmer qualified the program name anyway. I’ve seen it before.

    Why is hard coding library names less than ideal? For one thing, it eliminates or at least obstructs the use of parallel databases, as in the New Yolk-Lost Angeles example. In one of the most convoluted examples of coding I’ve ever seen, CL programs retrieved a data area (using the library list), then read the contents of the data area to condition overrides.

    DCL        VAR(&LOCATION) TYPE(*CHAR) LEN(12)
    
    RTVDTAARA  DTAARA(LOCATION *ALL) RTNVAR(&LOCATION)
    IF         COND(&LOCATION *EQ 'Lost Angeles') THEN(DO)
    OVRDBF     FILE(NYOPNORD) TOFILE(LALIB/LAOPNORD)
    ENDDO
    ELSE       CMD(DO)
    OVRDBF     FILE(NYOPNORD) TOFILE(NYLIB/NYOPNORD)
    ENDDO
    

    I think most programs had “logic” like this, and it was certainly one of the most bizarre systems I ever worked on.

    Hard coding library names also blows testing to smithereens. If you don’t hard code a library name, you can insert test libraries ahead of production libraries in order to test program changes. If a CALL has a hard coded production library name, the system won’t run your test version.

    What’s the number one reason for hard coded library names? Heck if I know. But one big reason is that people don’t create job descriptions. They run everything through job descriptions that come with the system, such as QBATCH and QDFTJOBD. Job descriptions are still underused and unappreciated. These job descriptions are not designed for their environments and don’t have the required libraries.

    Recently a fellow IBM i professional told me that he needed to make a program submit a batch job that needed a library that was not in the library list. Without knowing why, he knew that a batch job uses the library list of the submitter. I told him he had two choices.

    One, he could modify the library list that the submitting job used. I assumed that would be a job description that pointed back to system value QUSRLIBL, but boy, was I wrong! The submitting interactive job, that is to say, the interactive jobs of the end users, ran an initial program with a lot of Add Library List Entry (ADDLIBLE) commands in it. (It was not the first time I had seen this technique used to set the library list of an interactive job.) Since the users did not need this library, he decided not to modify their initial program.

    His other option was to create a job description for his batch job, list the required libraries in the batch job, and use INLLIBL(*JOBD) in the Submit Job (SBMJOB) command. Here’s the sort of thing I’m talking about.

    SBMJOB CMD(CALL PGM(GL855C))
           JOB(GLPOSTING)
           JOBD(GLPOSTING)
           JOBQ(*JOBD)
           INLLIBL(*JOBD)
    

    He created a new job description. Problem solved, and easily at that.

    So where do library lists reside? They reside in job descriptions. The reason is that there is no *LIBL object in IBM i is that there is no need for one.

    One word of caution is in order. Before you delete or rename a library, be sure to remove it from any job descriptions where it is referenced, whether in the initial library list or some other parameter. If you think about it, the more you’ve hard coded a library name, the more work you must do before you can delete or rename the library.

    As for those mysteries, I suppose some people write business applications in C because that’s the only language they know or the language they know best. It’s the same reason I write some of my utilities in RPG when I should probably use C instead. The bottom line is that you and I can’t control other people.

    As for SQL6789, I’m sure that the person who wrote that message text knows that interrogative sentences end with a question mark. It’s just an oversight. I often make such mistakes, even in the articles I write for this august publication. Again, there’s nothing you or I can do about that message text.

    As for circumventing the library list, I don’t know why IBM i programmers hard code library names so frequently, but I do know that this is something you and I can do something about, at least in our own shops.

    RELATED STORIES

    Job Descriptions: Underused and Unappreciated

    Admin Alert: How to Set i5 Library Lists for 5250 and Batch Jobs

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    BCD:  IBM i Ebook: The Business Case for IBM i Green Screen Modernization
    SystemObjects:  Send SMS, email & push messages from your IBM i applications!
    System i Developer:  Session Grid Posted: RPG & DB2 Summit - Chicago, October 20-22

    Legacy ERP Conversion Under Way At Dietz & Watson The IBM i Market Is Not Economics 101

    Leave a Reply Cancel reply

Volume 15, Number 15 -- August 4, 2015
THIS ISSUE SPONSORED BY:

WorksRight Software
PowerTech
OpenLegacy

Table of Contents

  • An Introduction To Processing XML With RPG, Part 1: The Basics
  • Where Do Library Lists Reside?
  • Know Your PTF Group Level Currency In 30 Seconds Or Less!

Content archive

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

Recent Posts

  • Tool Aims To Streamline Git Integration For Old School IBM i Devs
  • IBM To Add Full System Replication And FlashCopy To PowerHA
  • Guru: Decoding Base64 ASCII
  • The Price Tweaking Continues For Power Systems
  • IBM i PTF Guide, Volume 27, Numbers 31 And 32
  • You Can Now Get IBM Tech Support For VS Code For i
  • Price Cut On Power S1012 Mini Since Power S1112 Ain’t Coming Until 2026
  • IBM i: Pro and Con
  • As I See It: Disruption
  • IBM i PTF Guide, Volume 27, Number 30

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