abend a program



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

abend a program

Postby vaishalisingh » Mon Aug 24, 2009 1:40 pm

how can we abend a particulare program if it does not satisfies a particular condition ?
vaishalisingh
 
Posts: 5
Joined: Mon Aug 24, 2009 1:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: abend a program

 

Re: abend a program

Postby MrSpock » Mon Aug 24, 2009 5:31 pm

You can try something like this:
       IDENTIFICATION DIVISION.                   
       PROGRAM-ID. ABEND.                         
                                                   
       ENVIRONMENT DIVISION.                       
       INPUT-OUTPUT SECTION.                       
                                                   
       DATA DIVISION.                             
       FILE SECTION.                               
                                                   
       WORKING-STORAGE SECTION.                   
       01  ABCODE PIC S9(9) BINARY.               
       01  TIMING PIC S9(9) BINARY.               
                                                   
       PROCEDURE DIVISION.                         
           MOVE ZEROS TO RETURN-CODE.             
           MOVE 904 TO ABCODE.                     
           MOVE 0 TO TIMING.                       
           CALL 'CEE3ABD' USING ABCODE,TIMING.     
           STOP RUN.                               
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: abend a program

Postby vaishalisingh » Tue Aug 25, 2009 11:26 am

thanks for the reply.. but the condition is we cannot call any routines.. eg.. i have a condition that if the id no of employee is more then 6 then immediately my program should abend.. how can we do this ?
vaishalisingh
 
Posts: 5
Joined: Mon Aug 24, 2009 1:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: abend a program

Postby dick scherrer » Wed Aug 26, 2009 3:48 am

Hello,

but the condition is we cannot call any routines.
Nonsense! If whatever passes for management will not allow calling a standard abend routine, then an abend is not needed. The whole purpose of User abends (as opposed to system abends) is to provide something meaningful to the people who must correct the problem. If an id greater than 6 is used to cause a s0c7, it is really pathetic. . .

Suggest you settle for setting a condition code that is treated as a problem by the following jcl and/or the scheduling software.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: abend a program

Postby n459760 » Tue Oct 13, 2009 8:17 pm

Dick is correct. A requirement like should not be a cause to abend a routine. Ideally, you must write those error records into an error file with appropriate message for reviewers to review and fix.

However if you still want to abend a program for no reason then just move a return code greater than 8 to RETURN-RC (Do not define this field in COBOL). Your program should abend.
n459760
 
Posts: 6
Joined: Tue Oct 13, 2009 7:06 pm
Has thanked: 0 time
Been thanked: 0 time

Re: abend a program

Postby MrSpock » Tue Oct 13, 2009 8:21 pm

How would that:

A. Allow the program to successfully compile and

B. Cause an abend?
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: abend a program

Postby n459760 » Wed Oct 14, 2009 6:11 pm

MrSpock,
I am not sure if your question is for me but:
A. Yes, the program will successfully compile because its just code. You are not introducing a syntax error in code when you specifically move a value to RETURN-RC.
B. It will cause an abend based on a particular condition reached (please see original post when the length of particular field is less than 6).
n459760
 
Posts: 6
Joined: Tue Oct 13, 2009 7:06 pm
Has thanked: 0 time
Been thanked: 0 time

Re: abend a program

Postby dick scherrer » Wed Oct 14, 2009 11:45 pm

Hello,

(please see original post when the length of particular field is less than 6).

I see nothing like this in the original post . . .

I have no idea how A above relates to the question :?

It will cause an abend based on a particular condition reached
What will cause an abend?

Most confusing. . .

Please re-read the original request and explain how any return-code can cause an abend (Hint - it will/can NOT). . . Abends are Sxxx (Syatem) or Unnnn (User). A return-code is never an abend. . . It may signify a problem, but it is not an abend.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: abend a program

Postby n459760 » Thu Oct 15, 2009 2:55 am

Dick,
I did a mistake of re-wording it. See the message from vaishalisingh " thanks for the reply.. but the condition is we cannot call any routines.. eg.. i have a condition that if the id no of employee is more then 6 then immediately my program should abend.. how can we do this ?"

Yes, I understand there are system and user abends but what I am giving an example of what I meant so that there it does not appear to be confusing:

IF LENGTH OF EMP_ID > 6
MOVE 12 TO RETURN-CODE
SET ERROR-SW TO TRUE
END-IF

While processing further if an error report needs to be written for this INVALID ID then the programmar should code accordingly.

What is being translated/interpreted as an abend by the original poster as well as my second reply above relates more to coding that the programmar is trying to accomplish.
n459760
 
Posts: 6
Joined: Tue Oct 13, 2009 7:06 pm
Has thanked: 0 time
Been thanked: 0 time

Re: abend a program

Postby dick scherrer » Thu Oct 15, 2009 3:21 am

Hello,

We need a better answer from vaishalisingh . . .

The original post says an abend is needed. Setting a return-code is not an abend. It might indicate something fatal has happened, but it is not an abend. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post