From: David Babashanian To: All
On the S/36, it is possible to have the system check for the presence of a specific active job. Is there an AS/400 command to perform this same function?
From: Ernie Malaga To: David Babashanian
No, there is no way to do that. Practically every S/36 programmer that converts to the AS/400 has asked that question, but so far there haven't been any solutions that don't require changing the way your CL programs work.
If you want to determine if program X is running, the best thing you can do is change program X so that it allocates an existing data area X for exclusive use (*EXCL), and deallocates it when the program ends. If any other program needs to know if program X is running, it can attempt to allocate data area X; if the allocation fails, it's because program X is still running.
There's a problem with this approach, however: it requires you to change your programs just so that you can test for this condition. I've asked MI programmers if they can think of a way to provide this function on the AS/400, but so far there haven't been any takers.
Editor's Note: Other BBS users suggested using techniques that run the WRKUSRJOB command to *PRINT and capture the output with QUSRTOOL's CVTWRKUSR. This technique, however, only reveals the names of the jobs that are running-not the names of the programs running in each job. One would then have to run DSPJOB OPTION(*PGMSTK) for each job listed by WRKUSRJOB, again sending the output to *PRINT and capturing it.
Although this technique does provide a list of programs that are running in the system, it takes far too long (especially when running on the low-end AS/400s) to be of any practical value-many of the programs listed as active could have ended by the time the final output is obtained or, what's possibly worse, other programs could have become active.
What we need is an MI program that retrieves this information from whatever internal-and infernal-reference tables are maintained by OS/400. If anyone has developed such an MI program, we would love to publish it.
LATEST COMMENTS
MC Press Online