Qp0wGetJobID()--Get Qualified Job Name and ID for Process ID


  Syntax
 #include <qp0wpid.h>

 int Qp0wGetJobID(pid_t pid, QP0W_Job_ID_T *jobinfo); 

  Service Program Name: QP0WPID

  Default Public Authority: *USE

  Threadsafe: Yes

The Qp0wGetJobID() function returns the qualified job name and internal job identifier for the process whose process ID matches pid.


Parameters

pid
(Input) The process ID of the process whose job number is to be returned. When pid has a value of zero, the process ID of the calling process is used.

*jobinfo
(Output) A pointer to the qp0w_job_id_t structure. This structure contains the qualified i5/OS job name and internal job identifier for the process identified by pid.

The structure qp0w_job_id_t is defined in the <qp0wpid.h> header file as follows:

typedef struct QP0W_Job_ID_T {
    char    jobname[10];
    char    username[10];
    char    jobnumber[6];
    char    jobid[16];
} QP0W_Job_ID_T;

The members of the qp0w_job_id_t structure are as follows:

char jobname[10] The name of the job as identified to the system. For an interactive job, the system assigns the job the name of the work station where the job started. For a batch job, you specify the name in the command when you submit the job.
char username[10] The user name under which the job runs. The user name is the same as the user profile name and can come from several different sources, depending on the type of job.
char jobnumber[6] The system-generated job number.
char jobid[16] The internal job identifier. This value is sent to other APIs to speed the process of locating the job on the system. The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs.

Authorities

The process calling Qp0wGetJobID() must have the appropriate authority to the process whose job number is to be returned. A process is allowed to access the job number for a process if at least one of the following conditions is true:


Return Value

0 Qp0wGetJobID() was successful.
value Qp0wGetJobID() was not successful. The value returned indicates one of the following errors. Under some conditions, value could indicate an error other than those listed here.
[EINVAL] The value specified for the argument is not correct.

A function was passed incorrect argument values, or an operation was attempted on an object and the operation specified is not supported for that type of object.

An argument value is not valid, out of range, or NULL.

[EPERM] Operation not permitted.

You must have appropriate privileges or be the owner of the object or other resource to do the requested operation.

[ESRCH] No item could be found that matches the specified value.


Related Information



API introduced: V3R6
Top | UNIX-Type APIs | APIs by category