Hi Scott - thanks for your reply.
I do know about MONMSG, that can be used to trap an error, as well as the availability of DOWHILE, DOUNTIL and DOFOR commands that can be used to implement loops.
What I didn't know (and just found out late last night) was that you could use MONMSG to capture QSH0002 errors
However, that is just TOO all encompassing.
The question is - Can I capture the QSH0002 for ONLY error code 3489 reason code 4?
So far, my investigation has not discovered anything

Alan Shore
Programmer/Analyst, Direct Response
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Thursday, October 25, 2012 2:31 AM
To: Midrange Systems Technical Discussion
Subject: Re: Trapping a QSHELL command error in CL

Hi Alan,

CL has a command called MONMSG that can be used to trap an error. IT
also has DOWHILE, DOUNTIL and DOFOR commands that can be used to implement loops.

I'm assuming you know this already -- and probably tried it, and it didn't work for some reason. Can you tell us about that?

Personally, I try to avoid using QShell in environments like this. I always run it in a *NOMAX subsystem. If I need it to work in an environment where jobs are limited, I tend to go the extra mile (i.e. do a little more work) and code up a program that does the task for me without a need to spawn more jobs. But, I'm generalizing here... Your situation may be different.

On 10/24/2012 9:47 AM, Alan Shore wrote:
Hi everyone
I am running a CL program that calls a QSHELL command from batch. I am getting QSH0002 error code 3489 reason code 4.
I have searched the web and found the following explanation (which
makes some sense) Quote
QSHELL message 3489 is ENOSYSRSC. Approximately 95 percent of the time this is caused by trying to run QSH from a subsystem where the subsystem has a only a maximum active job of 1 (one). If you can run the command interactively but not from your CL batch program, it is likely that it is due to the maximum active jobs of the subsystem.
To see the maximum active jobs for a subsystem, on the OS/400 command line type the following (for example, for QBATCH):
Press the Enter key. Then, select Option 1, Operational attributes. Review and increase the maximum number of active jobs parm if needed.
Also, although spawn() (and, therefore, QSHELL) bypass the job queue, if the maximum jobs are changed, typically the maximum active jobs for a job queue also must be changed. This is displayed under --> 6. Job queue entries.
Since this error message is a result of running out of available jobs. The recommendation is to put this job in its own subsystem or increase the number of jobs allowed to be running in the subsystem.
End quote
This only happening, on average, once or twice a month, no set pattern or time of day, so by the time I am told about the MSGW and I investigate the problem, nothing is apparent as to the cause.
My question is :- how can the QSH0002 error code be captured within a loop to somewhat (and I am stressing somewhat) ignored.
Hope that question makes sense

As always, ALL responses gratefully accepted

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at

Disclaimer: This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2015 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact