|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQTMC2 and Need Qname that I am calling |
« View previous topic :: View next topic » |
Author |
Message
|
rmohanr |
Posted: Wed Mar 26, 2003 11:53 am Post subject: MQTMC2 and Need Qname that I am calling |
|
|
Novice
Joined: 02 Jan 2002 Posts: 12
|
Hello,
I am writing an application (sample.exe) to get xml message from the ques and convert it to plain text string to be picked by another program.
We have three ques and I am using VB. Sample.exe will be triggered by each que.
How can I find out from which que my program was triggered. I am looking for some example in VB. Can some one please let me know how to do this with MQTMC2?
I don't know how to use MQTMC2 in VB. How to decalre and how to get the structure filled in with right values |
|
Back to top |
|
 |
tillywern |
Posted: Thu Mar 27, 2003 7:39 am Post subject: Its all about the command line... I think. |
|
|
 Centurion
Joined: 28 Jan 2003 Posts: 109 Location: Colorado
|
When looking at the way TMC2 is passed to a program realize that, at least in C, it is passed to the program as command line arguments….. In C you generally create a pointer of type MQTMC2… When applying this to C it creates a structure that can give you direct access to the TMC2 fields easily.
The reason for using TMC2 over TMC is that TMC2 uses an all character representation for passing data to the program it is calling…. All you need to do get the queue name is to figure out where, in the command line arguments, the queue name is.. It will be a specific number of bytes into the command line string from the end of the program name.
In C it is easy because you can allocate pointers to any position… In VB you will have to find some sort of anchor point, able to be referenced in VB, and then sub string the queue name from the string using an offset and length ( you might use the Mid command).
Hope this helps. Sorry I don't know VB… |
|
Back to top |
|
 |
tillywern |
Posted: Thu Mar 27, 2003 7:56 am Post subject: Structures... |
|
|
 Centurion
Joined: 28 Jan 2003 Posts: 109 Location: Colorado
|
Additionally.... There is a lot of other information that is important in the TMC2 structure that your program may want to know. Check the Application Programming Guide and Application Programming Reference for MQ are really good at going over the structures and what valid values are in the fields.
I have looked at the VB samples and not found one that does works with triggering… You should be able, if you can read C, to easily create a function that gets the TMC 2 values and places them in the VB equivalent of a structure. |
|
Back to top |
|
 |
rmohanr |
Posted: Thu Mar 27, 2003 1:39 pm Post subject: Re: Structures... |
|
|
Novice
Joined: 02 Jan 2002 Posts: 12
|
Thanks a lot tillywern ~
I exactly did the same thing.
when I use "command$" I got the whole TMC2 structure as a flattened string and stripped it using MID command.
In VB
COMMAND - Returns the argument portion of the command line used to launch Microsoft Visual Basic or an executable program developed with Visual Basic.
For other VB people here is my code
Public Type TriggerData
StrucId As String * 4 'Structure identifier'
Version As String * 4 'Structure version number'
QName As String * 48 'Name of triggered queue'
ProcessName As String * 48 'Name of process object'
TriggerData As String * 64 'Trigger data'
ApplType As String * 4 'Application type'
ApplId As String * 256 'Application identifier'
EnvData As String * 128 'Environment data'
UserData As String * 128 'User data'
QMgrName As String * 48 'Queue manager name'
End Type
Dim Trigger as TriggerData
If Len(Command$) = 0 Then
Err.Raise vbObjectError, _
"Main - Module1.bas", _
"Unable to get MQTMC2 Parameters."
Else
Trigger.StrucId = Trim$(Mid$(Command$, 2, 4))
Trigger.Version = Trim$(Mid$(Command$, 6, 4))
Trigger.QName = Trim$(Mid$(Command$, 10, 4 )
Trigger.ProcessName = Trim$(Mid$(Command$, 58, 4 )
Trigger.TriggerData = Trim$(Mid$(Command$, 106, 64))
Trigger.ApplType = Trim$(Mid$(Command$, 170, 4))
End If.
Hope you guys understand this.
tillywern wrote: |
Additionally.... There is a lot of other information that is important in the TMC2 structure that your program may want to know. Check the Application Programming Guide and Application Programming Reference for MQ are really good at going over the structures and what valid values are in the fields.
I have looked at the VB samples and not found one that does works with triggering… You should be able, if you can read C, to easily create a function that gets the TMC 2 values and places them in the VB equivalent of a structure. |
|
|
Back to top |
|
 |
rmohanr |
Posted: Thu Mar 27, 2003 6:49 pm Post subject: |
|
|
Novice
Joined: 02 Jan 2002 Posts: 12
|
Vennela!
Here is what we did. We are integrating PeopleSoft Integration Broker 8.41
with MQ series. PeopleSoft has JMS connectors that has the ability to post messages to a MQ queue. To achive this we installed the JMS (included in MQ 5.3) on MQ 5.2 . We also installed PUB/SUB pack becasue PeopleSoft reequires TOPICS.
A message from PeopleSoft will be a XML message. This message will be compressed and BASE64 encoded. Uncompress and base64 decode routines I wrote in VB. There are different types of (pre-defined) XML messages will be posted to different queues. So I am writing generic VB exe to trigger from the MQ queue upon recieving a message. I am using AMQX2000 and not the delivered BAS modules of MQ API.
Here is the steps I am doing.
read que I got it from TMC2 structure as I mentioned in my earlier message. Error Que and Write Que I got it from TMC2 Trigger Data Parameter ( you Can set this as one of the trigger option in MQ Explorer).
1. initialize mq session
2. open Q for read (input)
3. Open Q for Write (remote Q on OS/390)
4. Open Q for Write (Error Messages)
Start Loop
4a. Browse message
4b. Call proper XML Parser based on the message ( routine developed by me based on MQXML DOm
4c. Parser convert the XML message to flatten string
4d. Write the message to write Queue.
4e. Remove message from input.
On error write message to Error Queue.
End Loop
commit.
Let me know if you see any thing I am doing wrong |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|