ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzalf_5.4.0.1/rzalfileprogcallsexamp.htm

129 lines
6.1 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 an i5/OS PASE program from within i5/OS programs" />
<meta name="abstract" content="The examples illustrated in this topic show an ILE program that calls an i5/OS PASE program, and the i5/OS PASE program that is called by the ILE program." />
<meta name="description" content="The examples illustrated in this topic show an ILE program that calls an i5/OS PASE program, and the i5/OS PASE program that is called by the ILE program." />
<meta name="DC.Relation" scheme="URI" content="rzalfileprogcalls.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="rzalfileprogcallsexamp" />
<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 an i5/OS PASE
program from within i5/OS programs</title>
</head>
<body id="rzalfileprogcallsexamp"><a name="rzalfileprogcallsexamp"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Run an <span class="keyword">i5/OS</span> PASE
program from within <span class="keyword">i5/OS</span> programs</h1>
<div><p>The examples illustrated in this topic show an ILE program that
calls an <span class="keyword">i5/OS™</span> PASE program,
and the <span class="keyword">i5/OS</span> PASE program
that is called by the ILE 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"><h4 class="sectiontitle">Example 1: An ILE program that calls an <span class="keyword">i5/OS</span> PASE program</h4><p>The
following ILE program calls an <span class="keyword">i5/OS</span> PASE
program. Following this example is an example of the <span class="keyword">i5/OS</span> PASE
code that this program calls.</p>
<pre>#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;
/* include file for QP2RunPase(). */
#include &lt;qp2user.h&gt;
/******************************************
Sample:
A simple ILE C program to invoke an i5/OS
PASE program using QP2RunPase() and
passing one string parameter.
Example compilation:
CRTCMOD MODULE(MYLIB/SAMPLEILE) SRCFILE(MYLIB/QCSRC)
CRTPGM PGM(MYLIB/SAMPLEILE)
******************************************/
void main(int argc, char*argv[])
{
/* Path name of PASE program */
char *PasePath = "/home/samplePASE";
/* Return code from QP2RunPase() */
int rc;
/* The parameter to be passed to the
i5/OS PASE program */
char *PASE_parm = "My Parm";
/* Argument list for i5/OS PASE program,
which is a pointer to a list of pointers */
char **arg_list;
/* allocate the argument list */
arg_list =(char**)malloc(3 * sizeof(*arg_list));
/* set program name as first element. This is a UNIX convention */
arg_list[0] = PasePath;
/* set parameter as first element */
arg_list[1] = PASE_parm;
/* last element of argument list must always be null */
arg_list[2] = 0;
/* Call i5/OS PASE program. */
rc = Qp2RunPase(PasePath, /* Path name */
NULL, /* Symbol for calling to ILE, not used in this sample */
NULL, /* Symbol data for ILE call, not used here */
0, /* Symbol data length for ILE call, not used here */
819, /* ASCII CCSID for i5/OS PASE */
arg_list, /* Arguments for i5/OS PASE program */
NULL); /* Environment variable list, not used in this sample */
}</pre>
</div>
<div class="example"><h4 class="sectiontitle">Example 2: The <span class="keyword">i5/OS</span> PASE
program that is called in the ILE program</h4><p>The following <span class="keyword">i5/OS</span> PASE program is called by
the above ILE program.</p>
<pre>#include &lt;stdio.h&gt;
/******************************************
Sample:
A simple i5/OS PASE Program called from
ILE using QP2RunPase() and accepting
one string parameter.
The ILE sample program expects this to be
located at /home/samplePASE. Compile on
AIX, then ftp to i5/OS.
To ftp use the commands:
&gt; binary
&gt; site namefmt 1
&gt; put samplePASE /home/samplePASE
******************************************/
int main(int argc, char *argv[])
{
/* Print out a greeting and the parameter passed in. Note argv[0] is the program
name, so, argv[1] is the parameter */
printf("Hello from i5/OS PASE program %s. Parameter value is \"%s\".\n", argv[0], argv[1]);
return 0;
}</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzalfileprogcalls.htm" title="You can follow the steps in this topic to call the Qp2CallPase() and Qp2CallPase2() ILE procedures from within other ILE procedures to start and run an i5/OS PASE program. An example follows.">Run an i5/OS PASE program from within i5/OS programs</a></div>
</div>
</div>
</body>
</html>