× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott,
I did not realize it was the Unix jobno.
Like you, I also wrote a KILL command long ago that retrieves & uses the process id.
Just never figured out why I could not use the QShell option directly.

Thanks, Peter



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Tuesday, 6 November 2012 8:56 p.m.
To: RPG programming on the IBM i / System i
Subject: Re: Kill a job

Hi Peter,

You misunderstand. The %jobno option is not referring to the OS/400 job number. It's referring to the Unix job number.


For example, try creating a background job in QShell. This is done by
ending the command line with a & character, that will cause it to put a
job in the background.

For a simple example, try this:

sleep 300 &

The sleep command in QShell is like a DLYJOB in CL, it simply stops
processing for the number of seconds you specify. In this example, I
specified 300 seconds (5 minutes.) So I'm now running a job in the
background that will run for 5 minutes... This is the QShell equivalent
of SBMJOB CMD(DLYJOB DLY(300))

When you run sleep in the background, it should respond with something like:
[1] 2357

In this example the job number is 1, and the process id (pid) is 2357.

I can list the jobs I have running by typing:

> jobs -l
[1] 2357 Running sleep 300 &
$

If I don't want to wait for this sleep command to finish, I could kill
it by typing:

kill %1

Because 1 is the Unix job number, I can kill it with %1. That's all.

So, this isn't the OS/400 job number, as you seem to be assuming... it's
the Unix job number, and this is consistent with all of the Unix
commands running on all Unix-like platforms... which is what QShell
aims to work like.

If you want to send a signal using the OS/400 job name, you might try my
kill utility, which was published here:
http://www.iprodeveloper.com/article/application-development/utility-helps-with-the-killing-65070

Or, if you just want to end the job (without sending an arbitrary signal
the way the Unix kill command does) you could always use the ENDJOB command.


On 11/6/2012 1:39 AM, Peter Connell wrote:
I've registered for the 2nd time in a year on midrange-L and posted this query there but still nothing happens. It's , like I'm a non-person.
I'd really like some input so I'm trying here in spite of this not really being an RPG issue.

Has anyone ever got the QShell command kill to work with anything other than a process ID

The IBM doc appears to suggest that the following should kill a job who job number is 745839 but it just returns an error thinking that a job name has been entered
That said, entering a job name instead of a job number does not work either.
It's annoying having to determine the process id first which works when specifying that as a number without a leading %

kill -s KILL %745839
kill: 001-0026 Job name %745839 is not valid.

Peter



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.