Re: [tcljava-user] JACL - convert Tcl string to java int.
Brought to you by:
mdejong
From: Tom P. <tpo...@ny...> - 2005-08-17 04:40:19
|
On Wed, Aug 17, 2005 at 10:55:30AM +0800, PFi...@hb... wrote: > > //##### openOptions is defined as integer ####. > int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | > MQC.MQOO_OUTPUT ; > > ---------------------- > expected integer but got "MQC.MQOO_OUTPUT | MQC.MQOO_INPUT_AS_Q_DEF" > while executing > "$MQQueueManager accessQueue $queueName $openOptions " > ---------------------- I don't know MQ at all, but I think you need to use the java::field method to get access the field values of the MQC class, then use Tcl's expr to or them together. something like: # import the correct class, I'm guessing that it's in the com.ibm.mq package # or specify the full path in the field method: java::import com.ibm.mq.MQC set openOptions [expr [java::field MQC MQOO_OUTPUT] | [java::field MQC MQOO_INPUT_AS_Q_DEF] ] set accessQueue [ $MQQueueManager accessQueue $queueName $openOptions ] See: http://tcljava.sourceforge.net/docs/TclJava/JavaFieldCmd.html Hint: I like to import all of the constants of a class into a Tcl array. You could probably do this: array set MQC {} foreach f [java::info fields -static MQC] { set MQC($f) [java::field MQC $f] } #now access constants as put "MQC.MQOO_OUTPUT has value of $MQC(MQOO_OUTPUT)" parray MQC -- Tom Poindexter tpo...@ny... http://www.nyx.net/~tpoindex/ |