View previous topic :: View next topic |
Author |
Message |
cxvxbx Beginner
Joined: 26 Apr 2006 Posts: 16 Topics: 8 Location: Utopia
|
Posted: Fri Aug 31, 2007 4:18 am Post subject: Abend code & return code |
|
|
I have a few basic questions -
1. What is the need to abend a program? The same (program stop) functionaliy can be achieved via a 'stop run' and a appropriate 'return-code' (to indicate an error). So, what's the use of abending any program. Is there any use other than getting memory dumps ?
2. how is an abend code different from a return code ?
Any answers or pointers to answers will be of great help. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri Aug 31, 2007 4:40 am Post subject: |
|
|
cxvxbx,
An abend (abnormal & end put together) is an abnormal, rather than planned, unexpected,end or termination of a computer program because of some problem with how it is running. For example, the program may have attempted to address some computer memory space that it was not given the right to address.
An abend usually refers to the abnormal end of an application program because of application errors. A simple abend is divide by zero. We can handle this abend in the code itself and if the code does not handle, you will end up with an abend.
The RETURN-CODE special register can be used to pass a return code to the calling program or operating system when the current COBOL/PLI program ends. When a program ends:
If control returns to the operating system, the value of the RETURN-CODE special register is passed to the operating system as a user return code. The supported user return code values are determined by the operating system, and might not include the full range of RETURN-CODE special register values.
If control returns to a calling program, the value of the RETURN-CODE special register is passed to the calling program. If the calling program is a COBOL program, the RETURN-CODE special register in the calling program is set to the value of the RETURN-CODE special register in the called program.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Fri Aug 31, 2007 9:14 am Post subject: |
|
|
Just to expand a little on Kolusu's explanation. You can achieve the same results by issuing a user abend or issuing a stop run with a return code. However the user abend will terminate the job unless you have conditional statements to run certain steps in the event of an abend. You'd need to put conditional statements into your JCL to flush remaining steps based on a return code. |
|
Back to top |
|
|
|
|