Want to change your program or just set a return code ?
I suspect that setting RETURN-CODE, writing a message, and then ending the program via STOP RUN or GOBACK is all you really want to do. Causing the actual ABEND may not be required.
In the IBM RETURN-CODE package environment installed by your program, it becomes RC for the JCL job phase under which the program was run. This is usually what you want to install and verify.
RETURN-CODE set using a MOVE numeric value. For instance:
DISPLAY 'No Detail Records found in file.' MOVE 16 TO RETURN-CODE GOBACK.
You can also dump a program from a program running in the Language Environment (IBM Mainframe Option) using CEE3DMP - Create a dump utility.
In older IBM Mainframe COBOL programs, you could see calls to the ILBOABN0 routine. This call left your program and issued a dump. This procedure is now outdated in favor of the Technique outlined above.
Finally, really old programs may contain code for generating alarms. This can be done in any number of ways, but dividing by zero was often a favorite:
DIVIDE SOME-NUMBER BY ZERO GIVING SOME-NUMBER.
It works every time!
Personally, I recommend installing RETURN-CODE instead of calling ILBOABN0 or data exclusion methods.
Note: The special RETURN-CODE register is not part of the COBOL-85 standard. It is available as an IBM language extension. You may need to resort to another mechanism if you are working in an environment that is not compatible with IBM.
Nealb source share