|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
saveqmgr options |
« View previous topic :: View next topic » |
Author |
Message
|
Michael Dag |
Posted: Fri Aug 26, 2005 11:02 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
jefflowrey wrote: |
But we're talking about simplifying things for machine processing.
Readability is not very important in this case.
|
are you referring to my comments regarding readability of the saveqmgr output or your own with regard to ugliness? _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
wschutz |
Posted: Fri Aug 26, 2005 11:07 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Quote: |
are you referring to my comments regarding readability of the saveqmgr output or your own with regard to ugliness? |
I think he meant his....
Quote: |
CREATE QUEUE(ABC)
*CREATE QUEUE(ABC) ALTDATE(...
|
so would that be a -2 option?  _________________ -wayne |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Aug 26, 2005 11:14 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I was, in fact, referring to my own comments.
I was suggesting that, although putting a duplicate but commented entry into the "one line output" was indeed ugly, that it might be an acceptable trade for the gain it gave. If something is mostly or purely intended to be read by machines, it should not be a worry that it is hard to read by people (source code is mostly intended to be read by people).
I gather Wayne still disagrees. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wschutz |
Posted: Fri Aug 26, 2005 11:19 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
No, I'm serious. it'd be quite simple to allow for a -1 and -2 option (exclusive). -1 just gives the executable mqsc, -2 gives the executable mqsc + commented mqsc (with altdate etc) ....  _________________ -wayne |
|
Back to top |
|
 |
Michael Dag |
Posted: Fri Aug 26, 2005 11:27 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
why not:
-diff option
-diff creates output that can be used for diffing and not as input for mqsc ?
this will also avoid the 'spread' of the -1 one lined mqsc output...
someone WILL start using this format as his default and before you know
it you get a request for a oneline 2 readable mqsc formatter....
the mqsc format has a purpose, the 'diff' format (one line) has a purpose, both purposes are not the same and cannot (should not?) be mixed. _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Aug 27, 2005 5:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
wschutz wrote: |
No, I'm serious. it'd be quite simple to allow for a -1 and -2 option (exclusive). -1 just gives the executable mqsc, -2 gives the executable mqsc + commented mqsc (with altdate etc) ....  |
Ah, so the was for outputing two lines from a "oneline" option, not from having duplicated data in the output... I guess I didn't suggest that the duplicated data was produced by the -1 option, though...
I agree with Michael that any option will likely get misused over time.
Also, perhaps this use as a tool for "diff" is creeping out of scope for a tool designed to "save" the queue manager definitions...
But, you know, it's Wayne's program...  _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
wschutz |
Posted: Mon Aug 29, 2005 3:16 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
I'm not sure I like the "-diff" flag, as (a) its NOT diff output and (b) oneline format could be used by other tools (ie grep). I wouldn't decided that the default format should be called "-runmqsc".
Quote: |
Also, perhaps this use as a tool for "diff" is creeping out of scope for a tool designed to "save" the queue manager definitions...
|
but Jeff... these additional options only control the format of the output generated by savqmgr (ie, where or not to terminate each line line "*\n") its still just saving the definitions to a file (or stdout)... how people decide to use the output is up to them. _________________ -wayne |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Aug 30, 2005 12:53 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
All,
This is exactly what the Rexx programming language is designed to do (string manipulation). From Roger's toolbox out comes a Rexx routine that will turn MS03 output into single MQSC commands.
Any version of Rexx should be able to run this script. I know of 2 Rexx Interpreters:
- Object Rexx - IBM finally open sourced Rexx (10 years too late) http://www.oorexx.org/
- Regina Rexx - the original open source Rexx project http://regina-rexx.sourceforge.net/index.html
Code: |
/* Format output from MS03 to a single line for each entry. */
Parse Arg inFN .
if inFN = "" then
do
Say "Invalid number of parameters."
Say "i.e."
Say " fmt_ms03.rex input_file_name"
Exit
end
outFN = inFN || ".fmt.mqsc"
/* Delete previous output */
"ERASE "outFN
/* open files */
Call Stream inFN,'C','OPEN READ'
Call Stream outFN,'C','OPEN WRITE'
count = 0
mqscCmd = ""
do until Lines(inFN) = 0
inLine = Strip(LineIn(inFN)) /* read next line */
if (inLine = "") then
NOP /* blank line, forget-about-it */
else if (SubStr(inLine,1,1) = "*") then
NOP /* comment line, forget-about-it */
else
do
/* Last attribute in MQSC command? */
if (Length(inLine) <> LastPos('+',inLine)) then
do
mqscCmd = mqscCmd || " " || inLine /* add last attribute */
nothing = LineOut(outFN, mqscCmd) /* write to the file */
mqscCmd = ""
count = count + 1
end
else
do
temp = Strip(SubStr(inLine,1,(LastPos('+',inLine) - 1))) /* remove '+' */
if (mqscCmd = "") then
mqscCmd = temp
else
mqscCmd = mqscCmd || " " || temp
end
end
end
/* close the files */
Call Stream outFN,'C','CLOSE'
Call Stream inFN,'C','CLOSE'
Say outFN || " contains " || count || " MQSC formatted commands."
Exit |
Enjoy.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
wschutz |
Posted: Tue Aug 30, 2005 2:50 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Roger, and in sed:
Code: |
# A little sed script to split all objects types to their own files.
# run thusly: saveqmgr -c | sed -n -f splitout.sed (this file)
:begin
# skip comments and blank lines
/^\*/b again
/^ *$/b again
# strip off trailing blanks
s/ *$//
# if we have a complete ALTER line (no + at the end), then write it out
/^ALTER .*[^+]$/{
w QMGR.MQSC
b again
}
# if we have a complete DEFINE line (no + at the end), then write it out
/^DEFINE .*[^+]$/{
/^DEFINE QLOCAL/w QLOCAL.MQSC
/^DEFINE QMODEL/w QMODEL.MQSC
/^DEFINE QREMOTE/w QREMOTE.MQSC
/^DEFINE QALIAS/w QALIAS.MQSC
/^DEFINE CHANNEL/w CHANNEL.MQSC
/^DEFINE PROCESS/w PROCESS.MQSC
/^DEFINE AUTHINFO/w AUTHINFO.MQSC
/^DEFINE NAMELIST/w NAMELIST.MQSC
/^DEFINE SERVICE/w SERVICE.MQSC
/^DEFINE LISTENER/w LISTENER.MQSC
b again
}
# otherwise keep reading the input until we have a complete line
N
b begin
:again
P
d
|
_________________ -wayne |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Aug 30, 2005 6:09 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
As you probably have noticed, my roots are mainframe. i.e. mainframe -> OS/2 -> WinNT -> Unix. Over the last 6-7 years, I have been teaching myself Unix but for sed and awk, I've just never gotten into them.
Now with a couple of more lines, you can do the same thing in Rexx:
Code: |
/* Format output from MS03 to a single line for each entry. */
/* Put each command type into a different file. */
trace o
Parse Arg inFN .
if inFN = "" then
do
Say "Invalid number of parameters."
Say "i.e."
Say " fmt_ms03b.rex input_file_name"
Exit
end
types = "QMGR QLOCAL QMODEL QREMOTE QALIAS CHANNEL PROCESS AUTHINFO NAMELIST SERVICE LISTENER"
/* open file */
Call Stream inFN,'C','OPEN READ'
/* Delete previous output and then open it. */
do i=1 to Words(types)
ptr = Word(types,i)
outFN = inFN||"."||ptr||".mqsc"
"ERASE "outFN
Call Stream outFN,'C','OPEN WRITE'
counts.ptr = 0
end
total = 0
mqscCmd = ""
do until Lines(inFN) = 0
inLine = Strip(LineIn(inFN)) /* read next line */
if (inLine = "") then
NOP /* blank line, forget-about-it */
else if (SubStr(inLine,1,1) = "*") then
NOP /* comment line, forget-about-it */
else
do
/* Last attribute in MQSC command? */
if (Length(inLine) <> LastPos('+',inLine)) then
do
mqscCmd = mqscCmd || " " || inLine /* add last attribute */
ptr = Word(mqscCmd, 2)
nothing = LineOut(inFN||"."||ptr||".mqsc", mqscCmd) /* write to the file */
counts.ptr = counts.ptr + 1
total = total + 1
mqscCmd = ""
end
else
do
temp = Strip(SubStr(inLine,1,(LastPos('+',inLine) - 1))) /* remove '+' */
if (mqscCmd = "") then
mqscCmd = temp
else
mqscCmd = mqscCmd || " " || temp
end
end
end
/* close the files */
Call Stream inFN,'C','CLOSE'
do i=1 to Words(types)
ptr = Word(types,i)
outFN = inFN||"."||ptr||".mqsc"
Call Stream outFN,'C','CLOSE'
Say outFN || " contains " || counts.ptr || " MQSC formatted commands."
end
Say ""
Say "Total formatted MQSC commands was:" total
Exit |
Enjoy.
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
dgolding |
Posted: Wed Aug 31, 2005 4:58 am Post subject: |
|
|
 Yatiri
Joined: 16 May 2001 Posts: 668 Location: Switzerland
|
Just a thought, but why not use a similar mechanism to the unix "find" command, and have a "-mtime" command line option? This would be number of days ago an object was modified. A positive value could be objects modified AFTER this number of days, and a negative objects modified LESS than these number of days.
Then, you could write a crontab or similar that every week (or every day) would see what had changed in the 24 hours/7 days.
I was at one site where a saveqmgr was done nightly, and then compared with the result of the previous night (output files were diff'd) - this gave you a report of any changes that day.....
$0.02 |
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed Aug 31, 2005 7:50 am Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
Yes, every MQ Admin should be using MS65 and MS03 nightly on all Unix boxes and do a similar thing for Windows. MS65
At a current client site, I copied MS65 to MS65OAM and replaced saveqmgr with amqoamd. Then on the DR box, I created a directory for each MQ server in their environment (from DEV to PROD).
I created a simple shell script (SaveMQ.sh) to
- invoke MS65
- invoke MS65OAM
- scp the results to the DR box
I set this script up on all Unix servers that have MQ running and it runs every night at 11:59PM.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|