ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/qgtjid.htm

236 lines
6.7 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>Qp0wGetJobID()--Get Qualified Job Name and ID for Process ID</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- UNIX11 SCRIPT A converted by B2H R4.1 (346) (CMS) by V2DCIJB at -->
<!-- RCHVMW2 on 1 Jun 1999 at 16:14:12 -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- Edited by Kersten Feb 02 -->
<!-- This file has undergone error condition cleanup JULY 2002 by JET -->
<!--End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>Qp0wGetJobID()--Get Qualified Job Name and ID for Process ID</h2>
<div class="box" style="width: 80%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;qp0wpid.h&gt;
int Qp0wGetJobID(pid_t <em>pid</em>, QP0W_Job_ID_T <em>*jobinfo</em>);
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QP0WPID<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>Qp0wGetJobID()</strong> function returns the qualified job name
and internal job identifier for the process whose process ID matches <em>
pid</em>.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong><em>pid</em></strong></dt>
<dd>(Input) The process ID of the process whose job number is to be returned.
When <em>pid</em> has a value of zero, the process ID of the calling process is
used.<br>
<br>
</dd>
<dt><strong><em>*jobinfo</em></strong></dt>
<dd>(Output) A pointer to the <samp>qp0w_job_id_t</samp> structure. This
structure contains the qualified i5/OS job name and internal job identifier
for the process identified by <em>pid</em>.</dd>
</dl>
<p>The structure <samp>qp0w_job_id_t</samp> is defined in the <strong>
&lt;qp0wpid.h&gt;</strong> header file as follows:</p>
<pre>
typedef struct QP0W_Job_ID_T {
char jobname[10];
char username[10];
char jobnumber[6];
char jobid[16];
} QP0W_Job_ID_T;
</pre>
<p>The members of the <samp>qp0w_job_id_t</samp> structure are as follows:</p>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td align="left" valign="top"><em>char jobname[10]</em></td>
<td align="left" valign="top">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.<br>
</td>
</tr>
<tr>
<td align="left" valign="top" nowrap><em>char username[10]</em></td>
<td align="left" valign="top">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.<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>char jobnumber[6]</em></td>
<td align="left" valign="top">The system-generated job number.<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>char jobid[16]</em></td>
<td align="left" valign="top">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.<br>
</td>
</tr>
</table>
<br>
<h3>Authorities</h3>
<p>The process calling <strong>Qp0wGetJobID()</strong> 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:</p>
<ul>
<li>The process is calling <strong>Qp0wGetJobID()</strong> for its own
process.<br>
<br>
</li>
<li>The process has *JOBCTL special authority defined in the process user
profile or in a current adopted user profile.<br>
<br>
</li>
<li>The process is the parent of the process (the process being examined has a
parent process ID equal to the process ID of the process calling <strong>
Qp0wGetJobID()</strong>).<br>
<br>
</li>
<li>The real or effective user ID of the process matches the real or effective
user ID of the process calling <strong>Qp0wGetJobID()</strong>.</li>
</ul>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="10 90" -->
<tr>
<td align="left" valign="top"><em>0</em></td>
<td align="left" valign="top"><strong>Qp0wGetJobID()</strong> was
successful.</td>
</tr>
<tr>
<td align="left" valign="top"><em>value</em></td>
<td align="left" valign="top"><strong>Qp0wGetJobID()</strong> was not
successful. The value returned indicates one of the following errors. Under
some conditions, <em>value</em> could indicate an error other than those listed
here.<br>
<table cellpadding="5">
<tr>
<td align="left" valign="top"><em>[EINVAL]</em></td>
<td align="left" valign="top">The value specified for the argument is not
correct.
<p>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.</p>
<p>An argument value is not valid, out of range, or NULL.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EPERM]</em></td>
<td align="left" valign="top">Operation not permitted.
<p>You must have appropriate privileges or be the owner of the object or other
resource to do the requested operation.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ESRCH]</em></td>
<td align="left" valign="top">No item could be found that matches the specified
value.<br>
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<h3>Related Information</h3>
<ul>
<li>The &lt;<strong>qp0wpid.h</strong>&gt; file (see <a href="unix13.htm">
Header Files for UNIX-Type Functions</a>)<br>
<br>
</li>
<li><a href="getpid.htm">getpid()</a>--Get Process ID<br>
<br>
</li>
<li><a href="qgtpid.htm">Qp0wGetPid()</a>--Get Process ID</li>
</ul>
<br>
<hr>
API introduced: V3R6
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>