Informing the IBM Community

WRKJOBSCDE – Working with Job Scheduled Entries

5
(1)

OK, OK, OK, I know this command has been around since the beginning of time but there are a couple of things I find that most people I work with do not realise about this command that can be really useful. So, just bear with me here and check that you know this before you give up on this article.

Displaying Entries in Date and Time Sequence

By default the WRKJOBSCDE command displays all the jobs in Alphabetical Sequence based on Job Name. This is fine for many uses of the command, especially on systems that do not have many entries.

However, when you have loads of entries and/or you are working on an unfamiliar system and you really need to know what jobs are going to run in a specific time period the *DATETIME parameter is a super time saver.

WRKJOBSCDE SEQ(*DATETIME)

This still returns a full list of jobs but this time it gives them to you in time of scheduled execution sequence based on the current job date and time of your session.

The sample below shows the output based on the session time being 14:35 on the 2nd May, so the first scheduled job will run in 25 mins at 15:00.

ProTip: Note that jobs that were run once and set to be saved after (Status SAV) are included at the top of the list and even jobs that are held (Status HLD) are still shown in the order they would have been run if they were released.

Selecting Jobs for a Specific Date

Often we are reviewing the job scheduler because we are looking for a specific window of time on a specific date, perhaps we are planning some downtime at a weekend.  The problem we have with just using the *DATETIME parameter is that we often have jobs that are not scheduled to run every day.  But if we add the specific date we are interested in into the command, this problem goes away.

So for example, if you wanted to know the sequence of jobs that will run this coming Saturday 6th May then all you need to do is add the specific date you are interested in:

WRKJOBSCDE SEQ(*DATETIME) SBMDATE(060517)

Job Queue Sequence

As well as being able to set the sequence to Job name or Date/Time execution sequence, you can also sort them by Job Queue as well with the WRKJOBSCDE SEQ(*JOBQ) command.

This is handy for those system admins with oodles of JOBQs.  Some of you may think that the world of batch jobs starts and ends with QBATCH but you would be mistaken. I have some clients with over a hundred different active JOBQs, all for very specific purposes and with very specific resources and time limitations on them.

User Selection

You can also subset the list you get back by user, so if you just wanted to know what jobs are scheduled to run under a specific user then look no further.  In this example, we want to know who is running batch jobs as QSECOFR, not that any of us would ever do that J

WRKJOBSCDE SCDBY(QSECOFR)

Generic Selection

OK, so if you are still with me let me just check that you know you can subset the list of jobs from the scheduler by a wildcard generic selection.  In the example below, we just want a list of all of the scheduled jobs that start with the letters CAT

WRKJOBSCDE CAT* 

ProTip: This is most handy when you cannot remember the name of the job or if you have a high volume of scheduled jobs and the ones you want are lower down in the sequence.

Combining Selection Criteria with Sequence

Don’t forget that you can combine any selection criteria with sequence criteria, so you could combine the selection of jobs for a specific user on a specific date and get them shown in *JOBQ sequence.

WRKJOBSCDE SEQ(*JOBQ) SCDBY(BRAD) SBMDATE(291117)
If you run the above command on any of my systems you will of course see an entry to run a job that sends me a Happy Birthday message as they are of course my best friends.

Output to Print

Finally, you can add OUTPUT(*PRINT) to any of the above to allow you to create a spool file which you can then easily export and store in your system documentation, operations handbook or even just blu-tack to the wall.

 

Nice to see you

Please come and join us at our main event of the year,
i-UG’s International i-Power Show at the MK Dons Stadium in Milton Keynes on Tuesday 13th & Wednesday 14th June. We will then be back in my home town of Wolverhampton on Thursday 2nd November.

More details and a booking form are available at our website www.i-ug.co.uk

 

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.


Comments

One response to “WRKJOBSCDE – Working with Job Scheduled Entries”

  1. peter kemp avatar
    peter kemp

    Hi Steve,

    nice article.
    Dont forget Carsten Flensburg and I “enhanced” this command some years ago to add extra selection criteria, better viewing of job attributes and also the ability to duplicate a job already on the job scheduler.
    We called it WRKJOBSCD2 at the time but I also call it WRKJS coz it is easier!
    Let me know if you are interested in looking at it. Not sure if there is source still available on this website, in any event there were some fixes made to the code uploaded.
    I use WRKJS every single day…

    https://iprodeveloper.com/rpg-programming/apis-example-one-job-schedule-entry-api-and-four-new-job-schedule-entry-commands

    pk