• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Flip This Job Number: Adjusting The Job Queue Control Utility For Job Number Resets

    November 12, 2014 Hey, Joe

    I just read your article on creating a skeleton program for controlling IBM i job queues creating a skeleton program for controlling IBM i job queues. In your job queue physical file (WRKJOBQPF) that contains the list of jobs inside a specific job queue, you keyed that file by the six-digit job number of each job in queue. I think that’s a bad idea. Here’s why. . .

    –Charles

    Charles continues:

    “On busy systems where the job number can flip (over to 000001) daily, it introduces a period of time where the results will not be desirable. Needless to say, this occurs any time the job number resets (to 000001). Since the output of the job queue spooled file lists the jobs in their proper order, you are searching a specific field where you have no need to specify a key.”

    Charles has a point here. For a modern system, the IBM i operating system has a relatively limited number of job numbers it can assign to submitted jobs. IBM programmed the system so that it can only number submitted jobs up to six digits long.

    This means the possible range of job numbers for an IBM i partition is 000001 through 999999, or roughly about 1 million unique job numbers. And when your system passes 999999 jobs, it flips over and starts counting again at job number 000001. It’s also important to note that reusing job numbers on an IBM i doesn’t cause an issue with duplicate jobs, because the operating system refers to an individual job by the unique “job number/user name/job name” combination instead of by just the job number.

    The Problem

    And job number resets happen more often than you might think. On smaller partitions, it may take longer to submit a million jobs and flip the job number, perhaps a year or two. But on bigger partitions where you may be running tens of thousands of jobs a day, the job number can flip on a regular basis, perhaps several times a week or month.

    In my WRKJOBQPF file, I keyed the file by job number (the JOBNUM field) in descending sequence. The DDS for WRKJOBQPF looks like this.

    A          R JOBQJOB
    A            FILLER1        1A         TEXT('FILLER FLD 1')
    A            JOBNAME       10A         TEXT('JOB NAME')
    A            FILLER2        3A         TEXT('FILLER FLD 2')
    A            USERNAME      10A         TEXT('USER NAME')
    A            FILLER3        3A         TEXT('FILLER FLD 3')
    A            JOBNUM         6A         TEXT('JOB NUMBER')
    A            FILLER4       99A         TEXT('Filler FLD 4')
    A          K JOBNUM                    DESCEND
    

    Which keeps the jobs in order from newest (largest job number) to oldest (newest file number) AS LONG AS the file numbers haven’t flipped over from 999999 to 000001.

    If the job numbers flip to 000001, then the job order imposed by the JOBNUM descending key will be turned around. The newer jobs with low job numbers will be at the bottom of the file while the older higher job number records will be at the top of the file. And you won’t be able to process the jobs in a job queue by arrival sequence order.

    As Charles pointed out, this is easily corrected by removing the JOBNUM key altogether and just processing the records in arrival number sequence, like this:

    A          R JOBQJOB
    A            FILLER1        1A         TEXT('FILLER FLD 1')
    A            JOBNAME       10A         TEXT('JOB NAME')
    A            FILLER2        3A         TEXT('FILLER FLD 2')
    A            USERNAME      10A         TEXT('USER NAME')
    A            FILLER3        3A         TEXT('FILLER FLD 3')
    A            JOBNUM         6A         TEXT('JOB NUMBER')
    A            FILLER4       99A         TEXT('Filler FLD 4')
    

    By doing this, my skeleton job program will always process the job queue records in the order they were received, without regard to job number. Doing it this way will keep jobs with flipped job numbers starting at ‘000001’ on top of older jobs with job numbers in higher job number ranges. Order will be restored and kept in the job queue file, no matter what.

    So if you’re using my job queue control utility for processing jobs in arrival order, be sure to make this one small change in the WRKJOBQPF file. It could make a big difference in the way you process job queue entries.

    –Joe

    Joe Hertvik is an IBM i subject matter expert (SME) and the owner of Hertvik Business Services, a content strategy organization servicing the computer industry. Email Joe for a free quote for any upcoming projects. He also runs a data center for two companies outside Chicago, featuring multiple IBM i ERP systems. Joe is a contributing editor for IT Jungle and has written the Admin Alert column since 2002. Check out his blog where he features practical information for tech users at joehertvik.com.

    RELATED STORY

    Admin Alert: A Skeleton Utility Program For Controlling IBM i Job Queues



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    VISUAL LANSA 16 WEBINAR

    Trying to balance stability and agility in your IBM i environment?

    Join this webinar and explore Visual LANSA 16 – our enhanced professional low-code platform designed to help organizations running on IBM i evolve seamlessly for what’s next.

    🎙️VISUAL LANSA 16 WEBINAR

    Break Monolithic IBM i Applications and Unlock New Value

    Explore modernization without rewriting. Decouple monolithic applications and extend their value through integration with modern services, web frameworks, and cloud technologies.

    🗓️ July 10, 2025

    ⏰ 9 AM – 10 AM CDT (4 PM to 5 PM CEST)

    See the webinar schedule in your time zone

    Register to join the webinar now

    What to Expect

    • Get to know Visual LANSA 16, its core features, latest enhancements, and use cases
    • Understand how you can transition to a MACH-aligned architecture to enable faster innovation
    • Discover native REST APIs, WebView2 support, cloud-ready Azure licensing, and more to help transform and scale your IBM i applications

    Read more about V16 here.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    NGS:  FREE, Live Webinar: Reporting & Analytics on IBM i for Manufacturers & Distributors. Nov 18
    MiNET:  Automate PDF, email, Fax, Archiving & more with ArtForm400. Try us for a FREE Redbox code!
    ASNA:  Powerful IBM i apps shouldn't require a painful learning curve. Get the ASNA Wings white paper.

    More IT Jungle Resources:

    System i PTF Guide: Weekly PTF Updates
    IBM i Events Calendar: National Conferences, Local Events, and Webinars
    Breaking News: News Hot Off The Press
    TPM @ EnterpriseTech: High Performance Computing Industry News From ITJ EIC Timothy Prickett Morgan

    IBM Builds Infrastructure Resource Site The Windows Of Opportunity

    Leave a Reply Cancel reply

Volume 14, Number 25 -- November 12, 2014
THIS ISSUE SPONSORED BY:

SEQUEL Software
ProData Computer Services
WorksRight Software

Table of Contents

  • TR8 DB2 For i Enhancements, Part 1
  • SQL Functions You Didn’t Know You Had, Part 2
  • Flip This Job Number: Adjusting The Job Queue Control Utility For Job Number Resets

Content archive

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

Recent Posts

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

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