Retrieving RTL error message text

Retrieving RTL error message text

Is there a way to retrieve the error message text for an RTL error that doesn't include a Win32 error? For example if one does an internal read, such as

 
read (string, '(i)', iostat=status) number 

and there is an error, about all you can say is

 
if (status .ne. 0) type *, 'RTL error ', iostat 

You can use ERRSNS in many cases where an underlying Win32 I/O routine was used but not in all cases. If the second parameter is zero then you essentially have no error message to retrieve, as in the case above.

What I am looking for is something like under the OVMS compiler where you have message numbers defined in $FORDEF that correspond to the iostat values, such that you can do an ERRSNS(,,,,status) and lookup the message according to that return value, which is one of the FOR$_xxx constants defined for $FORDEF. This way we could go ahead and use ForrmatMessage and return an appropriate error message in a controlled fashion.

I ask because I was once quoted telling someone that we are past the days where we have to look up numeric error codes to determine what went wrong at runtime. :-)

James

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Look up GERROR in the online help.

Steve

Steve - Intel Developer Support

Steve,

Thanks - I missed that one as it wasn't in my OVMS documentation. It does have the problem in that it isn't portable between the OS's which is often a goal of mine. Is there any possibility of seeing status codes suitable for a FormatMessage call show up somewhere, perhaps the fifth parameter of ERRSNS and defined in FORDEF?

James

FormatMessage knows only about Win32 errors.

Your best bet is to write a VMS implementation of GERROR - pretty easy with $GETMSG.

Steve

Steve - Intel Developer Support

What isn't trivial is making a VMS version of GERROR interoperate with ERRSNS. With the DFPORT version you can call GERROR and subsequently call ERRSNS as expected. However in a VMS version I would need to call ERRSNS to retrieve the conditional status for SYS$GETMSG which would in turn clear the ERRSNS information. I still need access to the operating system error if the situation warrants, and to fully emulate GERROR I would need to be able to obtain the message text without call ERRSNS.

James

Leave a Comment

Please sign in to add a comment. Not a member? Join today