How to deliberately give up work

Is it possible to deliberately keep your work through the COBOL program. Suppose I have an input file with entries for headers, parts, and trailers. I will write COBOL pgm which reads this file. If no detailed records are found in this file, I want me to give up my work by providing some Abend Message and some Abend Code. Is it possible?

+5
source share
5 answers

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.

+8
source

see the following link on how to set the return code returned to the JCL job step and also force the code to be deleted. http://www.tek-tips.com/viewthread.cfm?qid=1058302&page=22

+3
source

First, you should check what is accepted in accordance with the working standards of your own store / site. Most teams already have an acceptable way to deliberately keep a program for a โ€œlogicalโ€ reason. One company I worked with has a very simple program called SYSABND2, which, it seems to me, is written in assembly language, which is simply called to cancel the program.

However, for ABEND (and not just for the return code) you must call the CEE3ABD module (or a previous version of ILBOABN0 , which is now deprecated).

See details

+2
source

One way to complete the abnormal end of a run is to output a message to the user terminal or to the operator in the mainframe computer center and, possibly, to the printer, if necessary, all depending on the type of computer in which the program should be run on. In kobol, you can use DISPLAY UPON .. and use the identifier of the terminal, operatorโ€™s console or printer, as defined in the entry in the SPECIAL ENVIRONMENTAL NAMES section. An example may be similar to this, using the correct device names for your case OPERATOR-CONSOLE IS OUT-OP2 in special names with DISPLAY "RUN ERROR - NO DETAIL RECORDS, ABORTING" UPON OUT-OP2 and DISPLAY "OPERATING MANAGER REPORT" VOLTAGE OUT-OP2 and STOP RUN. in the separation procedure. A reference to this circumstance should be included in any task or macro and operating instructions.

0
source

Yes, you can intentionally evade your work through the COBOL program simply by calling one module that does not exist. It will give the code S806 abend.

0
source

Source: https://habr.com/ru/post/1314514/


All Articles