Path: ...!eternal-september.org!feeder3.eternal-september.org!news.quux.org!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail From: Michael Brown Newsgroups: comp.os.vms Subject: Re: Error Number to Symbol Date: Thu, 20 Mar 2025 02:34:04 +1100 Organization: House Harris Software Message-ID: References: <44eb1a056232d61f311df18d9fe1d0084c5383ca@i2pn2.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 19 Mar 2025 15:34:05 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="859720"; mail-complaints-to="usenet@i2pn2.org"; posting-account="GwTNKfv9ol/2gq1jYpHTGGj3rZP9lYPWWhlaSWafPM8"; User-Agent: Mozilla Thunderbird Content-Language: en-US X-Spam-Checker-Version: SpamAssassin 4.0.0 In-Reply-To: Bytes: 2887 Lines: 58 This is gold!, thank you for this question fully answered. I can polish up my error handling routines now. On 19/3/25 01:01, Arne Vajhøj wrote: > 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 > #include > > #include > #include > #include > > 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; > } > -- House Harris Software. Making the world a safer place for our products. https://eisner.decus.org/~brown_mi