Operating System - OpenVMS
1825551 Members
2738 Online
109681 Solutions
New Discussion юеВ

lib$find_image_symbol returning undefined status value (1409786)

 
SOLVED
Go to solution
Andrew Olson
New Member

lib$find_image_symbol returning undefined status value (1409786)

If lib$find_image_symbol is called for an invalid image, the return status is 1381050 (defined as LIB$_ACTIMAGE in libdef.h.

If lib$find_image_symbol is called for a valid image, but an invalid symbol, the return status is 1409786. However, we could not this number defined as a constant anywhere in the system header files. According to the VMS documentation (http://h71000.www7.hp.com/doc/82final/5932/5932pro_018.html#fin_i / http://h71000.www7.hp.com/doc/82final/5932/5932pro_033.html#lookuk), it appears that the returned status should actually be LIB$_KEYNOTFOU (1409788). Our speculation guess is that some programmer made a mistake a while ago and this value is incorrectly hard-coded somewhere, but now it cannot be changed due to passivity reasons. Any thoughts/comments as to how we could confirm this, and how we should proceed? Should we just hard-code the undefined value within our application code? Is this deemed a 'safe' programming practice?

thanks,
Andrew Olson
Cerner Corporation
2 REPLIES 2
Craig A Berry
Honored Contributor
Solution

Re: lib$find_image_symbol returning undefined status value (1409786)

It's the same error, just different severity:

$ exit 1409786
%LIB-E-KEYNOTFOU, key not found in tree
$ exit 1409788
%LIB-F-KEYNOTFOU, key not found in tree


The one you got was an error rather than a fatal error. An OpenVMS condition value is not just an arbitrary constant but rather a 32-bit structure the fields of which have specific and well documented meanings. For details, see the calling standard manual, currently at:

http://h71000.www7.hp.com/DOC/82final/5973/5973pro_022.html
John Gillings
Honored Contributor

Re: lib$find_image_symbol returning undefined status value (1409786)

>Should we just hard-code the undefined
>value within our application code? Is this
>deemed a 'safe' programming practice?

How you test condition codes depends on your objectives. For example, to test for success or fail, just look at the low bit.

Hard coding codes is rarely a good idea. As Craig said, the value is actually a structure with different components. The same condition could be returned or signalled with different severity, facility code or flags.

If you want to check for a specific condition, independent of other components of the condition code, use LIB$MATCH_COND. In your case:

stat=LIB$FIND_IMAGE_SYMBOL( etc...)
check=LIB$MATCH_COND(stat,LIB$_KEYNOTFOU)

will return 1 if the returned code matches KEYNOTFOU for any severity or facility. For example, it could be "RMS-S-KEYNOTFOU", or "SYS-F-KEYNOTFOU".

LIB$MATCH_COND accepts a list of candidate conditions as a variable argument list. It will return the index of the first matching code.

In this case the programmer of LIB$FIND_IMAGE_SYMBOL did not make a mistake, they wanted to return an "E" severity condition, rather than "F". Makes sense since FIND_IMAGE_SYMBOL signals its status.
A crucible of informative mistakes