Calling DCL from bash returns 1 on success

This came up as a side issue in my earlier question about running make, but since it's such a fundamental issue, I thought I'd make it its own topic.

Here is the issue. I am running GNV bash and calling some DCL commands using the DCL command. Bash captures the return value from each command that it invokes. Typically, a command that runs successfully returns an error code of 0.

Re: Calling DCL from bash returns 1 on success

Mixing environments is always fun. Easiest approach? Don't mix environments. Go trigger something that does the OpenVMS parts for you, as a hunk. Trigger a make sequence that runs (entirely) in the OpenVMS context, for instance, and that returns 0 or non-zero as appropriate.

Or rebuild the DCL command in bash, if the source code is available. You'll want to map all odd values to zero here, if you take that route. Odd being success, in OpenVMS, and thus any odd value would map to zero. (I'm kinda surprised there isn't a switch on DCL to flip this. But then wildcards might not work as expected here, either.) (And the DCL command is far from the only bash command around that returns non-zero on success.)

Otherwise expect to get this stuff back here from OpenVMS. You should never get a zero status value back from an OpenVMS process.

Re: Calling DCL from bash returns 1 on success

This is normal behaviour - for DCL. ANY odd value is non-error. Even values signal a condition - warning, error or fatal. This is fundamentally different from *x where you hacve just success (0) of some other value - it could be an error or it isn't.

The environments differ so you should take that into account, and the easy way out is "don't mix". "make" is a Unix-based program so run it in bash and use "ls" (with appropiate switches). in DCL, use MMS of MMK or wahever VMS-based tool you are comfortable with.

Re: Calling DCL from bash returns 1 on success

Thanks everyone. Yes, using - in the makefile to ignore the return value is effective, but since I didn't totally want to ignore the return value if there is an error, I wrote this short little bash script that converts all odd return values to 0 return value.