|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Problematic VBScript program, file read from MQ gets 0 size |
« View previous topic :: View next topic » |
Author |
Message
|
atoms |
Posted: Tue Apr 04, 2006 12:23 am Post subject: Problematic VBScript program, file read from MQ gets 0 size |
|
|
Apprentice
Joined: 10 Jun 2005 Posts: 27
|
Since I've gotten excellent help from this forum before, I thought I'd give it a try this time as well.
I have this VBScript program that has started to behave unexpected. It is supposed to get messages from a queue, write them to file and perform some additional processing such as loading the file data into a database. Well, this has been working fine for years, but now the script gets a file and writes it to disk with size 0, i.e. an empty file. During this processing the program halts at a certain point. I wonder if this problem has to do with the file size which has now grown up to 5257Kb which was the size of the last message that was processed ok. Here is a code snippet from the script:
Code: |
' ****************************************
' Start MQ connection
'
Dim QMgr
Set MQSess = CreateObject("MQAX200.MQSession")
If(DEBUGGING) Then LogEvent 4, " Session initiated"
Set QMgr = MQSess.AccessQueueManager(QueueMgrName)
If(DEBUGGING) Then LogEvent 4, " QMgr initiated"
' ****************************************
' Turn off triggering
'
Set Queue = QMgr.AccessQueue(QueueName,MQOO_SET)
Queue.TriggerControl=0
If(DEBUGGING) Then LogEvent 4, " Triggering set off"
' ****************************************
' Read messages
'
Set Queue = QMgr.AccessQueue(QueueName,MQOO_INPUT_AS_Q_DEF)
On Error Resume Next
If(DEBUGGING) Then LogEvent 4, " Queue accessed."
Set GetMsg = MQSess.AccessMessage()
Set GetOptions = MQSess.AccessGetMessageOptions()
If(DEBUGGING) Then LogEvent 4, " GetMessageOptions set."
' Need to wait for message to complete
GetOptions.Options=MQGMO_WAIT +
MQGMO_FAIL_IF_QUIESCING + MQGMO_SYNCPOINT +
MQGMO_COMPLETE_MSG
GetOptions.WaitInterval = 5000
Do While(Queue.completionCode() <> -1)
' Start transaction
QMgr.Begin
' ****************************************
' Read message
'
On Error Resume Next
Call Queue.Get(GetMsg, GetOptions)
If Queue.ReasonCode=2033 Then
If(DEBUGGING) Then LogEvent 4, " No more message found."
On Error Goto 0
Exit Do
Else
'*** Get Msg
On Error Goto 0
MsgData= GetMsg.MessageData
strHeader = Left(MsgData,30)
If Trim(Left(strHeader,10))<>"LOADFILE" Then
If(DEBUGGING) Then LogEvent 2, " Messageheader
not correct."
Call PutMsgToErrorQueue
Exit Do
End If
MsgData = Mid(MsgData,32)
If(DEBUGGING) Then LogEvent 4, " Message found:
Writing to file"
DataFileType=Trim(Mid(strHeader,9,22))
'***Save data to file
Set fso = CreateObject("Scripting.FileSystemObject")
DataFileName= DataFileType + "_" +
FormatDateTime(Now,2) + "_" +
FormatDateTime(Now,3)
DataFileName = Replace(DataFileName, ":", "_")
DataFileName = Replace(DataFileName, "-", "_")
DataFileName = Replace(DataFileName, "/", "_")
CompleteFileName =DataFilePath + DataFileName + ".txt"
Set f1 = fso.CreateTextFile(CompleteFileName, True)
f1.Write(MsgData)
f1.Close
If(DEBUGGING) Then LogEvent 4, " Writing to file complete"
QMgr.Commit
.
.
.
|
The last thing that is logged before the script hangs is the string "Message found: Writing to file". Since the script hangs at this point, the triggering is not turned on again which also leads to further problems. Can it be that something with the GetMessageOptions that is causing the trouble? Is there a size limit involved in getting messages from a queue? Thanks! |
|
Back to top |
|
 |
atoms |
Posted: Tue Apr 04, 2006 12:27 am Post subject: |
|
|
Apprentice
Joined: 10 Jun 2005 Posts: 27
|
Oops! The indentation of the code got messed up, I hope it's readable anyway. Sorry for that! |
|
Back to top |
|
 |
garethlist |
Posted: Fri Jun 18, 2010 5:51 am Post subject: |
|
|
Newbie
Joined: 17 Jun 2010 Posts: 4
|
Hi,
This is a bit of a long shot given the time passed, but I'm getting desperate!
I'm trying to do exactly what you have done in your script, using the transaction objects .Begin .Commit etc that are part of the MQAX200 lib. Trouble is, I keep getting an error 2012 whenever I make the .Begin call -
'MQRC_ENVIRONMENT_ERROR'. Having done some initial investigation I found the following:
"This reason code is MQRC_ENVIRONMENT_ERROR, and it is thrown because distributed transactions are not supported with client transport".
Did your script run on an MQ server or via a client? If a client, how did you manage this?
Any help would be greatly appreciated. My original post is here - http://www.mqseries.net/phpBB2/viewtopic.php?t=54079 |
|
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
|
|
|
|