• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Case-Insensitive Searching Of Spooled Files

    March 3, 2015 Ted Holt

    We rely heavily on the DSPSPLF (Display Spooled File) command. We use it all day long, you and I, usually by selecting option 5 from various work-with displays. And yet this workhorse on which we depend suffers from a glaring deficiency–searching for text is case-sensitive. We expect case sensitivity from primitive operating systems like Unixsaurus, but not from the powerful IBM i. Here are a few ways to locate text in spooled files regardless of case.

    First is the modern–and in my opinion, the best–way: IBM Navigator for i, the browser application that replaces System i Navigator. This app runs on port 2001 and requires that the *ADMIN instance of the HTTP server be running. If you haven’t tried it yet, I encourage you to do so. For more information about Navigator for i, visit the Navigator for i Web page.

    Expand Basic Operations and click on Printer Output to get a list of your spooled files.

    Figure 1

    (Click graphic to enlarge.)

    You can open a spooled file in a viewer or as a PDF. Either way, you have a case-insensitive search option.

    Maybe you need something that doesn’t require a browser, something that runs in a batch job perhaps. A second method to search a spooled file is with SQL. Create a temporary physical file if you don’t have one already.

    crtpf mylib/splf rcdlen(132)
    

    Copy the spooled file to the temporary file.

    CPYSPLF FILE(QPJOBLOG) TOFILE(MYLIB/SPLF)
       JOB(123456/MYSELF/MYJOB) SPLNBR(3) CTLCHAR(*NONE)
    

    Use SQL to query the physical file.

    select * from mylib/splf
     where upper(splf) like '%SMITH''
    

    The query yields something like the following:

    Smith Widget Mfg Corp                   45.00     7.91        21
    Joe Smitherman, Esq.                   150.00     2.80         6
    Billy Gunsmith                          28.00    14.02       300
    LO-SMITHY-DIN                             .00     3.75        93
    

    You can also use Qshell to search spooled files. Use the catsplf utility to pipe the spooled file into the tr utility, which translates the text from lowercase to uppercase. Pipe the uppercase text into grep to find the search string.

    catsplf -j 476583/MYSELF/MYJOB QSYSPRT 1 | tr 'a-z' 'A-Z' | grep 'SMITH'
    

    Or:

    catsplf -j 476583/MYSELF/MYJOB QSYSPRT 1 | tr '[:lower:]' '[:upper:]' | 
    grep 'SMITH'
    

    Output looks like this:

    1 SMITH WIDGET MFG CORP                   45.00     7.91        21
    3 JOE SMITHERMAN, ESQ.                   150.00     2.80         6
    4 BILLY GUNSMITH                          28.00    14.02       300
    6 LO-SMITHY-DIN                             .00     3.75        93
    

    If you want to see the text without converting the text, try this version of grep instead:

    catsplf -j 270234/MYSELF/MYJOB QSYSPRT 1 | grep [Ss][Mm][Ii][Tt][Hh]
    

    The grep expression tells the system to look for a upper- or lowercase s followed by an upper or lowercase m followed by . . . . You’ll get output like this:

    1 Smith Widget Mfg Corp                   45.00     7.91        21
    3 Joe Smitherman, Esq.                   150.00     2.80         6
    4 Billy Gunsmith                          28.00    14.02       300
    6 LO-SMITHY-DIN                             .00     3.75        93
    

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    LaserVault:  Outperforming Tape: Faster IBM i Backups with Fibre Channel. Webinar - March 3
    BCD:  Modernize Your IBM i Document Design and Distribution. Free Webinar: March 5
    System i Developer:  Upgrade your skills at the RPG & DB2 Summit in Dallas, March 17-19

    IBM Boosts Capacity On FlashSystem Arrays There Is No Lack Of RPG Programmers, IBM i Community Contends

    One thought on “Case-Insensitive Searching Of Spooled Files”

    • shaychuk says:
      September 6, 2020 at 9:43 am

      thank you, I find catsplf command unusable when there are many spool files to search from after some time it starets running very slow are there any alternatives ?

      Reply

    Leave a Reply Cancel reply

Volume 15, Number 04 -- March 3, 2015
THIS ISSUE SPONSORED BY:

WorksRight Software
Bug Busters Software Engineering
Northeast User Groups Conference

Table of Contents

  • Old Stuff, New Ways: Avoiding Record Locks
  • Case-Insensitive Searching Of Spooled Files
  • Git To GitHub

Content archive

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

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

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