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

151 lines
3.8 KiB
HTML

<!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>Qp0zSystem()--Run a CL Command</title>
<!-- 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. -->
<!-- Begin Header Records ========================================== -->
<!-- UNIX11 SCRIPT A converted by B2H R4.1 (346) (CMS) by V2DCIJB at -->
<!-- RCHVMW2 on 1 Jun 1999 at 16:14:12 -->
<!--End Header Records --><!-- Edited by Kersten Feb 02 -->
<!-- This file has undergone html cleanup July 2002 by JET -->
<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>Qp0zSystem()--Run a CL Command</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;qp0z1170.h&gt;
int Qp0zSystem( const char <em>*CLcommand</em> );
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QP0ZTRML<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>Qp0zSystem()</strong> function spawns a new process, passes <em>
CLcommand</em> to the CL command processor in the new process, and waits for
the command to complete. The command runs in a batch job so it does not have
access to a terminal.</p>
<p>This function is similar to the <strong>system()</strong> function provided
by ILE C, but allows a program to safely run a CL command from a multithreaded
process. Note that if <em>CLcommand</em> fails, the global variable _EXCP_MSGID
is not set with the exception message id.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong><em>*CLcommand</em></strong></dt>
<dd>(Input) Pointer to null-terminated CL command string.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>The user calling <strong>Qp0zSystem()</strong> must have *USE authority to
the specified CL command.</p>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="5 95" -->
<tr>
<td align="left" valign="top"><em>0</em></td>
<td align="left" valign="top">The specified CL command was successful.</td>
</tr>
<tr>
<td align="left" valign="top"><em>1</em></td>
<td align="left" valign="top">The specified CL command was not successful.</td>
</tr>
<tr>
<td align="left" valign="top"><em>-1</em></td>
<td align="left" valign="top"><strong>Qp0zSystem()</strong> was not
successful.</td>
</tr>
</table>
<br>
<br>
<h3>Related Information</h3>
<ul>
<li>The &lt;<strong>qp0z1170.h</strong>&gt; file (see <a href="unix13.htm">
Header Files for UNIX-Type Functions</a>)</li>
</ul>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>The following example shows how to use the <strong>Qp0zSystem()</strong>
function to create a library.</p>
<pre>
#include &lt;stdio.h&gt;
#include &lt;qp0z1170.h&gt;
int main(int argc, char *argv[])
{
if (Qp0zSystem("CRTLIB LIB(XYZ)") != 0)
printf("Error creating library XYZ.\n");
else
printf("Library XYZ created.\n");
return(0);
}
</pre>
<br>
<h3>Output:</h3>
<pre>
Library XYZ created
</pre>
<br>
<hr>
API introduced: V4R2
<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>