83 lines
3.9 KiB
HTML
83 lines
3.9 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="reference" />
|
||
|
<meta name="DC.Title" content="Example: Run i5/OS commands from i5/OS PASE" />
|
||
|
<meta name="abstract" content="You can see the example provided in this topic to learn how to run CL commands in an i5/OS PASE program." />
|
||
|
<meta name="description" content="You can see the example provided in this topic to learn how to run CL commands in an i5/OS PASE program." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzalfcallcl.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2000, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2000, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rzalfcallclexamp" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- 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. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Example: Run i5/OS commands
|
||
|
from i5/OS PASE</title>
|
||
|
</head>
|
||
|
<body id="rzalfcallclexamp"><a name="rzalfcallclexamp"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example: Run <span class="keyword">i5/OS</span> commands
|
||
|
from <span class="keyword">i5/OS</span> PASE</h1>
|
||
|
<div><p>You can see the example provided in this topic to learn how to
|
||
|
run CL commands in an <span class="keyword">i5/OS™</span> PASE
|
||
|
program.</p>
|
||
|
<div class="section"><div class="note"><span class="notetitle">Note:</span> By using the code examples, you agree to
|
||
|
the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
|
||
|
</div>
|
||
|
<div class="example">The following example shows how you call commands in an <span class="keyword">i5/OS</span> PASE program:<pre>/* sampleCL.c
|
||
|
example to demonstrate use of sampleCL to run a CL command
|
||
|
Compile with a command similar to the following.
|
||
|
xlc -o sampleCL -I /whatever/pase -bI:/whatever/pase/as400_libc.exp sampleCL.c
|
||
|
Example program using QP2SHELL() follows.
|
||
|
call qp2shell ('sampleCL' 'wrkactjob') */
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <errno.h>
|
||
|
#include <as400_types.h> /* PASE header */
|
||
|
#include <as400_protos.h> /* PASE header */
|
||
|
|
||
|
void main(int argc, char* argv[])
|
||
|
{
|
||
|
int rc;
|
||
|
|
||
|
if (argc!=2)
|
||
|
{
|
||
|
printf("usage: %s \"CL command\"\n", argv[0]);
|
||
|
exit(1);
|
||
|
}
|
||
|
printf("running CL command: \"%s\"\n", argv[1]);
|
||
|
|
||
|
/* process the CL command */
|
||
|
rc = systemCL(argv[1], /* use first parameter for CL command */
|
||
|
SYSTEMCL_MSG_STDOUT
|
||
|
SYSTEMCL_MSG_STDERR ); /* collect messages */
|
||
|
|
||
|
printf("systemCL returned %d. \n", rc);
|
||
|
if (rc != 0)
|
||
|
{
|
||
|
perror("systemCL");
|
||
|
exit(rc);
|
||
|
}
|
||
|
}</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzalfcallcl.htm" title="You can extend the capabilities of your i5/OS PASE program by running control language (CL) commands that use i5/OS functions.">Run i5/OS commands from i5/OS PASE</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|