Midrange News for the IBM i Community


Posted by: Chris Proctor
Programmer Analyst
Columbia Sports Company
Portland, OR
Easiest way to determine if a job is active?
has no ratings.
Published: 25 Jan 2016
Revised: 26 Jan 2016 - 2985 days ago
Last viewed on: 28 Mar 2024 (4515 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Easiest way to determine if a job is active? Published by: Chris Proctor on 25 Jan 2016 view comments(1)

Good morning. I have to write a process that will be scheduled and it will check whether or not three specific jobs are active. Is there a simplier way of retrieving this information then somehow using the QUSLJOB API?

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Easiest way to determine if a job is active?
Posted: 8 years 2 months 3 days 13 hours 46 minutes ago
Edited: Tue, 26 Jan, 2016 at 13:01:33 (2985 days ago)

if (isJobActive( theJob ) ); // Is the job active, then continue.

In COZTOOLS, the above function does that for you, but it uses the API you mentioned.

If you don't have COZTOOLS and don't want to write something yourself, you could try this in SQL:

select * from table(qsys2.active_job_info('NO','','ADMIN','')) a

Where ADMIN is the name of the job you want to include in the resultset.

Parameters:

  1. Reset job statitics: 'YES' or 'NO'
  2. Subsystem name filter (up to 25 subsystem names separated by spaces)
  3. Job name filter (generic, full, or *ALL)
  4. User Profile filter (up to 10 user profile names separated by spaces)