PDA

View Full Version : Duplicating message ques



Guest.Visitor
01-01-1995, 02:00 AM
Please tell me the steps necessary to create a duplicate message from one que to another between different as/400's. We tried a create duplicate object and message returned is will not allow you to duplicate the data on the same AS/400. We attempted a save file and transfered the save file to the other system. The message que was empty. My email is DPrice@vcdsa.com help!

Guest.Visitor
11-02-1999, 02:29 AM
I had to write a program for it a few years ago. It just wasn't possible then using OS/400-commands. Second guessing IBM I don't think that they have done anything about it so far. HTH, Rob.

Guest.Visitor
11-02-1999, 06:24 AM
Donald, I'm just curious. Why would you want to duplicate messages from one queue to another? What particular problem exists that this function would be useful for?

Guest.Visitor
11-02-1999, 07:23 AM
Because you can use messages in an application and want to separate the messages so that the same message can mean 'Backup-system' in one messagefile and 'Time-registration' in the other... Saves a lot of time because you can leave most of the message-id's and their messagedescription in tact. I do it all the time but then again I did have to write the utility for it. HTH, Rob.

Guest.Visitor
11-02-1999, 07:53 AM
how about using a combination of RCVMSG and SNDMSG? Regards, Jim Langston

Guest.Visitor
11-02-1999, 09:55 AM
You can setup a message queue to have a break handling program. CHGMSGQ MSGQ(AMSGQ) DLVRY(*BREAK) PGM(LIBRARY/PROGRAM) Each time a message arrives at the message queue the program is called. Paramenters are sent to the program to indicate the id of the messsage that triggered the call. From there you can receive the message and send it to another message queue depending on your criteria. e.g. PGM PARM(&MSGQ &LIB &MSGKEY) /* Input Parms from + Message Queue indicating the message that + has been received. */ some DCL statements DCL VAR(&LIB) TYPE(*CHAR) LEN(10) /* Library of + Message Queue */ DCL VAR(&MSGKEY) TYPE(*CHAR) LEN(4) /* Key of + Individual Message */ DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) /* Message + Id */ RCVMSG MSGQ(&LIB/&MSGQ) MSGKEY(&MSGKEY) RMV(*NO) + MSG(&MSG) MSGID(&MSGID) SEV(&SEV) + RTNTYPE(&MSGTYPE) /* Recieve message + using input parms. */ SNDPGMMSG MSG(&MSG) TOMSGQ(&XXXXX) depending on the logic you wish to insert to decide where to send the message if at all. Paul.

Guest.Visitor
11-02-1999, 10:49 AM
Oh, wow! That would of made somethign I did about 3 years ago much, much easier. At the time I was running a remote command on another AS/400 in batch, and when I wanted to know when it was finished I did a NETSNDMSG and the first program was in a loop doing a RCVMSG. Since then, though, the programs have been totally rewritten (I didnt' like they way they worked in the first place) and I don't have to concern myself when the batch job finishes anymore. That would of been so much easier! Well, now I know, though, and I can think of lots and lots of ways to use this. Thanks for the quality info! Regards, Jim Langston

Guest.Visitor
11-03-1999, 05:16 AM
BTW : I stand corrected. Thought you were talking about messagefiles instead of messagequeues. R.