• C Error Number to Symbol

    From Michael Brown@21:1/5 to All on Wed Mar 19 12:02:41 2025
    This might be a very simple question but I can't find any reference to
    it on the net.

    Working in C, how do you get 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.


    --
    House Harris Software.
    Making the world a safer place for our products. https://eisner.decus.org/~brown_mi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Clubley@21:1/5 to Michael Brown on Wed Mar 19 13:04:23 2025
    On 2025-03-18, Michael Brown <brown_mi@decuserve.org> wrote:

    This might be a very simple question but I can't find any reference to
    it on the net.

    Working in C, how do you get 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.


    Can you explain what was missing in the previous answers you received
    so the authors of those answers can clarify them if needed ?

    Simon.

    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Craig A. Berry@21:1/5 to Simon Clubley on Wed Mar 19 08:38:27 2025
    On 3/19/25 8:04 AM, Simon Clubley wrote:
    On 2025-03-18, Michael Brown <brown_mi@decuserve.org> wrote:

    This might be a very simple question but I can't find any reference to
    it on the net.

    Working in C, how do you get 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.


    Can you explain what was missing in the previous answers you received
    so the authors of those answers can clarify them if needed ?

    I _think_ what he wants is some kind of translation table between errno
    values and VMS condition codes. For example, starting with errno of
    ESRCH and getting to RMS$_RNF or vice versa. I'm not aware of any such
    table, and if there were, it wouldn't be a one-to-one mapping.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Brown@21:1/5 to Simon Clubley on Thu Mar 20 01:06:23 2025
    On 20/3/25 00:04, Simon Clubley wrote:

    Can you explain what was missing in the previous answers you received
    so the authors of those answers can clarify them if needed ?

    Simon.

    I'm sorry I'm not with you, I haven't seen any previous answers?





    --
    House Harris Software.
    Making the world a safer place for our products. https://eisner.decus.org/~brown_mi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Brown@21:1/5 to Craig A. Berry on Thu Mar 20 01:29:41 2025
    On 20/3/25 00:38, Craig A. Berry wrote:

    I _think_ what he wants is some kind of translation table between errno values and VMS condition codes.  For example, starting with errno of
    ESRCH and getting to RMS$_RNF or vice versa.  I'm not aware of any such table, and if there were, it wouldn't be a one-to-one  mapping.

    yes if I get a return status of 98994 I would like to be able to look it
    up and get "RMS$_RNF" to output that in my error handling routine.



    --
    House Harris Software.
    Making the world a safer place for our products. https://eisner.decus.org/~brown_mi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Townley@21:1/5 to Michael Brown on Wed Mar 19 14:17:00 2025
    On 19/03/2025 14:06, Michael Brown wrote:
    On 20/3/25 00:04, Simon Clubley wrote:

    Can you explain what was missing in the previous answers you received
    so the authors of those answers can clarify them if needed ?

    Simon.

    I'm sorry I'm not with you, I haven't seen any previous answers?

    I think he was referring to your thread "Error Number to Symbol" which
    had a few replies

    --
    Chris

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Brown@21:1/5 to Chris Townley on Thu Mar 20 01:45:44 2025
    On 20/3/25 01:17, Chris Townley wrote:
    On 19/03/2025 14:06, Michael Brown wrote:
    On 20/3/25 00:04, Simon Clubley wrote:

    Can you explain what was missing in the previous answers you received
    so the authors of those answers can clarify them if needed ?

    Simon.

    I'm sorry I'm not with you, I haven't seen any previous answers?

    I think he was referring to your thread "Error Number to Symbol" which
    had a few replies


    Oh I thought that first post failed and my Thunderbird seems to have
    lost the thread. I'll see if I can refresh it or something.I've really
    messed this up.


    --
    House Harris Software.
    Making the world a safer place for our products. https://eisner.decus.org/~brown_mi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert A. Brooks@21:1/5 to Michael Brown on Wed Mar 19 10:58:44 2025
    On 3/19/2025 10:06, Michael Brown wrote:
    On 20/3/25 00:04, Simon Clubley wrote:

    Can you explain what was missing in the previous answers you received
    so the authors of those answers can clarify them if needed ?

    Simon.

    I'm sorry I'm not with you, I haven't seen any previous answers?

    What reader are you using? There are several credible answers to the thread you started whose subject is "Error Number to Symbol"

    --
    -- Rob

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Craig A. Berry@21:1/5 to Michael Brown on Wed Mar 19 11:08:42 2025
    On 3/19/25 9:29 AM, Michael Brown wrote:
    On 20/3/25 00:38, Craig A. Berry wrote:

    I _think_ what he wants is some kind of translation table between errno
    values and VMS condition codes.  For example, starting with errno of
    ESRCH and getting to RMS$_RNF or vice versa.  I'm not aware of any such
    table, and if there were, it wouldn't be a one-to-one  mapping.

    yes if I get a return status of 98994 I would like to be able to look it
    up and get "RMS$_RNF" to output that in my error handling routine.


    No, I guessed wrong. You are not dealing with errno at all but rather
    VMS condition code to message lookup, which, as you've now discovered,
    has already been fully answered.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Craig A. Berry on Wed Mar 19 14:20:43 2025
    On 3/19/2025 12:08 PM, Craig A. Berry wrote:
    On 3/19/25 9:29 AM, Michael Brown wrote:
    On 20/3/25 00:38, Craig A. Berry wrote:
    I _think_ what he wants is some kind of translation table between errno
    values and VMS condition codes.  For example, starting with errno of
    ESRCH and getting to RMS$_RNF or vice versa.  I'm not aware of any such >>> table, and if there were, it wouldn't be a one-to-one  mapping.

    yes if I get a return status of 98994 I would like to be able to look
    it up and get "RMS$_RNF" to output that in my error handling routine.

    No, I guessed wrong.  You are not dealing with errno at all but rather
    VMS condition code to message lookup, which, as you've now discovered,
    has already been fully answered.

    I was starting to think that it was about translating from
    numeric value to symbolic name, which is a weird one.

    $ type moremsgfun.pas
    [inherit('sys$library:pascal$lib_routines')]
    program moremsgfun(input,output);

    type
    pstr = varying [255] of char;

    var
    fac, id, name : pstr;
    code : integer;

    begin
    code := 98962;
    lib$sys_getmsg(code, fac.length, fac.body, 8);
    lib$sys_getmsg(code, id.length, id.body, 2);
    name := substr(fac, 2) + '$_' + substr(id, 2);
    writeln(code:1, ' = ', name);
    end.
    $ pas moremsgfun
    $ lin moremsgfun
    $ run moremsgfun
    98962 = RMS$_FNF

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Brown@21:1/5 to All on Thu Mar 20 09:06:04 2025
    On 20/3/25 05:20, Arne Vajhøj wrote:
    On 3/19/2025 12:08 PM, Craig A. Berry wrote:
    On 3/19/25 9:29 AM, Michael Brown wrote:
    On 20/3/25 00:38, Craig A. Berry wrote:
    I _think_ what he wants is some kind of translation table between errno >>>> values and VMS condition codes.  For example, starting with errno of
    ESRCH and getting to RMS$_RNF or vice versa.  I'm not aware of any such >>>> table, and if there were, it wouldn't be a one-to-one  mapping.

    yes if I get a return status of 98994 I would like to be able to look
    it up and get "RMS$_RNF" to output that in my error handling routine.

    No, I guessed wrong.  You are not dealing with errno at all but rather
    VMS condition code to message lookup, which, as you've now discovered,
    has already been fully answered.

    I was starting to think that it was about translating from
    numeric value to symbolic name, which is a weird one.

    $ run moremsgfun
    98962 = RMS$_FNF

    Arne


    This is exactly what I intended with the original post, so this pas
    source is very interesting to me.

    --
    House Harris Software.
    Making the world a safer place for our products. https://eisner.decus.org/~brown_mi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Hoffman@21:1/5 to Michael Brown on Wed Mar 19 17:36:25 2025
    On 2025-03-19 01:02:41 +0000, Michael Brown said:

    This might be a very simple question but I can't find any reference to
    it on the net.

    Working in C, how do you get 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.

    You're seemingly assuming C is integrated with OpenVMS, and in many
    ways it is just not. Here, you will want to call sys$getmsg, sys$fao,
    or sys$faol, among other OpenVMS system services and potentially RTL
    calls, to process the OpenVMS condition values.

    BTW: One wrinkle with wrapping $fao and $faol calls into C calls with
    variable argument lists into the call: SS$ calls have one argument, RMS
    codes have two, and the rest have whatever arguments the user had
    specified. I have code that deals with this, not that I can find a
    copy posted anywhere at the moment.

    Here? I'd start with the programming concepts manual for the OpenVMS
    parts of the programming environment, and then the C manuals for the
    C-specific pieces. Stuff like OpenVMS signals, descriptors, itemlists
    and related aren't particularly integrated into C. Not past data
    structure definitions and a code slog or two or five.

    Page 100:

    https://docs.vmssoftware.com/docs/vsi-c-run-time-library-reference-manual-for-openvms-systems.pdf


    See strerror(int errcode, int vmserrcode), as well.

    Related:

    https://www.digiater.nl/openvms/freeware/v80/hoffman_examples/rms_examples.c




    --
    Pure Personal Opinion | HoffmanLabs LLC

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Michael Brown on Wed Mar 19 18:44:06 2025
    On 3/19/2025 6:06 PM, Michael Brown wrote:
    On 20/3/25 05:20, Arne Vajhøj wrote:
    On 3/19/2025 12:08 PM, Craig A. Berry wrote:
    On 3/19/25 9:29 AM, Michael Brown wrote:
    On 20/3/25 00:38, Craig A. Berry wrote:
    I _think_ what he wants is some kind of translation table between
    errno
    values and VMS condition codes.  For example, starting with errno of >>>>> ESRCH and getting to RMS$_RNF or vice versa.  I'm not aware of any
    such
    table, and if there were, it wouldn't be a one-to-one  mapping.

    yes if I get a return status of 98994 I would like to be able to
    look it up and get "RMS$_RNF" to output that in my error handling
    routine.

    No, I guessed wrong.  You are not dealing with errno at all but rather
    VMS condition code to message lookup, which, as you've now discovered,
    has already been fully answered.

    I was starting to think that it was about translating from
    numeric value to symbolic name, which is a weird one.

    $ run moremsgfun
    98962 = RMS$_FNF

    This is exactly what I intended with the original post, so this pas
    source is very interesting to me.

    It is just two lib$sys_getmsg calls with flags to get
    facility and identity and then it is cross fingers and
    hope the symbolic name follow convention of facility$_identity.

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Brown@21:1/5 to All on Thu Mar 20 12:54:52 2025
    On 20/3/25 09:44, Arne Vajhøj wrote:

    This is exactly what I intended with the original post, so this pas
    source is very interesting to me.

    It is just two lib$sys_getmsg calls with flags to get
    facility and identity and then it is cross fingers and
    hope the symbolic name follow convention of facility$_identity.

    Arne


    Yes I see, I would have never known about the effect of the flag field
    and would have plowed ahead and broken down the default message with
    strtok to get what I wanted. This is far more efficient. It will
    certainly work for all the RMS return codes so that's mainly what I need.

    --
    House Harris Software.
    Making the world a safer place for our products. https://eisner.decus.org/~brown_mi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@21:1/5 to Michael Brown on Wed Mar 19 22:11:53 2025
    On 3/19/2025 9:54 PM, Michael Brown wrote:
    On 20/3/25 09:44, Arne Vajhøj wrote:
    This is exactly what I intended with the original post, so this pas
    source is very interesting to me.

    It is just two lib$sys_getmsg calls with flags to get
    facility and identity and then it is cross fingers and
    hope the symbolic name follow convention of facility$_identity.

    Yes I see, I would have never known about the effect of the flag field
    and would have plowed ahead and broken down the default message with
    strtok to get what I wanted. This is far more efficient. It will
    certainly work for all the RMS return codes so that's mainly what I need.

    Note that all this is to get the name as a string at runtime
    to get the name at development time one can just do:

    $ libr/text/extr=rmsdef/out=rmsdef.h sys$library:sys$starlet_c
    $ sear rmsdef.h 98962
    #define RMS$_FNF 98962

    Arne

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Brown@21:1/5 to Robert A. Brooks on Thu Mar 20 13:14:52 2025
    On 20/3/25 01:58, Robert A. Brooks wrote:
    On 3/19/2025 10:06, Michael Brown wrote:
    On 20/3/25 00:04, Simon Clubley wrote:

    Can you explain what was missing in the previous answers you received
    so the authors of those answers can clarify them if needed ?

    Simon.

    I'm sorry I'm not with you, I haven't seen any previous answers?

    What reader are you using?  There are several credible answers to the
    thread
    you started whose subject is "Error Number to Symbol"

    using Thunderbird for the reader.
    The solution was to unsubscribe from the newsgroup and subscribe again
    to reread all the headers.

    why Thunderbird lost the thread had something to do with the apparent
    failure to post originally(even though it did post). At this point I had
    some kind of poisoned list in Thunderbird which was not displaying
    anything coming in to that (invisible) thread.

    --
    House Harris Software.
    Making the world a safer place for our products. https://eisner.decus.org/~brown_mi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)