Author |
Message
|
musiccs |
Posted: Wed Mar 31, 2004 8:57 am Post subject: Basic Perl/MQ |
|
|
Newbie
Joined: 31 Mar 2004 Posts: 5 Location: Brentwood
|
I have to create a perl script to PUT messages onto a MQ. This is for testing purposes and will be using hard-coded sample data to build up messages or a delimited flat file. I have never used or interfaced MQ before. Do you know where I can find sample code for this?
Any help would be much appreciated.
Thanks, |
|
Back to top |
|
 |
EddieA |
Posted: Wed Mar 31, 2004 9:03 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Try the "Repository" button at the top of the page.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
musiccs |
Posted: Wed Mar 31, 2004 9:26 am Post subject: |
|
|
Newbie
Joined: 31 Mar 2004 Posts: 5 Location: Brentwood
|
I tried that, but it was not helpful. Thanks Eddie! |
|
Back to top |
|
 |
bduncan |
Posted: Wed Mar 31, 2004 10:32 am Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
WHAT?
Not helpful????
What the heck is the getput.pl program then?
Quote: |
I have to create a perl script to PUT messages onto a MQ. |
Jee, I realize it's not EXACTLY what you need line for line, but with a few changes you can get it to do what you want... _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
Back to top |
|
 |
musiccs |
Posted: Wed Mar 31, 2004 10:54 am Post subject: |
|
|
Newbie
Joined: 31 Mar 2004 Posts: 5 Location: Brentwood
|
Thats why you are the Grand Master and I am the newbie. What is a no-brainer for someone of your great magnitude of MQ skills, is certainly not mine. I thought this was a place to get help for MQ. Maybe I am missing something here. Maybe I should have been more specific. I apologize for not...I have a flat file with lines that are the following.
user@abc.com,yyyymmdd,hhmmss,yyymmdd,hhmmss,111.222.123.123,222.111.222.111,AAAXXXLLLL,AAAXXXLLLL,ANAMEFORTHIS
I am not familiar enough with MQ to know where/how these values would be stored in MQ.
Thanks! |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 31, 2004 11:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Presumably, you want to put each of those records onto a queue as a message.
So then modify the sample .pl program that has already been mentioned to change the contents of the data that it writes to the message object to the contents of one of your records. Then wrap the piece of code that creates a message and PUTs it in a loop that reads each of your records.
And it's not surprising that the answer to the question you asked - "where can I find a perl sample for putting messages on a queue" was not helpful in answering the question you meant to ask - "How do I use MQSeries to send my data?".
And the manual called "Application Programming Guide" is a good resource for learning how to write MQSeries programs. Also, there is a Support Pack called something like "MQSeries Primer" that may be of help. You can do a search on this website for "Support Packs" or "SupportPac" to find the link to the page on the IBM website that has support packs. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
oz1ccg |
Posted: Wed Mar 31, 2004 12:58 pm Post subject: |
|
|
 Yatiri
Joined: 10 Feb 2002 Posts: 628 Location: Denmark
|
If you just have to move that flatfile into a MQ queue.... I would offer you another link, because you would only have to write a single command to put the file into a WebSphere MQ queue....
Q -oQMGRA#QUEUE1< flatfile or
cat flatfile | Q -oQMGRA#QUEUE1
I haven't used the last one myself.
http://www.ibm.com/support/docview.wss?rs=203&uid=swg24000647&loc=en_US&cs=utf-8&lang=en
Description:
Quote: |
Q takes messages from one source and outputs to a target. The operation of the pipe is controlled by switches to the program. The source and target can either be the console or a WebSphere MQ Queue. since input/output can be taken from stdin/stdout these can also be files. Two instances of Q can therefore be used to implement a primitive file transfer program. |
I've created a "FTP to MQ" and visa versa application using the q-program. I only had to write some shell scripts to invoke the FTP and Q program to make it all work. This is just a creative inspiration.
I know it's more fun to write a new application, but it's easier to tak one of the shelf, and it's even tested
PS: we're all trying to help..... But we don't teach how to read, think, eat and drink. It requires a little work from you too.
Quote: |
Thats why you are the Grand Master and I am the newbie. What is a no-brainer for someone of your great magnitude of MQ skills, is certainly not mine. I thought this was a place to get help for MQ |
Just my $0.02  _________________ Regards, Jørgen
Home of BlockIP2, the last free MQ Security exit ver. 3.00
Cert. on WMQ, WBIMB, SWIFT. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 31, 2004 1:35 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The Q utility has some buffer limitations on record sizes - something like 5000 bytes or so.
At least, it did the last time I checked.
And to be clear, this buffer limitation isn't necessarily a bad thing - just something to be aware of. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bduncan |
Posted: Wed Mar 31, 2004 1:52 pm Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
musiccs,
I guess my response was a tad too stern. I just get irritated when I feel like someone expects me to write an exact sample program for them (it's not exactly a "sample" anymore now is it?) As Jørgen points out, most of us will go a long way towards helping a newbie as long as we feel they are making an effort to meet us partway...
Without even knowing exactly how to code this program, you should be able to think about *what* it should do.
For instance, do you want to a) send the entire flat file as a single message, or b) send each line in the flat file as a separate message.
Also, your statement
Quote: |
I am not familiar enough with MQ to know where/how these values would be stored in MQ. |
makes me wonder if you even want to use MQSeries for this. When you say "stored" it makes me think that you are trying to use MQSeries as a data repository - and that's what a database is for, not messaging middleware. _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
Back to top |
|
 |
musiccs |
Posted: Thu Apr 01, 2004 9:37 am Post subject: |
|
|
Newbie
Joined: 31 Mar 2004 Posts: 5 Location: Brentwood
|
Man Brandon...you are tough as nails! Are you related to my boss by any chance?....haha! Yeah, not only was I not specific, but I used wrong terms. Yeah, a flat file in which that each line would be a new message. And NOT stored on MQ, but PUT. Another process is going to GET the messages, run some additional processing and store them in a Database. And my thought originally was hoping that someone out on the forum here would have done something like this before. Have you ever been slammed with a task that you no little about, and asked to get it done yesterday? Yeah, I think we all have at one time or another...well that is my task for this Friday so thats where I am coming from.....Thanks for all your input too....I will look at all the resources mentioned in the chain. In the meantime if anyone has done this before and wants to chime in, GREAT! |
|
Back to top |
|
 |
|