Working in C, how do you return the RMS$_CODE symbol for any given error number as returned from any operation?
On 3/18/2025 1:58 AM, Lawrence D'Oliveiro wrote:
On Tue, 18 Mar 2025 16:24:46 +1100, Michael Brown wrote:
Working in C, how do you return the RMS$_CODE symbol for any given error >>> number as returned from any operation?
The $GETMSG system service comes to mind. I see there is a library
routine
LIB$SYS_GETMSG, not sure what that does that the system service call does
not.
Classic LIB$ SYS$ difference in API style:
SYS$ LIB$
optional arguments require placeholder can be omitted readonly integer argument by value by reference string arguments fixed length only dynamic ok
On Tue, 18 Mar 2025 16:24:46 +1100, Michael Brown wrote:
Working in C, how do you return the RMS$_CODE symbol for any given error
number as returned from any operation?
The $GETMSG system service comes to mind. I see there is a library routine LIB$SYS_GETMSG, not sure what that does that the system service call does not.
On 3/18/2025 1:58 AM, Lawrence D'Oliveiro wrote:
On Tue, 18 Mar 2025 16:24:46 +1100, Michael Brown wrote:
Working in C, how do you return the RMS$_CODE symbol for any given error >>> number as returned from any operation?
The $GETMSG system service comes to mind. I see there is a library
routine
LIB$SYS_GETMSG, not sure what that does that the system service call does
not.
Classic LIB$ SYS$ difference in API style:
SYS$ LIB$
optional arguments require placeholder can be omitted readonly integer argument by value by reference string arguments fixed length only dynamic ok
This might be a typical newbie question but I can't find any reference
to it on the net.
Working in C, how do you return the RMS$_CODE symbol for any given error number as returned from any operation? I use strerror() to get an interpretation but it does not include said symbol.
exit(rms_return_number); will print it out so I know it must be possible.
On 3/18/2025 9:56 AM, Arne Vajhøj wrote:
On 3/18/2025 1:58 AM, Lawrence D'Oliveiro wrote:
On Tue, 18 Mar 2025 16:24:46 +1100, Michael Brown wrote:
Working in C, how do you return the RMS$_CODE symbol for any given
error
number as returned from any operation?
The $GETMSG system service comes to mind. I see there is a library
routine
LIB$SYS_GETMSG, not sure what that does that the system service call
does
not.
Classic LIB$ SYS$ difference in API style:
SYS$ LIB$
optional arguments require placeholder can be omitted
readonly integer argument by value by reference
string arguments fixed length only dynamic ok
In C it is just different:
#include <stdio.h>
#include <stdint.h>
#include <descrip.h>
#include <lib$routines.h>
#include <starlet.h>
int main(int argc, char *argv[])
{
char msg[256];
int32_t code, stat;
int16_t msglen;
$DESCRIPTOR(msgdesc, msg);
code = 98962;
stat = lib$sys_getmsg(&code, &msglen, &msgdesc);
msg[msglen] = 0;
printf("stat=%d msg=|%s|\n", stat, msg);
stat = sys$getmsg(code, &msglen, &msgdesc, 0, 0);
msg[msglen] = 0;
printf("stat=%d msg=|%s|\n", stat, msg);
return 0;
}
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 505 |
Nodes: | 16 (2 / 14) |
Uptime: | 46:48:46 |
Calls: | 9,920 |
Calls today: | 7 |
Files: | 13,801 |
Messages: | 6,347,408 |