IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How can we abort a Job directly from COBOL ?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Tue Dec 12, 2006 10:17 am
Reply with quote

hi

i need to know how we can abort a job directly from cobol..
i.e if a field in cobol is non-numeric or if it contains null values then i need to abort the job from further execution.

Title changed from "Direct Abort Codes in Cobo.. Very Urgent.." to "How can we abort a Job directly from COBOL ?" : Priyesh.
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Tue Dec 12, 2006 10:19 am
Reply with quote

Are you using cics with your cobol
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue Dec 12, 2006 10:21 am
Reply with quote

Quote:
i need to know how we can abort a job directly from cobol..

You can abort the execution for that perticular program or step; but for further steps you can use COND parameter to check Return Code generated by this program and execute remaining step based on that.
Quote:
i.e if a field in cobol is non-numeric or if it contains null values then i need to abort the job from further execution..

Your shop must be having some abend routine with specific user abend codes to halt execution of the program.
Quote:
please respond immediately.. it is very urgent for me..

If you are really serious above, dont you have some Tech Desk @ Work...
Back to top
View user's profile Send private message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Tue Dec 12, 2006 10:28 am
Reply with quote

no i dont sue CICS.. only cobol and JCL..
i need to abort the job in the cobol pgm step itself if there are any non-numeric values in the fields..
Back to top
View user's profile Send private message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Tue Dec 12, 2006 10:45 am
Reply with quote

i dont have any tech help desks here.. i need to abort the cobol pgm alone.. rest of the steps i can do as you said.. if i find a field with unacceptable values or undesirable values then i should be able to set a particular code and the job should stop there showing that code..
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue Dec 12, 2006 10:57 am
Reply with quote

Code:
IF WS-VARIABLE = 'unacceptable values'
    DISPLAY 'I GOT AN UNACCEPTABLE VALUE: 'WS-VARIABLE
    DISPLAY 'PROGRAM IS GOING TO ABEND'
    DIVIDE 9 BY 0.


It'll abend execution of the program and Job, and would show the unacceptable value at the same time.
And you dont need to code any COND parameter in the JCL for further steps, as it would generate a S0C-7, which would cause job to get abended there itself.
Is that what you want to do.
Back to top
View user's profile Send private message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Tue Dec 12, 2006 11:03 am
Reply with quote

thanks for the reply priyesh..

but i cant stop the pgm with a SOC7 error.. what is need is this..

i.e if there is a numeric field AMOUNT, and if it gets a non-numeric field as input,
I should be able to set an abort code, say 2232 and abort the job at that step itself..
THE PGM SHOULD ABORT WITH THE CODE..
THEN REQUIREMENT IS TO KNOW WHY THE PGM ABENDED AND FOR THIS WE SET AN ABORT CODE..
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue Dec 12, 2006 11:09 am
Reply with quote

Quote:
I should be able to set an abort code, say 2232 and abort the job at that step itself..

You can set a Non-Zero Abend code and pass onto JCL from program using RETURN-CODE register value. but then it would not cause program and that step to be abend. In this case, you'll have to code some proc in JCL to abend the execution of the job instead of program.
Code:
MOVE <YOUR RC> TO RETURN-CODE.
Back to top
View user's profile Send private message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Tue Dec 12, 2006 11:13 am
Reply with quote

TATS FINE WHEN I ONLY ONE FIELD.. BUT I HAVE MORE THAN ONE FIELDS WHICH CAN HAVE NON NUMERIC VALUES.. SO I CANT SET THE RETURN CODE TO THEM.. IS THERE SOME OPTION LIKE CHECKING THE FIELD AND CALLING A PARA TO ABEND THE PGM DISPLAYING THE ABEND CODES FOR THAT COND?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Tue Dec 12, 2006 11:18 am
Reply with quote

Are you sure, your shop doesnt have an inbuilt abend routine... If yes, Check for this...
Back to top
View user's profile Send private message
Sasi Kiran Patha
Warnings : 2

New User


Joined: 19 Nov 2006
Posts: 73
Location: Hyederabad

PostPosted: Tue Dec 12, 2006 12:24 pm
Reply with quote

hi this must solve icon_smile.gif :

declare in Working storage section :

01 ABORT-JOB-CODE PIC S9(4) COMP VALUE +4004.

Note : Value can be greater than 4000 for abending.

In the Procedure division :

MOVE ABORT-JOB-CODE TO RETURN-CODE.

this will abend the CA7.... try out and let us know...

regards,
Sasi Kiran Patha.
Back to top
View user's profile Send private message
ajaikumar andy robert
Warnings : 1

New User


Joined: 01 Dec 2006
Posts: 23
Location: India

PostPosted: Tue Dec 12, 2006 2:24 pm
Reply with quote

Hi

thanks for all your replies..

I got the answer for that problem..

In my cobol pgm itself we declare some variables which will give the pgm status..
In that there is a 88 level variable called pgm-abend..
Any values can be set to that variable and the pgm will abend with that value..
priyesh as you said the CEE3ABD abend is available in my pgm itself..
thanks for all the replies..

So prob solved.. icon_lol.gif
Back to top
View user's profile Send private message
rkprasanth_m

New User


Joined: 22 Jun 2006
Posts: 44

PostPosted: Tue Dec 12, 2006 4:00 pm
Reply with quote

COBOL itself comes with a standard abend routine. You can can simply call that routine and pass abend code and reason code as parameters. Just checkout manuals.

The abend code and reason code you are using should be unique and should know everybody in your shop. So you must document it so even operations support folks would know..
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
No new posts Compile Sp Cobol base COBOL Programming 1
No new posts SQLCODE=-311 in Cobol SP-DB2. COBOL Programming 2
Search our Forums:

Back to Top