View previous topic :: View next topic
|
Author |
Message |
ajaikumar andy robert Warnings : 1 New User
Joined: 01 Dec 2006 Posts: 23 Location: India
|
|
|
|
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 |
|
|
cobolunni
Active User
Joined: 07 Aug 2006 Posts: 127 Location: kerala,india
|
|
|
|
Are you using cics with your cobol |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
ajaikumar andy robert Warnings : 1 New User
Joined: 01 Dec 2006 Posts: 23 Location: India
|
|
|
|
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 |
|
|
ajaikumar andy robert Warnings : 1 New User
Joined: 01 Dec 2006 Posts: 23 Location: India
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
ajaikumar andy robert Warnings : 1 New User
Joined: 01 Dec 2006 Posts: 23 Location: India
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
ajaikumar andy robert Warnings : 1 New User
Joined: 01 Dec 2006 Posts: 23 Location: India
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Are you sure, your shop doesnt have an inbuilt abend routine... If yes, Check for this... |
|
Back to top |
|
|
Sasi Kiran Patha Warnings : 2 New User
Joined: 19 Nov 2006 Posts: 73 Location: Hyederabad
|
|
|
|
hi this must solve :
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 |
|
|
ajaikumar andy robert Warnings : 1 New User
Joined: 01 Dec 2006 Posts: 23 Location: India
|
|
|
|
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.. |
|
Back to top |
|
|
rkprasanth_m
New User
Joined: 22 Jun 2006 Posts: 44
|
|
|
|
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 |
|
|
|