Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sample code for USER ABEND routine

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
subhadeep_infy

New User


Joined: 06 Mar 2006
Posts: 10

PostPosted: Mon Mar 06, 2006 12:30 pm    Post subject: Sample code for USER ABEND routine
Reply with quote

Hi,
I need a piece of code to write an user abend routine. Can anyone please help.

Thanks,
Subhadeep
Back to top
View user's profile Send private message

Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 464

PostPosted: Mon Mar 06, 2006 12:48 pm    Post subject: Re: Need sample code for USER ABEND routine
Reply with quote

HI Subhadeep

Welcome to Forum,,

Could you please elaborate your problem...

Regards
Rupesh
Back to top
View user's profile Send private message
subhadeep_infy

New User


Joined: 06 Mar 2006
Posts: 10

PostPosted: Mon Mar 06, 2006 2:20 pm    Post subject: Re: Need sample code for USER ABEND routine
Reply with quote

Hi Rupesh,
I'm creating an abender routine which will be called by any particular program when it tries to abend due to any specific conition. This will be a User defined abend with the appropriate abend message passed from the program. I hope this helps your query.

Thanks,
Subhadeep
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Mar 06, 2006 3:54 pm    Post subject:
Reply with quote

USER-ABEND-ROUTINE SECTION.

MOVE SQLCODE TO WS99-SQLCODE.
DISPLAY 'UNEXPECTED SQL CODE OCCURRED ' WS-SQLCODE.
DISPLAY SQLERRMC.
DISPLAY 'PROGRAM NAME ' WS99-PROG-NAME.
DISPLAY 'PARA NAME ' WS99-PARA-NAME.
DISPLAY 'TABLE NAME ' WS99-TABLE-NAME.
IF WS99-SQLCODE = -904
OR WS99-SQLCODE = -911
DISPLAY 'FAILURE CAUSED BY DEADLOCK/TIMEOUT'
EXEC SQL
ROLLBACK
END-EXEC
MOVE 13 TO RETURN-CODE
STOP RUN.
IF WS99-WARNING
GO TO USER-ABEND-ROUTINE-END.

USER-ABEND-ROUTINE-END SECTION.
EXIT.

Declare all the necessary variables in the copybook and the needed error routines.
Hope this helps.If no get back.

Thanks,
KS
Back to top
View user's profile Send private message
subhadeep_infy

New User


Joined: 06 Mar 2006
Posts: 10

PostPosted: Mon Mar 06, 2006 5:35 pm    Post subject: Re: Need sample code for USER ABEND routine
Reply with quote

Thanks Kutti,
Actually I've employed a similar logic in my code and it is working fine. But can we have anything which will give a system flush for the error code as well as the message ( similar to CEE3ABD abend routine). Currently for this particular piece of code we'll just receive a MAXCC code of 13 if the SQLCODE is -904 and then the program will stop running.

Regards,
Subhadeep
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Tue Mar 07, 2006 9:53 am    Post subject:
Reply with quote

Syntax - CEE3ABD(abcode,cleanup)

Clean-up can take wo values :
0 - Abend issued without clean-up.
1 - Abend with normal termination.

Ex-
WORKING-STORAGE SECTION.
01 ABCODE PIC S9(9) BINARY.
01 TIMING PIC S9(9) BINARY.
PROCEDURE DIVISION.
PARA-ERROR.

MOVE 904 TO ABCODE.
MOVE 0 TO TIMING.
CALL "CEE3ABD" USING ABCODE,TIMING.
GOBACK.

Hope this helps.For more info, refer our manual.

Thanks ,
KS
Back to top
View user's profile Send private message
subhadeep_infy

New User


Joined: 06 Mar 2006
Posts: 10

PostPosted: Tue Mar 07, 2006 11:10 am    Post subject: Re: Need sample code for USER ABEND routine
Reply with quote

Hi Kutti,
The piece of code posted by you calls the routine CEE3ABD. BUt I require the functinality acquired by CEE3ABD. For eg the "code" of CEE3ABD or any other abend routine or any alogorithm which is being used by such abend routines. I tried abending the program by dividing 1 by 0 but in this case, the functionality before the division is not processed.
e.g.
DISPLAY ' HI'
DIVIDE 1 BY WS-ZERO GIVING WS-ABEND.

where WS-ZERO contains zero.

In This case the output is not showing 'HI' before abending.

Thanks ,
Subhadeep
Back to top
View user's profile Send private message
subhadeep_infy

New User


Joined: 06 Mar 2006
Posts: 10

PostPosted: Tue Mar 07, 2006 2:23 pm    Post subject: Re: Need sample code for USER ABEND routine
Reply with quote

Hi,
I've created an USER ABEND routine using the Algo Divide 1 by 0 as described in my previous post. Though it doesn't throw a user abend message as done by CEE3ABD, but it can be used nevertheless. If anyone has any knowledge about any other Algo please post the same.

Thanks,
Subhadeep
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm
No new posts User Cancels the job PANDU1 DB2 1 Sat Mar 04, 2017 8:21 pm
No new posts CA Workload Automation event code help vinu78 CA Products 10 Wed Mar 01, 2017 10:05 am
No new posts MAX-RC 88 and Return code 606 in DFH0... lind sh CICS 2 Tue Jan 24, 2017 1:23 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us