ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » PCF - MQCMD_INQUIRE_Q_STATUS issue

Post new topic  Reply to topic Goto page Previous  1, 2, 3, 4  Next
 PCF - MQCMD_INQUIRE_Q_STATUS issue « View previous topic :: View next topic » 
Author Message
IanB
PostPosted: Fri Oct 13, 2006 8:35 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

The final poster on that thread is correct. You require AMQZAIX.dll which only resides on the server in bin. I now have an MQBag class available.
Back to top
View user's profile Send private message
IanB
PostPosted: Sat Oct 14, 2006 3:09 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

Stupid API. Taken straight from the documentation:

Dim mqbag As MQBag
Set mqbag = New MQBag
References are fine, object is browsable
Doesn't work, ActiveX component can't create object.

Tried to use the declare method, again taken from the examples provided, ie

Declare Sub MQCONN Lib "MQIC32.DLL" Alias "MQCONNstd@16" _
(ByVal QMgrName As String, _
Hconn As Long, _
CompCode As Long, _
Reason As Long)

MQCONN strQMName, Hcon, CompCode, Reason

That refuses to connect.

EDIT:
Got MQConn to connect, it requires an env variable MQSERVER=QMname/TCP/Server(port)
the error was 2058, then 2059 when I misspelt the queue manager name for google's benefit.

EDIT2:
Playing with the VB sample that supposedly allows you to start and stop queues, it retrieves q names using MQCMD_INQUIRE_CHANNEL_NAMES but it returns only four channels.

MQCMD_INQUIRE_Q_STATUS under dotnet returns 30 (haven't got that running in VB yet and probably won't bother at this rate) while MQCMD_INQUIRE_CHANNEL_NAMES under dotnet returns 13.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Sat Oct 14, 2006 5:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You only get back status for channels that are active.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
IanB
PostPosted: Sat Oct 14, 2006 5:59 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

Looking back at the Com option, I cannot register the amqzaix.dll, regsvr32 errors, however it does seem to have succeeded enough to appear in references. This could be why I can't create the MQBag objects.

Edit:
extracted the version from a CSD and that can't be registered either. Also won't allow creation of bags.


Last edited by IanB on Sat Oct 14, 2006 6:07 am; edited 1 time in total
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Sat Oct 14, 2006 6:01 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

If the DLL only ships with a server install, it's entirely possible that it depends on several other dlls in the server install and is actually compiled against the server library.

Both of these mean you can't just move the dll to a client machine and use it.


_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
IanB
PostPosted: Sun Oct 15, 2006 11:23 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

jefflowrey wrote:
If the DLL only ships with a server install, it's entirely possible that it depends on several other dlls in the server install and is actually compiled against the server library.

Both of these mean you can't just move the dll to a client machine and use it.



You sir are a star
I did a quick oleview and the DLL seems to contain the object and the interface, but it was only a quick scan, I'll check tomorrow whether I've missed something, I usually do .
Back to top
View user's profile Send private message
IanB
PostPosted: Mon Oct 16, 2006 2:03 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

Ok, I've copied every dll from the server to my client and lo I can now create MQBag objects.

EDIT: however Set manager = session.AccessQueueManager("Myqueuemanagername") fails to connect claiming my queue manager name is wrong. It isn't. The only reference to this error I can find is a link to a mythical service pack that might correct the issue under MTS.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Oct 16, 2006 2:58 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20763
Location: LI,NY

Well if you are trying to do a client connection where a server connection is required this could well be the type of response you get.

You could alternatively try support pack MS0B (but that is in java).

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Mon Oct 16, 2006 3:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Also, let's be a little more clear here.

It's a really bad idea to try and just copy all the dlls from a server install to a client install. Your best bet to get this to run locally is to install the server feature.

And as FJ says, if this dll is compiled against the server library, you won't be able to establish a client connection with it.


_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
IanB
PostPosted: Mon Oct 16, 2006 3:12 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

jefflowrey wrote:
Also, let's be a little more clear here.

It's a really bad idea to try and just copy all the dlls from a server install to a client install. Your best bet to get this to run locally is to install the server feature.

And as FJ says, if this dll is compiled against the server library, you won't be able to establish a client connection with it.



Cheers, I got the queuemanager the issue is that I hadn't set an environment variable

GMQ_MQ_LIB=drive:\path\of\mqic32library\mqic32.dll

With that set up I now have a connection. One tiny step forward

