I am trying to use the pcre library<
http://pcre.org/> (from AIX) on IBM iseries. It should be possible using PASE<
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzalf/rzalfintro.htm>.
I installed the pcre library with the rpm provided by yips<
http://wsip-174-79-32-155.ph.ph.cox.net/wiki/index.php/PASE/OpenSourceBinaries>. I tried to use it in c ile source, but i couldn't achieve it.
Exemples : yips<
http://wsip-174-79-32-155.ph.ph.cox.net/wiki/index.php/PASE/RPG-2-PASE>, ibm<
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/rzalf/rzalfileprogcallsexamp.htm>, ibm redbook<
http://www.redbooks.ibm.com/abstracts/sg245970.html>
I can't find the way to do it. Here is what i have done so far.
#include <stdio.h>
#include <qp2shell2.h>
#include <qp2user.h>
#define JOB_CCSID 0
int main(int argc, char *argv[])
{
int rc;
QP2_ptr64_t id;
void *getpid_pase;
const QP2_arg_type_t signature[] = { QP2_ARG_END };
QP2_word_t result;
/*
* Call QP2SHELL2 to run the OS/400 PASE program
* /usr/lib/start32, which starts OS/400 PASE in
* 32-bit mode (and leaves it active on return)
*/
QP2SHELL2("/usr/lib/start32");
/*
* Qp2dlopen opens the global name space (rather than
* loading a new shared executable) when the first
* argument is a null pointer. Qp2dlsym locates the
* function descriptor for the OS/400 PASE getpid
* subroutine (exported by shared library libc.a)
*/
id = Qp2dlopen("/usr/lib/libpcre.a", QP2_RTLD_NOW, JOB_CCSID);
getpid_pase = Qp2dlsym(id, "pcrecpp::RE", JOB_CCSID, NULL);
//id = Qp2dlopen(NULL, QP2_RTLD_NOW, JOB_CCSID);
//getpid_pase = Qp2dlsym(id, "getpid", JOB_CCSID, NULL);
/*
* Call Qp2CallPase to run the OS/400 PASE getpid
* function, and print the result. Use Qp2errnop
* to find and print the OS/400 PASE errno if the
* function result was -1
*/
rc = Qp2CallPase(getpid_pase,
NULL, // no argument list
signature,
QP2_RESULT_WORD,
&result);
printf("OS/400 PASE getpid() = %i\n", result);
if (result == -1)
printf("OS/400 errno = %i\n", *Qp2errnop());
/*
* Close the Qp2dlopen instance, and then call
* Qp2EndPase to end OS/400 PASE in this job
*/
Qp2dlclose(id);
Qp2EndPase();
return 0;
}
-
Charles Martin
As an Amazon Associate we earn from qualifying purchases.