|
Dedicate a thread to using a native method with
the QUSRJOBI or QWCRTVCA APIs to retreive
the 'End Status' information.
If the job is ending the native method
This will solve your subsystem never ending problem.
Although remember, System.exit() is not really 'orderly'.
8-)
Here's an example C program that polls every 5 seconds.
Replace main() with your native method, and have it
throw an exception or return a specific return code to the JVM.
#ifdef __AIXxiCC__
#include <qusrjobi.cleinc>
#include <qusec.cleinc>
#else
#include <qusrjobi.h>
#include <qusec.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int isEndJobControlled(void);
int main(int argc, char **argv)
{
while (1) {
printf("Checking for *CNTRL'd endjob\n");
if (isEndJobControlled()) {
printf("Bailing. Someone did endjob *CNTRL'd\n");
exit(0);
}
printf("Sleeping for a bit\n");
sleep(5);
}
return 0;
}
int isEndJobControlled(void)
{
Qwc_JOBI0600_t info;
Qus_EC_t errorCode = { sizeof(errorCode), 0 };
memset(&info, 0, sizeof(info));
QUSRJOBI(&info, sizeof(info),
"JOBI0600", /* Format of returned Data */
"* ", /* This job */
" ", /* Unused */
&errorCode); /* Error Code */
if (errorCode.Bytes_Available != 0) {
printf("Error on QUSRJOBI, <%.7s>\n", errorCode.Exception_Id);
return 1;
}
/* The End_Status field describes if the job is in a controlled */
/* End state */
if (info.End_Status[0] == '1') {
return 1;
}
return 0;
}
"The stuff we call "software" is not like anything that human society
is used to thinking about. Software is something like a machine, and
something like mathematics, and something like language, and
something like thought, and art, and information...
but software is not in fact any of those other things."
Bruce Sterling - The Hacker Crackdown
Fred A. Kulack - AS/400e Java and Java DB2 access, Jdbc, JTA, etc...
IBM in Rochester, MN (Phone: 507.253.5982 T/L 553-5982)
mailto:kulack@us.ibm.com Personal: mailto:kulack@bresnanlink.net
AOL Instant Messenger: Home:FKulack Work:FKulackWrk
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.