|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
VBScript put to queue : speed bump |
« View previous topic :: View next topic » |
Author |
Message
|
shogan2003 |
Posted: Wed Jun 23, 2004 12:21 am Post subject: VBScript put to queue : speed bump |
|
|
Centurion
Joined: 03 Jul 2003 Posts: 133 Location: London
|
I am using VBScript to put a message to a queue.
The script is called by cscript.exe; it is not embedded in a web page.
The script opens a text file, reads its contents into variable msg_str and writes them to a queue.
Here's an extract.
'##### OLD WRITE STATEMENT ########################'
'msgPut.MessageData = msg_str
'
The weakness is that some values, e.g. £, are changed
So instead I coded a loop based around WriteUnsignedByte. See below.
' SOLUTION : START'
for indx = 1 to Len(msg_str)
msgPut.WriteUnsignedByte(ASC(Mid(msg_str, indx, 1)))
next
'SOLUTION : END'.
The trouble is that although the character values are preserved, the time taken to put the whole contents to file is drastically slower.
On the machine I'm using, which is a good spec, tests indicate a transfer rate of 1 Mb / 40 sec irrespective of file size, so 32Meg file takes 22 min to put to queue. With the original (flawed) put, a 100Mb file would be put in under 2 mins.
Do any of the other write methods offer speed *and* data preservation ?
I'm assuming that the loop is responsible for the deterioration in speed, so am seeking a method along the lines of
WriteUnsignedBytes ( String or array, int start, int length )
Write methods available for msgPut ( object type MQAX200.MQMessage) are given below.
- Write
- WriteBoolean
- WriteByte
- WriteDecimal2
- WriteDecimal4
- WriteDouble
- WriteDouble4
- WriteFloat
- WriteInt2
- WriteInt4
- WriteLong
- WriteNullTerminatedString
- WriteShort
- WriteString
- WriteUint2
- WriteUnsignedByte
- WriteUTF
Thanks in advance
Sean _________________ MQSI2 certified specialist
MQSeries certified specialist |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jun 23, 2004 3:04 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you want to read in a block of data, and put it into a message unchanged, then read it as a block of bytes and use Write. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JasonE |
Posted: Wed Jun 23, 2004 6:55 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
In your string example, the conversion happens because VB is unicode, and it converts it to the ccsid, so if you put the characterSet to be unicode (1200?), no conversion will occur |
|
Back to top |
|
 |
shogan2003 |
Posted: Wed Jun 23, 2004 10:25 am Post subject: |
|
|
Centurion
Joined: 03 Jul 2003 Posts: 133 Location: London
|
Thank you both very much indeed.
I've assigned CharacterSet value of 1200. Case closed. _________________ MQSI2 certified specialist
MQSeries certified specialist |
|
Back to top |
|
 |
shogan2003 |
Posted: Wed Jun 23, 2004 11:58 pm Post subject: |
|
|
Centurion
Joined: 03 Jul 2003 Posts: 133 Location: London
|
Sorry, I mean 1208. UTF-8 _________________ MQSI2 certified specialist
MQSeries certified specialist |
|
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
|
|
|
|