to be precise on running the RETEST program we get the output shown
below:
In TESTMQWAIT dummy=hello dummy
r3 sizeof pointer=8, sizeof reason4
MQCONNX succeeded compcode=1 reason=2002
MQOPEN compCode=1, reason=2002, hObj=-1
invalid MQOPEN handle in queue reason=2002
after call
jDiag information is below.
System : AIX xxx-2 3.5 00C96CF44C00
OS Release : 5.3.0.0
UNIX User : g371553 (uid 1028, euid 1028)
Tty name : /dev/pts/15
Time : Mon Nov 23 15:47:32 2009
Environment
===========
JBCPORTNO : Not Set
JBCRELEASEDIR : '/tafc/tafc_r09'
JBCGLOBALDIR : '/tafc/tafc_r09'
WARNING: JBCDATADIR is not set, Default '/tafc/tafc_r09/jbase_data'
WARNING: JBCDATADIR is subdirectory of JBCGLOBALDIR
HOME : '/globus/genv3/bnk/bnk.run'
JEDIFILEPATH : '/globus/genv3/bnk/bnk.run'
JEDIFILENAME_MD : 'VOC'
JEDIFILENAME_SYSTEM : '/tafc/tafc_r09/src/SYSTEM'
SYSTEM File is (DICT) : '/tafc/tafc_r09/src/SYSTEM]D'
RELEASE Information : Major 09.0 , Minor 0.0 , Patch (Change
82678)
Spooler dir (JBCSPOOLERDIR) : '/jbase/jspooler'
JBCEMULATE : 'prime'
WARNING: Cannot access Executable path '/home/dev/bin', error 2
Object path (JBCOBJECTLIST) : '/globus/genv3/bnk/bnk.run/
globuspatchlib:/globus/genv3/bnk/bnk.run/t24lib:/globus/genv3/bnk/
bnk.run/gdusgaaplib:/tafc/tafc_r09/lib:/globus/genv3/bnk/bnk.run/lib:/
globus/genv3/bnk/bnk.run/amllib:/globus/genv3/bnk/bnk.run/ibanlib'
jBASE Compiler Run-time : '/tafc/tafc_r09/config/
system.properties'
Program dir (JBCDEV_BIN) : '/globus/genv3/bnk/bnk.run/bin'
Subroutine dir (JBCDEV_LIB) : '/globus/genv3/bnk/bnk.run/lib'
Max open files : 65534
We have a c (executable) program which compiles using the command:
xlc_r test64.c -q64 -qchars=signed -I/usr/mqm/inc -L/usr/mqm/lib64 -
limqc23ia_r -limqb23ia_r -lmqic_r -otest64
We also have some c functions which use the same IBM MQ libaries which
we compile using jcompile into a shared library:
jcompile test64lib.c -q64 -qchars=signed -limqc23ia_r -limqb23ia_r -
lmqic_r -s$HOME/lib/libtest64lib.so
The executable works fine, ie connects to MQ and gets a message.
Using the shared library version (called from a simple jBC program) we
connect to MQ works okay but the open statement fails with an invalid
object handle.
Source for shared library functions:
/
***************************************************************************/
/* Compilation
Instructions */
/*
========================
*/
/* At shell prompt,
enter: */
/* jcompile test64lib.c -q64 -qchars=signed -limqc23ia_r -
limqb23ia_r -lmqic_r -s$HOME/lib/libtest64lib.so */
/
*
*/
/* NOTE: Ignore compiler warnings about
braces */
/
***************************************************************************/
/* includes */
#include "GRIM.h"
/* includes for JBase */
#include <jsystem.h>
bool _IsValidConnectionHandle(MQHCONN Hcon) {
return ((Hcon != MQHC_DEF_HCONN) && (Hcon !=
MQHC_UNUSABLE_HCONN));
}
bool _IsValidObjectHandle(MQHOBJ Hobj) {
return ((Hobj != MQHO_NONE) && (Hobj != MQHO_UNUSABLE_HOBJ));
}
bool TESTMQWAIT(DPSTRUCT *dp, VAR* results, VAR* dummy) {
printf("In TESTMQWAIT dummy=%s\n", CONV_SFB(dummy));
char* p = (char*)0;
MQLONG r = MQRC_NONE;
printf("r3 sizeof pointer=%d, sizeof reason%d\n", sizeof p, sizeof
r);
/* initialize cdo (connection descriptor) */
MQCD cdo = {MQCD_CLIENT_CONN_DEFAULT};
cdo.Version = MQCD_VERSION_2;
cdo.TransportType = MQXPT_TCP;
cdo.ChannelType = MQCHT_CLNTCONN;
strncpy(cdo.ConnectionName, "
cs7276-1.gci.csintra.net(40065)",
MQ_CONN_NAME_LENGTH);
strncpy(cdo.ChannelName, "GRIM_CHANNEL_1", MQ_CHANNEL_NAME_LENGTH);
strncpy(cdo.RemoteUserIdentifier, "", MQ_USER_ID_LENGTH);
strncpy(cdo.RemotePassword, "", MQ_PASSWORD_LENGTH);
/* initialize cno (connection options) */
MQCNO cno = {MQCNO_DEFAULT};
cno.ClientConnPtr = &cdo;
cno.Version = MQCNO_VERSION_2; // version 2 of structure
/* connect to MQ */
MQLONG reason;
MQLONG compCode;
MQHCONN hCon = MQHC_UNUSABLE_HCONN;
MQCONNX("CSGRIM", &cno, &hCon, &compCode, &reason);
if ( (compCode == MQCC_FAILED) || (!_IsValidConnectionHandle(hCon)) )
{ // error
printf("MQCONNX failed compCode=%d, reason=%d\n", compCode, reason);
} else {
printf("MQCONNX succeeded compcode=%d reason=%d
\n",compCode,reason);
/* initialize od (object descriptor) */
MQHOBJ hObjIn = MQHO_UNUSABLE_HOBJ;
MQOD od = {MQOD_DEFAULT};
strncpy(od.ObjectName, "GRIM_CS7278_GENV3_IN", MQ_Q_NAME_LENGTH);
MQOPEN(hCon, &od, MQOO_INPUT_SHARED | MQOO_FAIL_IF_QUIESCING,
&hObjIn, &compCode, &reason);
printf("MQOPEN compCode=%d, reason=%d, hObj=%d\n", compCode,
reason, hObjIn);
if (!_IsValidObjectHandle(hObjIn)) {
printf("invalid MQOPEN handle in queue reason=%d\n",
reason);
} else {
/* ----------------- wait for message ------------------
*/
/* initialize MQMD (message descriptor) */
MQMD md = {MQMD_DEFAULT};
md.Version = MQMD_VERSION_2; // version 2 of structure
md.Encoding = MQENC_NATIVE;
md.CodedCharSetId = MQCCSI_Q_MGR;
/* initialize MQPMO (message options) */
MQGMO gmo = {MQGMO_DEFAULT};
gmo.Version = MQGMO_VERSION_2; // version 2 of structure
gmo.Options = MQGMO_LOGICAL_ORDER | MQGMO_WAIT; // get in
correct order and wait for new messages
gmo.WaitInterval = 15 * 1000; // set time-out to 10
seconds
printf("waiting for new message for %d seconds\n",
gmo.WaitInterval);
char *p = malloc(32768);
MQLONG messageSize = 32768;
MQGET(hCon, hObjIn, &md, &gmo, 32768, p, &messageSize,
&compCode, &reason);
printf("done waiting for new message compCode=%d, reason=
%d, messageSize=%d\n", compCode, reason, messageSize);
free(p);
MQCLOSE(hCon, &hObjIn, MQCO_NONE, &compCode, &reason); //
close queue
}
MQDISC(&(hCon), &compCode, &reason); // disconnect
}
return true;
}
Source for c program
/
***************************************************************************/
/* Compilation
Instructions */
/*
========================
*/
/* At shell prompt,
enter: */
/* xlc_r test64.c -q64 -qchars=signed -I/usr/mqm/inc -L/usr/mqm/lib64 -
limqc23ia_r -limqb23ia_r -lmqic_r -otest64 */
/
*
*/
/* NOTE: Ignore compiler warnings about
braces */
/
***************************************************************************/
/* includes */
#include "GRIM.h"
bool _IsValidConnectionHandle(MQHCONN Hcon) {
return ((Hcon != MQHC_DEF_HCONN) && (Hcon !=
MQHC_UNUSABLE_HCONN));
}
bool _IsValidObjectHandle(MQHOBJ Hobj) {
return ((Hobj != MQHO_NONE) && (Hobj != MQHO_UNUSABLE_HOBJ));
}
MQLONG _MQOpenQueue(MQHCONN hCon, char *queueName, MQLONG options,
MQHOBJ *phObjOut)
{
/* initialize od (object descriptor) */
MQOD od = {MQOD_DEFAULT};
strncpy(od.ObjectName, queueName, MQ_Q_NAME_LENGTH);
/* open queue for input and output but not if stopping */
MQLONG reason;
MQLONG compCode;
MQOPEN(hCon, &od, options, phObjOut, &compCode, &reason);
printf("MQOPEN queue='%s', compCode=%d, reason=%d, hObj=%d,
invalid=%d\n", queueName, compCode, reason, *phObjOut,
MQHO_UNUSABLE_HOBJ);
return reason;
}
int main(int argc, char **argv) {
char* p = (char*)0;
MQLONG r = MQRC_NONE;
printf("sizeof pointer=%d, sizeof reason%d\n", sizeof p, sizeof
r);
/* initialize cdo (connection descriptor) */
MQCD cdo = {MQCD_CLIENT_CONN_DEFAULT};
cdo.Version = MQCD_VERSION_2;
cdo.TransportType = MQXPT_TCP;
cdo.ChannelType = MQCHT_CLNTCONN;
strncpy(cdo.ConnectionName, "
cs7276-1.gci.csintra.net(40065)",
MQ_CONN_NAME_LENGTH);
strncpy(cdo.ChannelName, "GRIM_CHANNEL_1", MQ_CHANNEL_NAME_LENGTH);
strncpy(cdo.RemoteUserIdentifier, "", MQ_USER_ID_LENGTH);
strncpy(cdo.RemotePassword, "", MQ_PASSWORD_LENGTH);
/* initialize cno (connection options) */
MQCNO cno = {MQCNO_DEFAULT};
cno.ClientConnPtr = &cdo;
cno.Version = MQCNO_VERSION_2; // version 2 of structure
/* connect to MQ */
MQLONG reason;
MQLONG compCode;
MQHCONN hCon = MQHC_UNUSABLE_HCONN;
MQCONNX("CSGRIM", &cno, &hCon, &compCode, &reason);
if ( (compCode == MQCC_FAILED) || (!_IsValidConnectionHandle(hCon)) )
{ // error
printf("MQCONNX failed compCode=%d, reason=%d\n", compCode, reason);
} else {
printf("MQCONNX succeeded\n");
/* Open In queue */
MQHOBJ hObjIn = MQHO_UNUSABLE_HOBJ;
reason = _MQOpenQueue(hCon, "GRIM_CS7278_GENV3_IN",
MQOO_INPUT_SHARED | MQOO_FAIL_IF_QUIESCING, &hObjIn);
if (!_IsValidObjectHandle(hObjIn)) {
printf("invalid MQOPEN handle in queue reason=%d\n",
reason);
} else {
/* ----------------- wait for message ------------------
*/
/* initialize MQMD (message descriptor) */
MQMD md = {MQMD_DEFAULT};
md.Version = MQMD_VERSION_2; // version 2 of structure
md.Encoding = MQENC_NATIVE;
md.CodedCharSetId = MQCCSI_Q_MGR;
/* initialize MQPMO (message options) */
MQGMO gmo = {MQGMO_DEFAULT};
gmo.Version = MQGMO_VERSION_2; // version 2 of structure
gmo.Options = MQGMO_LOGICAL_ORDER | MQGMO_WAIT; // get in
correct order and wait for new messages
gmo.WaitInterval = 10 * 1000; // set time-out to 10
seconds
printf("waiting for new message for %d seconds\n",
gmo.WaitInterval);
char *p = malloc(32768);
MQLONG messageSize = 32768;
MQGET(hCon, hObjIn, &md, &gmo, 32768, p, &messageSize,
&compCode, &reason);
printf("done waiting for new message compCode=%d, reason=
%d, messageSize=%d\n", compCode, reason, messageSize);
free(p);
MQCLOSE(hCon, &hObjIn, MQCO_NONE, &compCode, &reason); //
close queue
}
MQDISC(&(hCon), &compCode, &reason); // disconnect
}
exit(reason);
}
Source jBC program
PROGRAM RETEST
PRINT "before call"
CALLC TESTMQWAIT("hello world")
PRINT "after call"
END
On 16 Nov, 21:53, "Jim Idle" <
j...@temporal-wave.com> wrote:
> Please take another look at the posting guidelines. "we get an error when we call the function" does absolutely nothing to aid in solving your problem. Do you get a core dump? "Function not found"? Do you mean when you try to compile the program not when you call it? Did you set up LIBPATH? Did you check that the environment is the same as your previous version? Did you check ldd to see what libraries it should be loading at runtime?
>
> Jim
>
>
>
> > -----Original Message-----
> > From:
jb...@googlegroups.com [mailto:
jb...@googlegroups.com] On Behalf
> > Of TimR
> > Sent: Monday, November 16, 2009 2:17 AM
> > To: jBASE
> > Subject: xlc Compilation 64 Bit jBase
>
> > We have some c programs which reference an externalMQlibrary (the
> > IBMMQclient - which we have the 64 bit version of). The c component
> > we're compiling has some functions which are called using the CALLC
> > statement in BASIC.
>
> > Previously a jCompile compiled them okay. Under the R09/TAFC version
> > of jBase we get an error when the function is called. Are there some
> > other options which we should use with jCompile under 64 bit jbase?- Hide quoted text -
>
> - Show quoted text -