Programs in Use tells you when programs are active within
the call stack of open jobs. There are many situations
when you would want to know this, but unfortunately
OS/400 provides no easy way to find this out -- called
programs are not locked so you are not able to tell
when a program is being run or which jobs are using
it.
People are TOLD - do not be in shipping while the billing
is running. But how do you KNOW the billing is running?
There are other examples of the same kind of thing.
You cannot get into this order because it is in a particular
kind of state -- well who is on-line right now doing
the kind of work that puts it into that state?
Who's doing what?
Find who's calling a program. The WRKPGMINU command
returns information about a single program, generic
program/library, or all programs and libraries. The
All Programs mode gives you an overview of who's signed
on and what they're doing. See the screen shots.
APIs - call these from your application programs.
This tool also has two Application Program Interface
(API) programs that can return information for your
applications.
API #1 - see if a program is being used.
This API will pass back information on whether a program
is being used. It can return either a Yes / No flag
to say whether a program is active, or a list of jobs
which are using that program.
E.g. suppose that an 'Invoice Run' program is not
allowed to be used by more than one user at a time.
How do you check for such use? A common method is to
flag a byte in a data-area. But if the Invoice Run falls
over that flag stays set and must be switched off manually.
And if the program is being used, then how will a user
know who is using it? This API can return such information
for you to display on their screens.
API #2 - retrieve call stack.
This API will retrieve the call stack (invocation stack)
of any job. This sought-after function is strangely
absent in OS/400*. A qualified job name (name+user+number)
is sent to the API and the call stack is returned in
an array (no user spaces required). It works at all
security levels.
A good feature of this API is that it allows you to
retrieve the stack backwards, i.e. most recent program
first. Why backward? Because most the time all you are
interested in is the name/library of your current program
or the program which called it. So with this feature
you won't need to cater for array processing. See the
below screen shots.
See some Screen
Shots (including code examples)
Download
a free trial version.
Shareware price:
$150 USD**
This software is provided as shareware. It is supplied
on the condition that if it were to be used on an ongoing
basis or for a commercial purpose, that it be purchased
in accordance with the prices, terms and payment methods
set out in the accompanying documentation.
* This function has now become available
in V5R1 via API: QWVRCSTK. This product's API#2 is still
useful for prior releases, and also works on V5R1.
** Prices are subject to change
without notice unless previously agreed to.
|