Skip to main content

Hi Guys and Gals,

This should be a real simple one to resolve.  I'm converting a bunch of Mainframe COBOL to Unix V6.  All is going reasonably well except that when my COBOL program needs to produce an ABEND condition back to the calling shell, it is always the PID or 0.  I do my compiles as cob64 -x foo.cbl -o foo.

Any Suggestions?

Thanks


#COBOLserver

Hi Guys and Gals,

This should be a real simple one to resolve.  I'm converting a bunch of Mainframe COBOL to Unix V6.  All is going reasonably well except that when my COBOL program needs to produce an ABEND condition back to the calling shell, it is always the PID or 0.  I do my compiles as cob64 -x foo.cbl -o foo.

Any Suggestions?

Thanks


#COBOLserver

What do you mean by "produce an ABEND condition back to the calling shell"? Have the process exit with a non-zero exit code? Terminate with a signal? "ABEND" isn't a term defined by UNIX, so you'll have to be more specific.

How are you trying to achieve this in your program? How are you testing the result in the shell?


Hi Guys and Gals,

This should be a real simple one to resolve.  I'm converting a bunch of Mainframe COBOL to Unix V6.  All is going reasonably well except that when my COBOL program needs to produce an ABEND condition back to the calling shell, it is always the PID or 0.  I do my compiles as cob64 -x foo.cbl -o foo.

Any Suggestions?

Thanks


#COBOLserver

Like I said Michael, it was a dumb question.  What I am doing it converting a bunch of Mainframe IBM COBOL programs and when the program foo encounters a certain condition it is supposed to display "ABEND 0004" and return 4 to the calling program.  The culprit here wasn't COBOL;  the shell is doing time foo and then checking $?.  If I do ./foo I get the proper code from foo - if I do time foo, time "hides" the condition.


Hi Guys and Gals,

This should be a real simple one to resolve.  I'm converting a bunch of Mainframe COBOL to Unix V6.  All is going reasonably well except that when my COBOL program needs to produce an ABEND condition back to the calling shell, it is always the PID or 0.  I do my compiles as cob64 -x foo.cbl -o foo.

Any Suggestions?

Thanks


#COBOLserver

OK - glad you sorted that out. What shell are you using? In bash, the built-in time command should propagate the exit code of the child, so for example "time sh -c 'exit 4'; echo $?" displays "4' (after the time report), at least in a quick test I did here. I haven't tried other shells.


Hi Guys and Gals,

This should be a real simple one to resolve.  I'm converting a bunch of Mainframe COBOL to Unix V6.  All is going reasonably well except that when my COBOL program needs to produce an ABEND condition back to the calling shell, it is always the PID or 0.  I do my compiles as cob64 -x foo.cbl -o foo.

Any Suggestions?

Thanks


#COBOLserver

ksh - because we are on Solaris bash isn't as friendly as it should be(?) but since this is new maybe i'll just run it in bash.


Hi Guys and Gals,

This should be a real simple one to resolve.  I'm converting a bunch of Mainframe COBOL to Unix V6.  All is going reasonably well except that when my COBOL program needs to produce an ABEND condition back to the calling shell, it is always the PID or 0.  I do my compiles as cob64 -x foo.cbl -o foo.

Any Suggestions?

Thanks


#COBOLserver

Solaris has two bashes so this is what I had to do

time /usr/xpg4/bin/sh -c "exit 4"

echo "call returns $?"

exit


Hi Guys and Gals,

This should be a real simple one to resolve.  I'm converting a bunch of Mainframe COBOL to Unix V6.  All is going reasonably well except that when my COBOL program needs to produce an ABEND condition back to the calling shell, it is always the PID or 0.  I do my compiles as cob64 -x foo.cbl -o foo.

Any Suggestions?

Thanks


#COBOLserver

That makes sense. Yes, Solaris has both the standard-compliant Bourne shell (in /usr/xpg4/bin) and the traditional Solaris one, which has different behavior.