TechTip: What's in the Job Scheduler?

System Administration
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Your options have been pretty limited…until now!

 

If you work in a large shop, you probably have hundreds of scheduled batch jobs that run throughout the month. And if you're lucky enough to be using a third-party scheduling tool, you might have canned reports and the ability to query the underlying data in ways that make it easy to figure out who's running the job, when it runs, and what command or program it executes.

 

But if you're using the IBM Job Scheduler, your choice is a single report. The WRKJOBSCDE command doesn't have outfile capability, and the *Print Option allows you to filter only by generic Job Name, Scheduled by User, Submit Date, and Job Queue. That means you'll end up browsing that 500-page spool file looking for a Program name, a Parameter, a Job Description, or a Recovery Action. And as luck would have it, one of these days that parameter's going to be an email address that was entered by a colleague who thought it would be really cool to use MiXeD-case. Or maybe one that wraps to the next line on your spooled file. Was that This email address is being protected from spambots. You need JavaScript enabled to view it. or This email address is being protected from spambots. You need JavaScript enabled to view it. or This email address is being protected from spambots. You need JavaScript enabled to view it. ? And is that on one line or two? Good luck finding those.

 

There's also no easy way to move a select group of jobs from one iSeries to another. Granted, that doesn't happen often, but someday you might need to copy or move one or more jobs in the Job Scheduler to another machine. I recently found myself in that situation and was faced with the prospect of manually entering several hundred jobs using the ADDJOBSCDE command. That's a task that would have been not only tedious but extremely error-prone with my typing skills.

 

It seemed the only answer to my dilemma was to write a utility that would dump the Job Schedule information from the source system to a file and write a program that would process that file to add Job Schedule Entries on the target system. That's what I'd like to share with you today.

 

The objects needed to create the Job Schedule Entry outfile are as follows:

 

JOBSCDPF          Type PF-DTA             Job Schedule Outfile

JOBSCDC1          Type CLP                Job Schedule to Outfile Driver Pgm

  • Does a WRKJOBSCDE to *Print
  • Creates file JOBSCHED in QTEMP
  • Copies the Spooled File to JOBSCHED
  • Calls JOBSCDR1

 

JOBSCDR1          Type RPGLE             Get Job Schedule Entries to Outfile

  • Read and Process JOBSCHED
  • Output to JOBSCDPF

 

If all you want to do is analyze your scheduled jobs, the three objects above are everything you'll need. Once the outfile is created, JOBSCDPF has most of the information available for Job Schedule Entries and can be queried with SQL or WRKQRY. You'll have no worries about that job's command wrapping to multiple lines, and you can use whatever String Functions are available to find that MiXeD-case email address. And no problems finding all the jobs that use the Job Description you're planning to change or the ones that your system administrator says have the "wrong" Recovery Action.

 

If you'd like to copy or move jobs to another iSeries, there's one more program you'll need, and it should be compiled on the target system. The ADDJOBSCL CL program processes file JOBSCDPF and uses that information to perform an ADDJOBSCDE. Of course, you'll have to send the JOBSCDPF file from the source to the target system and filter out any unwanted jobs. I'll leave those details up to you. In the code I've supplied, I put the jobs on hold after adding them to the scheduler just as a precaution.

 

Some info that I haven't included in the outfile but that is available in the WRKJOBSCDE report is the "Last Submission" Status and Job. Keep in mind that these have nothing to do with the completion status of the job, only the submission status. I've included the source for all four objects that you'll need, so feel free to make enhancements.

 

I hope this makes managing your scheduled jobs just a little bit easier.

as/400, os/400, iseries, system i, i5/os, ibm i, power systems, 6.1, 7.1, V7,

BLOG COMMENTS POWERED BY DISQUS