This section explains the job status acquisition API/EE (Mp_StatusJob_Ex).
Synopsis
[Windows]
#include "f3cuapi.h" long Mp_StatusJob_Ex (char *rhost, char *jobname, long jobno, char *jobhost, ulong *compcode, char *userforadmin, int system_num)
[UNIX]
#include "mjesapi.h" int Mp_StatusJob_Ex (char *rhost, char *jobname, int jobno, char *jobhost, uint *compcode, char *userforadmin, int system_num)
Description
This API obtains the status of a job in Systemwalker Operation Manager EE. When the job is in the completion status, you can obtain the job's completion code.
Parameters
rhost
Specify NULL here.
jobname
Specify the job name of a job to be obtained. NULL can be specified. When NULL is specified, specify the job to be obtained with the job number specified in the jobno parameter.
jobno
Specify the job number of the job to be obtained. When specifying NULL in the jobname and when there are multiple jobs that have the same name, you must specify this parameter. If you specify jobname and there is no job with the same name, you can omit the job number. Specify 0 when omitting the job number.
jobhost
Specify NULL here.
compcode
Specify the address of the return area for the completion code of a job. When the job has a completed condition, the completion code will be stored in this area.
userforadmin
Specify this parameter when a system administrator (users belonging to the Administrators group/ the superuser) obtains the status of users' jobs. Specify the owner name of the obtained job. If the owner name is not specified, NULL should be specified.
system_num
Specify operating target subsystem number using a range of 0 to 9.
Return Values
Return Value | Meaning | Action |
---|---|---|
0 | Specified job does not exist. | - |
1 | Execution waiting status. | - |
2 | Execution on hold status. | - |
3 | Executing. | - |
4 | Output on hold status. | - |
5 | Job is completed. | - |
-1 | A system error occurred. | Collect "Job Execution Control" information with the maintenance information collection tool and contact a Fujitsu SE. |
-1000 or less | Status acquisition processing was aborted because an error was detected in Job Execution Control. Error messages can be obtained using the error message acquisition API. | Use the error message acquisition API to obtain the error message and take whatever action is required. |
Caution
When the argument is pointing to an invalid address, this function ends abnormally, and no operations will be defined.
Program Example
Below is an example program of the job status acquisition API/EE:
[Windows]
#include <windows.h> #include <stdio.h> #include "f3cuapi.h" int main (int argc, char **argv) { long jobno = 0; long rtn = 0; unsigned long compcode = 0; char errmsg[256+1]; int system_num; /* * initialization working area */ memset(errmsg, 0x00, sizeof(errmsg)); if (argc != 2) { printf ("Usage: %s <jobno>\n", argv[0]); return (1); } /* * set jobno */ jobno = atoi(argv[1]); /* * call Mp_StatusJob_Ex() API */ system_num = 0; rtn = Mp_StatusJob_Ex (NULL, NULL, jobno, NULL, &compcode, NULL, system_num); /* * check return code of Mp_StatusJob_Ex() API */ if (rtn == 0) { printf ("Job %d is not found.\n", jobno); return (0); } else if (rtn == 1) { printf ("Job %d is waiting for execution.\n", jobno); return (0); } else if (rtn == 2) { printf ("Job %d is holding for execution.\n", jobno); return (0); } else if (rtn == 3) { printf ("Job %d is executing.\n", jobno); return (0); } else if (rtn == 4) { printf ("Job %d is holding for output.\n", jobno); return (0); } else if (rtn == 5) { printf ("Job %d was completed. completion code = %d\n", jobno, compcode); return (0); } else if (rtn == -1) { printf ("GetLastError() is %d.\n", GetLastError()); } else if (rtn <= -1000) { printf ("Error code is %d.\n", rtn); Mp_GetMJESerror (errmsg); printf ("errmsg = %s\n", errmsg); } return (1); }
[UNIX]
#include <stdio.h> #include <errno.h> #include "mjesapi.h" int main (int argc, char **argv) { int jobno = 0; int rtn = 0; unsigned int compcode = 0; char errmsg[256+1]; int system_num; /* * initialization working area */ memset(errmsg, 0x00, sizeof(errmsg)); if (argc != 2) { printf ("Usage: %s <jobno>\n", argv[0]); return (1); } /* * set jobno */ jobno = atoi(argv[1]); /* * call Mp_StatusJob_Ex() API */ system_num = 0; rtn = Mp_StatusJob_Ex (NULL, NULL, jobno, NULL, &compcode, NULL, system_num); /* * check return code of Mp_StatusJob_Ex() API */ if (rtn == 0) { printf ("Job %d is not found.\n", jobno); return (0); } else if (rtn == 1) { printf ("Job %d is waiting for execution.\n", jobno); return (0); } else if (rtn == 2) { printf ("Job %d is holding for execution.\n", jobno); return (0); } else if (rtn == 3) { printf ("Job %d is executing.\n", jobno); return (0); } else if (rtn == 4) { printf ("Job %d is holding for output.\n", jobno); return (0); } else if (rtn == 5) { printf ("Job %d was completed. completion code = %d\n", jobno, compcode); return (0); } else if (rtn == -1) { printf ("errno is %d.\n", errno); } else if (rtn <= -1000) { printf ("Error code is %d.\n", rtn); Mp_GetMJESerror (errmsg); printf ("errmsg = %s\n", errmsg); } return (1); }