Joined: 20 Oct 2006 Posts: 6968 Location: porcelain throne
let us correct terminology, and perhaps you can find the answer:
the DISP parameter for the JCL DD Statement.
you have a JOB step.
a JOB step defines some activity to the op-system.
in this case it is execution of a COBOL program,
which has an output dataset defined as a GDG
with disp parms of new,cat,del.
now, not JOBS, not STEPs, not even programs fail due to negative SQL return codes.
what action your program takes when it receives a -904 SQL code,
only your program can tell you.
what action does the program take, when it recieves a -904?
only an abend of the program will cause the DELETE action of the DISP parm to activate.
a non-zero return code of a program is not an abend.
if your program does not abend
(now could be a good time to read about abnormal termination of a program and learn what the op-system considers an ABEND to be.)
then you need a following step, which interrogates the return-code of your program, and take appropriate action - i.e. delete the output file of the COBOL program.
Joined: 26 Apr 2004 Posts: 4650 Location: Raleigh, NC, USA
If a job step abends, then any dataset created in that step with a (NEW,CATLG,DELETE) disposition should be scratched. That is the definition of the DELETE parameter in that case. I'm not aware of any reason that a GDG would not follow this rule.