[Info-vax] Fortran Exit Codes

Stephen Hoffman seaohveh at hoffmanlabs.invalid
Mon Feb 26 17:11:06 EST 2024


On 2024-02-26 00:16:04 +0000, Lawrence D'Oliveiro said:

> Just looking at the Fortran 2018 spec, section 11.4, “STOP and ERROR
> STOP statements”. Paragraph 2 says:
> 
>     When an image is terminated by a STOP or ERROR STOP statement,
>     its stop code, if any, is made available in a processor-dependent
>     manner. If the stop-code is an integer, it is recommended that the
>     value be used as the process exit status, if the processor
>     supports that concept. If the stop-code in a STOP statement is of
>     type character or does not appear, or if an end-program-stmt is
>     executed, it is recommended that the value zero be supplied as the
>     process exit status, if the processor supports that concept. If
>     the stop-code in an ERROR STOP statement is of type character or
>     does not appear, it is recommended that a processor-dependent
>     nonzero value be supplied as the process exit status, if the
>     processor supports that concept.
> 
> But on VMS, the usual success status code is 1, with other odd values
> indicating varying degrees of success, while even values (including
> zero) indicate warnings or errors. So how does that work?

C and its run-time will return OpenVMS status values, or will return 
traditional UNIX status values, depending on the switches and the 
context. By default, C uses the OpenVMS conventions here.

Page 19 and following describes how this works in C on OpenVMS: 
https://docs.vmssoftware.com/docs/vsi-c-run-time-library-reference-manual-for-openvms-systems.pdf 


Here, Fortran will undoubtedly use the OpenVMS status norms, because 
that's what the operating system supports. If there's enough pushback 
to VSI, there'll probably be a alter-the-return-values mechanism added. 
If that mechanism is not already present in some build.

More generally on OpenVMS, any value with 1 in the low three bits—in 
the so-called severity field—is successful. Two of the severity values 
defined STS$K_SUCCESS and STS$K_INFO are odd, as well.

Page 244 has general details: 
https://docs.vmssoftware.com/docs/vsi-openvms-programming-concepts-manual-volume-i.pdf 


The following has the C condition value / return value / error value 
details: 
https://docs.vmssoftware.com/vsi-c-user-s-guide-for-openvms-systems/#RET_STATUS_SEC 


And if you think that "just swap in the Linux kernel" idea you've been 
floating won't hit this status difference and myriad other details, 
you're headed for a surprise.


-- 
Pure Personal Opinion | HoffmanLabs LLC 




More information about the Info-vax mailing list