Author |
Message
|
gh |
Posted: Sat Aug 12, 2006 2:22 am Post subject: Read file contents from queue |
|
|
Novice
Joined: 12 Aug 2006 Posts: 14 Location: eq
|
I've a Queue which contains a file, I want to read the contents of the file in my VB.NET program.
Can someone tell me how can I use the mqftrcvc command in my vb.net code?
Is there any .NET class available to perform File Transfer ?
Thanks  |
|
Back to top |
|
 |
leehairy |
Posted: Sun Aug 13, 2006 6:11 am Post subject: |
|
|
Novice
Joined: 04 Aug 2006 Posts: 13
|
mqftrcvc is a command line tool.
There is no reason to try and invoke 'mqftrcvc' from within a VB program. This would be overkill
If your queue contains the contents of a file. You have the file already available. Call one of the MQMessage methods such as ReadString or ReadBytes etc and you will have a copy of the file in memory |
|
Back to top |
|
 |
gh |
Posted: Sun Aug 13, 2006 10:46 pm Post subject: Read file contents from queue |
|
|
Novice
Joined: 12 Aug 2006 Posts: 14 Location: eq
|
Thanks for reply.
I've used ReadString method but that's given me some header information also with the contents of file.I don't want any extra information I just want the exact contents of file.
Format of message on queue is 'MQHRF2'
My file contains information like this:
Msg1
Msg2
Msg3
Msg4
But Readstring fetching it like this:
RFH @ " ╡ ╕ <MQFT><MQFT_REJECT_UNSUPPORTED><FORMAT>BINARY</FORMAT><LAST>Y</LAST><FILENAME>first.txt</FILENAME><OFFSET>0</OFFSET><ORIGINAL_LENGTH>22</ORIGINAL_LENGTH></MQFT_REJECT_UNSUPPORTED><MQFT_ACCEPT_UNSUPPORTED><DIR>\TestMQ</DIR><ORIG_QMGR></ORIG_QMGR></MQFT_ACCEPT_UNSUPPORTED></MQFT> Msg1
Msg2
Msg3
Msg4 _________________ rewrw |
|
Back to top |
|
 |
zpat |
Posted: Sun Aug 13, 2006 11:23 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Make sure your messages have MQMD.Format = "MQSTR". |
|
Back to top |
|
 |
gh |
Posted: Mon Aug 14, 2006 12:12 am Post subject: Read file contents from queue |
|
|
Novice
Joined: 12 Aug 2006 Posts: 14 Location: eq
|
Message format would not be "MQSTR" when a file resides on Queue
Our client want us to read contents of file which is available on Queue.They will put the whole File on Queue then we have to read the contents of that file in our program. _________________ rewrw |
|
Back to top |
|
 |
Vitor |
Posted: Mon Aug 14, 2006 12:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
If that's the format, they're adding it with an RFH2 header, which it the extra information you're getting. You'll need to write a snippet of code to deal with it.
Do a search through this forum - it's been discussed a few times. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Aug 14, 2006 1:46 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Hey, gh.
A "file" is just a stream of bytes on disk.
So when you put a "file" on a "queue", what you have is a stream of bytes on a queue.
A stream of bytes on a queue is called a "message". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
gh |
Posted: Mon Aug 14, 2006 2:04 am Post subject: Read file contents from queue |
|
|
Novice
Joined: 12 Aug 2006 Posts: 14 Location: eq
|
Thanks Vitor and jefflowrey
I just want to confirm that there is no way to get the message body without this header information.
I can remove this extra info in my program but I'm not sure whether this information will be consistent or it could be different.. _________________ rewrw |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Aug 14, 2006 2:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The MQRFH2 is in the body of the message. You can't get the body of the message without getting the MQRFH2.
The MQRFH2 is supposed to be in the body of the message.
I think you need to process this header, rather than throw it away. I suspect you need to do more with it than just extract the file name - like decide if the file is supported or not and then decide if you need to reject if unsupported and etc. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|