[Info-vax] Learning VMS application programming

John E. Malmberg wb8tyw at qsl.network
Sat Sep 6 21:50:12 EDT 2014


On 9/6/2014 7:39 PM, Stephen Hoffman wrote:
> On 2014-09-06 22:28:08 +0000, JF Mezei said:
>
>> A couple of comments:
>
> A couple more comments, on the comments...
>
>> ...
>> There are a few subtilities. To exit a program "cleanly" in C, you
>> exit(1)  (exit code of 1 is "success").

> If the OP is not inclined to embed magic numeric constants, then...
>
> exit( EXIT_SUCCESS )
> or
> exit( SS$_NORMAL )
>
> depending on what the OP is doing, and how portable the OP wants or
> needs the C code to be.

JF apparently has not looked at the C programming guide for a while. 
For quite a few versions of VMS, at compile time you set an option as to 
if you use "UNIX" style codes or if you use "VMS" style codes.

The current C compilers for Alpha/Integrity have an option to translate 
the main exit code in the same way, fixing an omission in handling the 
exit status.

> Now as for where JF is going with this comment, the native VMS condition
> status values use an architectred format, and are completely different
> from what you're used to with Unix.  Completely different. The last
> return statement or the exit() will return the status to DCL. Failing
> status codes can abort subsequent processing in a DCL procedure, which
> is again different than the default behavior of a Unix shell script.
> See the Programming Concepts manual.

A common bug in porting Unix programs to VMS is not to set compile time 
options to use POSIX exit codes and pass those codes to DCL.

When you set the compile time options, the UNIX status is properly 
encoded into the DCL status and can be easily recovered.

Regards,
-John
wb8tyw at qsl.network
Personal Opinion Only





More information about the Info-vax mailing list