[tcljava-user] JACL - convert Tcl string to java int.
Brought to you by:
mdejong
From: <PFi...@hb...> - 2005-08-17 03:02:28
|
Running Tclblend 1.3.2 on Windows XP. Writing JACL script to send/retrieve messages to IBM MQSeries on Mainframe. Java code looks like; qMgr = new MQQueueManager(qManager); // Set up the options on the queue we wish to open... // Note. All WebSphere MQ Options are prefixed with MQC in Java. //##### openOptions is defined as integer ####. int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ; // Now specify the queue that we wish to open, // and the open options... MQQueue system_default_local_queue = qMgr.accessQueue("SYSTEM.DEFAULT.LOCAL.QUEUE", openOptions); JACL code looks like. set MQQueueManager [ java::new com.ibm.mq.MQQueueManager XXXX ] set queueName XXX.XX.XXXX.0059.XXXX append openOptions MQC.MQOO_OUTPUT append openOptions " | " append openOptions MQC.MQOO_INPUT_AS_Q_DEF set accessQueue [ $MQQueueManager accessQueue $queueName $openOptions ] ##################################333 Calling the accessQueue method generates the error: ---------------------- expected integer but got "MQC.MQOO_OUTPUT | MQC.MQOO_INPUT_AS_Q_DEF" while executing "$MQQueueManager accessQueue $queueName $openOptions " ---------------------- $openOptions needs to be defined as an integer but it's not being converted in the method call. Doco says: "Tcl values are also be converted to Java objects and primitive Java types when they are given as arguments to Java commands. The default conversion for all Tcl values is a java.lang.String object. To override this default a full signature must be provided for Java method invocations". java::info method for MQQueueManager returns "{accessQueue java.lang.String int}". I tried "set accessQueue [ $MQQueueManager { accessQueue java.lang.String int } $queueName $openOptions ] " and got: expected integer but got "MQC.MQOO_OUTPUT | MQC.MQOO_INPUT_AS_Q_DEF" while executing "$MQQueueManager { accessQueue java.lang.String int } $queueName $openOptions " How do I specify the full signature for method invocations do enable this conversion? Regards. Patrick. =================================================== HBF Health Funds Inc. a registered organisation under the National Health Act HBF Insurance Pty Ltd ACN 009 268 277 This email is a confidential communication intended only for the named Addressee(s). If you are not that person any disclosure, copying, distribution or use of this email or the information in it is prohibited. Please notify us immediately by telephone, (+61) 08 9265 6111 or return email and delete this email. The views in this email may be personal to the author and not those of HBF. |