[Info-vax] completion status from LIB$SPAWN
abrsvc
dansabrservices at yahoo.com
Fri Apr 27 10:40:37 EDT 2012
On Friday, April 27, 2012 10:34:33 AM UTC-4, David Froble wrote:
> StGallen wrote:
> > 1. For the benefit of anyone reading this thread, the above is described in the C manual.
> >
> > 2. The value 268435457 (in decimal) is same as %X10000001 in HEXA and 1 in decimal is same as 1 in HEXA.
> >
> > $ say F$message(%X00000001)
> > %SYSTEM-S-NORMAL, normal successful completion
> >
> > $ say F$message(%X10000001)
> > %SYSTEM-S-NORMAL, normal successful completion
> >
> > So both 268435457 & 1 are status codes for normal completion. However, the constant SS$_NORMAL is defined to be 1.
> >
> > So the question remains: why would VMS return 2 values for Normal Completion?
> > How are programmers expected to handle it without going the route of the procedure posted by Briggs above.
> >
> > P.S: In case anyone wants to know :
> > 268435457 in DECIMAL is 10000000000000000000000000001 in BINARY.
> > assuming the right most position is position 0, the left most position is 28. Bit 27 is clear so it is a message from HP. Bits 15 to 3 are clear. Severity 2-0 is 1 which implies SUCCESS.
>
> As others have explained, your insistence on doing value comparisons is inappropriate.
>
> The standard in VMS is that the least significant bit in a completion status mask
> specifies success or failure. Don't test the value, do a mask comparison, ie;
>
> If (Stat% And SS$_NORMAL)
> Then Print "Success"
> Else Print "Failure"
> End If
>
> The other bits in a completion status can indicate additional information, but have no
> bearing on success or failure.
>
> You're making this a lot harder than it actually is.
>
> Now, if there is a failure, then perhaps sometimes you might want to test for specific
> reasons for the failure, which is appropriate, but if all you want to know is success or
> failure, you have only one bit to check.
To go along with other posts here, the typical test is for bit 0 to indicate success or failure. Informational messages wouldbe included as successful messages. It is common for the top bit to be set to supress messaging. Most code that I have seen (independent of language) tests for bit 0 before any additional testing or processing.
Dan
More information about the Info-vax
mailing list