Return Codes in MVS

I need a way to get the return code from a step and make it available to another step like a system variable.
Can I do that?
For example, if a ADASTRIP or SORT abends, I would like to have the RC available for my next step, that would be a NATURAL PGM keeping track of job abends, reasons, etc.

Thanks

If you have Entire System Server you might be able to scan the system messages to look for the condition code, but I don’t think MVS provides an interface for programs to get this information directly, so Natural won’t have a way.

Carlos,

You can’t use “system” variable to keep the return code, as the next step will be a new natural session. Maybe you could do something like this:

//STEP1
//cmwkf01 dd &&temp,disp=(new,pass)

//STEP2
//cmwkf01 dd &&temp,disp=shr

In the natural program that executes in step1, have

on error
write work 1 *error-nr
end-error

and just before the end of the program, do a
write work 1 #zero

Then the second program can read the work file 1.

By the way Carlos, are you a guy from brazil that use to work for the Florida Community College Software Consortium?

Bruce Spratling
Database Administrator
Specialized Transportation, Inc.