System i: Programming i5/OS PASE - IBM
System i: Programming i5/OS PASE - IBM
System i: Programming i5/OS PASE - IBM
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
located at /home/sample<strong>PASE</strong>. Compile on<br />
AIX, then ftp to <strong>i5</strong>/<strong>OS</strong>.<br />
To ftp use the commands:<br />
> binary<br />
> site namefmt 1<br />
> put sample<strong>PASE</strong> /home/sample<strong>PASE</strong><br />
******************************************/<br />
int main(int argc, char *argv[])<br />
{<br />
/* Print out a greeting and the parameter passed in. Note argv[0] is the program<br />
name, so, argv[1] is the parameter */<br />
printf("Hello from <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program %s. Parameter value is \"%s\".\n", argv[0], argv[1]);<br />
}<br />
return 0;<br />
Calling an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> procedure from within <strong>i5</strong>/<strong>OS</strong> programs<br />
You can call the Qp2CallPase() and Qp2CallPase2() ILE procedures from within other ILE procedures to<br />
run an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program in a job where the <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> environment is already running.<br />
The Qp2RunPase() API initially starts and runs an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program in a job. It returns an error if<br />
<strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> is already active in that job.<br />
To call <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> procedures in a job that is already running an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program, you use the<br />
Qp2CallPase() and Qp2CallPase2() APIs.<br />
Related information<br />
Qp2CallPase()--Call an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> Procedure<br />
Example 1: Calling an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> procedure from within <strong>i5</strong>/<strong>OS</strong> programs:<br />
This example shows an ILE program calling an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> procedure.<br />
Note: By using the code examples, you agree to the terms of the “Code license and disclaimer<br />
information” on page 70.<br />
#include <br />
#include <br />
#include <br />
#define JOB_CCSID 0<br />
int main(int argc, char *argv[])<br />
{<br />
QP2_ptr64_t id;<br />
void *getpid_pase;<br />
const QP2_arg_type_t signature[] = { QP2_ARG_END };<br />
QP2_word_t result;<br />
/*<br />
* Call QP2SHELL2 to run the <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program<br />
* /usr/lib/start32, which starts <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> in<br />
* 32-bit mode (and leaves it active on return)<br />
*/<br />
QP2SHELL2("/usr/lib/start32");<br />
/*<br />
* Qp2dlopen opens the global name space (rather than<br />
* loading a new shared executable) when the first<br />
* argument is a null pointer. Qp2dlsym locates the<br />
* function descriptor for the <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> getpid<br />
* subroutine (exported by shared library libc.a)<br />
*/<br />
id = Qp2dlopen(NULL, QP2_RTLD_NOW, JOB_CCSID);<br />
getpid_pase = Qp2dlsym(id, "getpid", JOB_CCSID, NULL);<br />
<strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> 23