Software Archive
Read-only legacy content
17060 Discussions

Retrieving RTL error message text

james1
Beginner
1,000 Views
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

0 Kudos
4 Replies
Steven_L_Intel1
Employee
1,000 Views
Look up GERROR in the online help.

Steve
0 Kudos
james1
Beginner
1,000 Views
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
0 Kudos
Steven_L_Intel1
Employee
1,000 Views
FormatMessage knows only about Win32 errors.

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

Steve
0 Kudos
james1
Beginner
1,000 Views
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
0 Kudos
Reply