I'd love to play with the Java api, but it would be the only in house Java app so it's a nono unfortunately.
Back to top
View user's profile Send private message
IanB
PostPosted: Mon Oct 16, 2006 4:38 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

Ok, here's how far I've got so far. It's a bit of a hack of some other code I found, with bits pulled out of the C example.

Dim mqadminbag As MQBag
Dim mqreplybag As MQBag
Dim optsbag As MQBag
Dim ReplyBag As MQBag
Dim manager As MQAX200.MQQueueManager
Dim session As MQAX200.MQSession
Dim ReplyQueue As MQAX200.MQQueue
Dim RequestQueue As MQAX200.MQQueue

Set session = New MQSession

Set manager = session.AccessQueueManager("MYqueuemanager")

Set ReplyBag = New MQBag
Set mqadminbag = New MQBag
Set mqreplybag = New MQBag
Set optsbag = New MQBag
Set RequestQueue = manager.AccessQueue("SYSTEM.ADMIN.COMMAND.QUEUE", MQOO_OUTPUT)
Set ReplyQueue = manager.AccessQueue("SYSTEM.DEFAULT.LOCAL.QUEUE", MQOO_INPUT_EXCLUSIVE)

mqadminbag.Options = 1
ReplyBag.Options = 16

mqreplybag.Options = 1
mqreplybag.AddInquiry (MQCMD_INQUIRE_Q_STATUS)

Call mqadminbag.Add("*", MQCA_Q_NAME)
Call mqadminbag.Add(MQIACF_ALL, MQIACF_Q_STATUS_ATTRS)

Set ReplyBag = mqadminbag.Execute(manager, MQCMD_INQUIRE_Q_STATUS, optsbag, RequestQueue, ReplyQueue)


When I hit Execute it gives me a connection error MQRC_CONN_ERROR
I have run one of the VBAX samples and that appears to work.

Now, when I copied in the server files, I only added those files that did not exist, so I have a full client install + the files from the server that weren't there.
Looking in Process explorer, I can see my project is using lots and lots of websphere DLL's including some mentioning MTS (which I assume is because I have the MQAX200 and MQAX100 COM libraries where as the sample only has MQAX200 (because it doesn't need the MQBag class).
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Oct 16, 2006 4:40 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Again, it's likely that you need to run the installer again and install the server component. Copying files is not going to do everything you need it to do.

It's also likely that you won't be able to use a client connection at all.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
IanB
PostPosted: Mon Oct 16, 2006 5:06 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

jefflowrey wrote:
Again, it's likely that you need to run the installer again and install the server component. Copying files is not going to do everything you need it to do.

It's also likely that you won't be able to use a client connection at all.


Oh I see, I didn't get the point of actually reinstalling and adding the server files. But if I do you say I won't be able to make client connections? I might go back to option 82 where I generate the PCF message by hand. I think I'm starting to get my head around it now.
Cheers
Ian
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Oct 16, 2006 5:42 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The DLL that has the MQBag class in it is only shipped with the full server install.

It is also very likely compiled to only use the server libraries - mqm.dll, basically. If that is the case, you will not be able to use a client connection with it - as it's not compiled against mqic32.dll, and changing what .NET links to won't help.

If you need a client connection for this tool, it does seem that option 82 is your only viable option.

You can try opening a PMR against IBM.WMQ.PCF, but I doubt you will have much luck.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
IanB
PostPosted: Mon Oct 16, 2006 6:09 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

