Question

ISeries Active Jobs

Asked by: douggnau

I'm looking for a CL program to give me the job# of an active job on my ISeries. I have two jobs that have the same name that I want to end but I need to know the job number to do this without intervention.  These are batch jobs that could have a different user each time.
Example:
JOB_NAME_1
JOB_NAME_1

Each time an endjob is submitted, a list of all the jobs (including ones on OUTQ)with that name comes up and I need to pick the ones I want to end.  If I specify the job name and number the job is ended without the need to pick.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-29 at 11:17:01ID24771059
Topics

Programming for iSeries / AS400

,

AS / 400

Participating Experts
3
Points
500
Comments
11

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. iSeries IBM Directory
    Has anyone had any experience with IBM Directory on iseries. We are running V5R3. I am trying to implement EIM, but I cant get the directory server to start. Any help or information would be great. Thanks, Rex
  2. Default printer and OUTQ of a job
    Hi folks, This isn't quite programming, but could be an easy set of points for someone more AS/400 savvy than me. I have a job which a number of users kick off from time to time - and can't determine how the OUTQ and PRTDEV are being chosen. Here's what I've checked for ea...
  3. FileSystemWatcher events not firing on ISeries share.  .N…
    I am using the ISeries File System to allow objects in the File System to be viewed by Windodws. I can create files on the ISeries and view them through Windows Explorer, using a mapped network drive or navigating to the ISeries on my network. I can copy, view, manipulate e...
  4. Excel VBA macro download to iSeries & iSeries job initiatio…
    I need an Excel VBA macro solution to down load a spread sheet to the iSeries (formally AS/400) and then to initiate an iSeries job to process the downloaded sheet. I have already created a VBA macro that converts the data to .csv format and downloads it to an IFS (Integrated...
  5. Spool Files attributes in a outq
    Hi, I am trying to get the attributes of all the spool files sent to a specific OUTQ after my batch process stored into a physical file , usually i will do it manually by searching and copying the spool file to a PF before i would FTP the file to my PC. But i would like to a...
  6. send Iseries password to password protected printer
    We have a color Xerox copier that is password protected on our 2003 server. How do I send the password to the copier from the Iseries?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: tliottaPosted on 2009-09-29 at 12:17:56ID: 25452337

douggnau:

This bit needs clarification:

> I have two jobs that have the same name that I want to end but I need to know the job number to do this --without intervention--.

...plus:

> These are batch jobs that could have a different user each time.

Are you asking simply to end any active job that has the given job name? Or should it only end the jobs if they have a particular user name?

A CL program can obtain a list of active jobs that have a given job name. In order to end any of them, the CL program will need to know which ones to end. It can end them all, one at a time. It can check each job and end the ones with a given user name. It can end each one based upon a variety of possible attributes.

But somewhere along the line, it will need to know how to decide which ones to end.

Keep in mind that anyone who can submit a job can assign any valid name to the job. A job might be running that has been given the same name even though it has nothing to do with the process that you're interested in.

How do you want the CL program to make its decisions?

Tom

 

by: douggnauPosted on 2009-09-29 at 13:51:28ID: 25453331

The job will always have the same name, but could be submitted by user QMQM, QSYSOPR or me. Normally it is QMQM.  I only need to end the active jobs with that name.  Our system is pretty well locked down so no one else can submit jobs to this subsystem.  Most of the jobs I see are in the OUTQ status.

 

by: tliottaPosted on 2009-09-29 at 14:20:36ID: 25453567

douggnau:

> ...no one else can submit jobs to this subsystem.

If the subsystem is an important attribute, then that can be used as a decision element.

Here's a general list of steps that I would use (I can supply details if needed):

1. Create a user space in QTEMP with the Create User Space (QUSCRTUS) API.
2. Call the List Job (QUSLJOB) API to list jobs into the space. Set the qualified job name with '*ALL' for job number and '*ALL' for job user; use the desired job name for the name portion.
3. Loop through the list of jobs.
4. For each job on the list with status = '*ACTIVE', call the Retrieve Job Information (QUSRJOBI) API with format JOBI0200.
5. If the subsystem name from format JOBI0200 is equal to the desired subsystem name, then execute ENDJOB for the fully qualified name. The actual job user and job number will have been supplied in the list of jobs.
6. When the end of the list is reached, delete the user space and return from the CL program. The DLTUSRSPC command can be used rather than the Delete User Space (QUSDLTUS) API.

These are generally some of the easiest APIs to use and some of the ones that are among the first that many developers learn, so you might not have any problem with them. If you've never used system APIs or need guidance, post back. If you can make an attempt at coding first and post your attempt, it might be easier to show where corrections are needed.

Tom

 

by: Gary_The_IT_ProPosted on 2009-09-29 at 14:42:01ID: 25453714

Just to add a quick note:  Here's an RPG program that, while it doesn't do exactly what you want it to do, is a great starting point, with all of the main API calls that Tom mentions already coded.  Should be an easy mod for an experienced programmer:

http://www.code400.com/forum/showthread.php?t=1123

- Gary Patterson

Check out my EE profile: http://www.experts-exchange.com/M_4382324.html



 

by: douggnauPosted on 2009-09-29 at 15:09:52ID: 25453916

Gary, thanks for the suggestion but I haven't used RPG in 25 years!!!
Tom, I'm not much of a programmer and haven't used the API's.  Just a little CL program once in a while when needed for system administration.  I could provide more info if you could start me down the right track, I'm willing to give it a go.  I found a CL program that would list the job # of the last time the job was run, but it didn't help.  It was OK until the job numbers went from 999887 to 000442.  Then it gave the highest number which wasn't the active job.

 

by: stevebowdoinPosted on 2009-09-30 at 03:11:25ID: 25456983

I have to wonder&

Why do you want to cancel them? You could make it where only one can run at a time.

You could create a data area, or some other object not used for anything else.
In the job with the problem, try to lock that object.  If you cannot get an exclusive lock then some other job has it.  If that occurs then RETURN.

Add this code at the top of the CL:
CRTDTAARA  DTAARA(MYLIB/ISITRUNING) TYPE(*CHAR)            
MONMSG     MSGID(CPF0000)                                  
ALCOBJ     OBJ((MYLIB/ISITRUNING *DTAARA *EXCL)) WAIT(1)  
MONMSG     MSGID(CPF1002) EXEC(RETURN)                    

Another way would be to create a JOBQ just for this job.

Steve Bowdoin
 

 

by: douggnauPosted on 2009-09-30 at 03:51:57ID: 25457153

These are trigger programs that run in the MQ Series subsystem.  There are actually three but the other has a different name.  All of them must be active.  Each time I try to end MQ gracefully, one of these throws an error which requires user intervention.  MQ is then left in an unstable state.  About 30 minutes later, a job runs to restart MQ.  That job doesn't know MQ didn't end which makes things even worse.  I've tried using the system reply list but for some reason it won't answer this message.  There are two other messages that this program generates and I've added reply list entries for those that work just fine.

 

by: stevebowdoinPosted on 2009-09-30 at 08:32:02ID: 25459957

on the job that will not use the system reply list, see what you have in "Inquiry message reply" (dspjob then 2, page down one).  try changing it to "*SYSRPYL".

Steve Bowdoin

 

by: douggnauPosted on 2009-09-30 at 09:52:15ID: 25460793

I've changed the JOBD (*RQD) for my profile.  Checked the profile for the QMQM user that would start the job @ IPL (it had *SYSRPYL) and changed the JOBD of others that have the potential to start the jobs.  Tried everything except the IPL on my test system and this works!!  Much easier than where I was trying to go.  I'm still not sure what changed from the MQ upgrade (5.2 to 6.0) though since this wasn't a problem before.  I'll be trying it on my production system around 2:30a tomorrow.

Many thanks!!

 

by: tliottaPosted on 2009-09-30 at 15:15:13ID: 25464192

douggnau:

It might be worthwhile to post the details of the message(s) that is causing the problem. There should be an appropriate way to react to it. A system reply list entry might be the best choice, but maybe not. And the entry might need some detail that will restrict actions to your particular conditions without accidentally interfering with an unintended job.

Tom

 

by: douggnauPosted on 2009-10-01 at 05:46:47ID: 25468058

I have the developer looking at the program now.  There are other programs that run in this subsystem that end without needing a reply.  The message that is generated is custom to this program and wouldn't come from any other.  This system reply list will work.  I tested on my production system last night and it worked fine.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...