Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Way to extract full message attributes

 
SOLVED
Go to solution
Maxy2
Advisor

Way to extract full message attributes

I am on OpenVMS 8.3 IA64.

Is there a way to convert a .MSG file into a "normalized" form, where I can get a listing of all the messages with all of their attributes?

I have a .MSG file which I want to print out with the code, message, severity, fao, facility, prefix, etc. Some of these parameters are set for each line, but others are set for whole blocks of lines using .SEVERITY and .FACILITY directives.

Is there an easy way to convert this into a form where nothing is set by directive, but intead is made explicit on each line. I am open to using MESSAGE, UNMESSAGE, Perl, or even writing a program and calling LIB$SIGNAL on every condition... It just has to be some process where message file goes in and list of all messages with attributes comes out.

Thanks.
2 REPLIES 2
Hoff
Honored Contributor
Solution

Re: Way to extract full message attributes

Writing your own parser? Why?

Why not build the message library and access the resulting message definitions normally; use the MESSAGE definition module as it was originally intended?

If you're looking to include messages in an application, then look to use the (undocumented) MESSAGE /SDL and the SDL tool. Details are here:

http://labs.hoffmanlabs.com/node/588
http://labs.hoffmanlabs.com/node/585
H.Becker
Honored Contributor

Re: Way to extract full message attributes

message/list produces a listing, which includes the full message text and code. That's not exactly what you are asking for, but it may help. Search it for ".facility" and use the last four (hex) digits of the facility code to extract all messages with their code.

If you want this to have your literals defined in any programming language, you are better off with the SDL output and the SDL tool.

But you can easily construct your literals or '#define's out of the message object. For Alpha and C just use something like:

$! p1 message file (without type .msg)
$! p2 facility name
$! results in 'p1.h
$
$ message/object=tmp 'p1.MSG
$ analyze/obj/out=x.tmp tmp
$ search x.tmp symbol:,value/out=y.tmp
$ search y.tmp """''p2'"/wind=(1,0)/out=z.tmp
$ open/read in z.tmp
$ open/write out 'p1.h
$ loop:
$ read/end=done in line1
$ read in line2
$ line1= line1- "value:"- "%X'00000000"- "'"
$ line2= line2- "symbol:"- """"- """"
$ write out "#define ", f$edit(line2,"collapse"), " 0x", f$edit(line1,"collapse")
$ goto loop
$ done:
$ close in
$ close out
$ del tmp.obj;*, x.tmp;*, y.tmp;*, z.tmp;*