Cheers Jeff. Well I went down option 82 and have the following: basically I have two questions.
How do I correctly figure out the length of the struct, especially as the doc's use lengths that aren't defined anywhere (MQ_LOG_EXTENT_NAME_LENGTH doesn't exist in any of the libraries)
And I'm expecting a variable number of Queues to be returned so how does that work?. The code currently runs but the Get fails with code 2019 (actually the put is failing right now,for an unrelated reason) Apologies for the messyness of the code.
Cheers

Option Explicit

Private gHcon As Long 'handle to queue manager
Private gHobj As Long 'handle to system admin command queue
Private gReplyHobj As Long 'handle to reply queue
Private QMgrName As String 'name of queue manager

Private Type PCFInquireQueueStatus
Header As MQCFH
QueueName As MQCFST
QueueName_String As String * MQ_Q_NAME_LENGTH
End Type

Private Type PCFInquireQueueStatusResp
Header As MQCFH
CurrentDepth As MQCFIN
LastGetDate As MQCFST
LastGetDate_string As String * MQ_DATE_LENGTH
LastGetTime As MQCFST
LastGetTime_String As String * MQ_TIME_LENGTH
LastPutDate As MQCFST
LastPutDate_string As String * MQ_DATE_LENGTH
LastPutTime As MQCFST
LastPutTime_String As String * MQ_TIME_LENGTH
MediaRecoveryLogExtent As MQCFST
MediaRecoveryLogExtent_string As String '* MQ_LOG_EXTENT_NAME_LENGTH
OldestMsgAge As MQCFIN
OnQTime As MQCFIL
OpenInputCount As MQCFIN
OpenOutputCount As MQCFIN
QName As MQCFST
QName_string As String * MQ_Q_NAME_LENGTH
QSGDisposition As MQCFIN
QueueMonitoring As MQCFIN
StatusType As MQCFST
UncommittedMsgs As MQCFIN
End Type

Public Function InquireQueueStatus() As String()


Dim CompCode As Long
Dim Reason As Long
Dim od As MQOD
Dim PCF As PCFInquireQueueStatus
Dim md As MQMD ' Message descriptor
Dim pmo As MQPMO ' Put message options

' Ensure that we are not already connected
If gHcon = 0 Then
End If
' Setup constants
MQ_SETDEFAULTS
QMgrName = "MyQManager"
' Connect to the Queue Manager specified in the text field
MQCONN QMgrName, gHcon, CompCode, Reason

' If the connect was successful..
If gHcon = 0 Then
Exit Function
End If

' Check if PCF Command Server Is Running
Do
MQOD_DEFAULTS od
od.ObjectQMgrName = QMgrName
od.ObjectName = "SYSTEM.ADMIN.COMMAND.QUEUE"
MQOPEN gHcon, od, MQOO_INPUT_EXCLUSIVE, gHobj, CompCode, Reason

If CompCode = MQCC_OK Then
MQCLOSE gHcon, gHobj, 0, CompCode, Reason
'not running
'disconnect
Exit Do
ElseIf Reason <> MQRC_OBJECT_IN_USE Then
'error
'disconnect
Exit Do
End If
Loop Until CompCode <> MQCC_OK

If CompCode <> MQCC_OK Then
'disconnect
Else
End If


' Setup MQMD and MQPMO to their respective initial values
MQMD_DEFAULTS md
md.ReplyToQMgr = QMgrName
md.MsgType = MQMT_REQUEST
md.ReplyToQ = "SYSTEM.DEFAULT.LOCAL.QUEUE"
md.Format = MQFMT_ADMIN
MQPMO_DEFAULTS pmo
pmo.Options = MQPMO_NO_SYNCPOINT

MQCFH_DEFAULTS PCF.Header
PCF.Header.Command = MQCMD_INQUIRE_Q_STATUS
PCF.Header.MsgSeqNumber = MQCFC_LAST
PCF.Header.ParameterCount = 2

MQCFST_DEFAULTS PCF.QueueName
PCF.QueueName.StrucLength = MQCFST_STRUC_LENGTH_FIXED + MQ_CHANNEL_NAME_LENGTH
PCF.QueueName.Parameter = MQCA_Q_NAME
PCF.QueueName_String = "*"
PCF.QueueName.StringLength = Len(PCF.QueueName_String)

MQPUTAny gHcon, gHobj, md, pmo, Len(PCF), PCF, CompCode, Reason


Dim gmo As MQGMO ' Put message options
Dim buflen As Long ' Length of message to be put
Dim datalen As Long ' Actual length
Dim Buffer As PCFInquireQueueStatusResp

' Get the messages from the reply queue
MQMD_DEFAULTS md
MQGMO_DEFAULTS gmo
gmo.Options = MQGMO_WAIT
gmo.WaitInterval = 5000

' This is the length of our response structure
buflen = (MQ_DATE_LENGTH * 2) + (MQ_TIME_LENGTH * 2) + MQCFH_STRUC_LENGTH + (MQCFST_STRUC_LENGTH_FIXED * 6) + (6 * MQCFIN_STRUC_LENGTH) + MQCFIL_STRUC_LENGTH_FIXED + MQ_Q_NAME_LENGTH

' NOTE: we have to use MQGETAny instead of MQGET because we need to supply a structure and NOT a string
MQGETAny gHcon, gReplyHobj, md, gmo, buflen, Buffer, datalen, CompCode, Reason

Debug.Print "x"



End Function
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2, 3, 4  Next Page 2 of 4

MQSeries.net Forum Index » IBM MQ API Support » PCF - MQCMD_INQUIRE_Q_STATUS issue
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.