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

Handling Operator/User Cancelled Job Return Code in Cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gotlamitla

New User


Joined: 31 Oct 2006
Posts: 11

PostPosted: Mon May 12, 2008 12:38 pm
Reply with quote

Hi,

I want to save the data written to file even the operator/user cancelled the job forcefully.

Following was the scenario..

In the begining of the cobol program I opened 3 files (Input/Output/Error).

As per the logic, All the files will be closed only at the End of the Input file is reached.

Assume I had 100 records in input file.

While reading the records sequentially upto 40 records, I already occured 5 error records.

So by this time I written 35 records to output file. 5 records to error file.

At this point of time user/operator cancelled the job forcefully. The abend might be S222/S522.

When I check the datasets cataloged in JCL, The output/Error files were empty. This is because the records were written
to the output datasets and the files were not closed.

Is there any way I can handle the unexpected Operator/Job Cancellation return codes S222/S522 handling in cobol.

In the above scenario, even though the job was cancelled by the operator/User I still want to save the data as
35 records written to output file and 5 records written to output file.

Please help out in the above scenario.

Thanks & Regards,
Gotlamitla.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon May 12, 2008 12:42 pm
Reply with quote

Hello,

Please post the jcl for this step of the job.

For my $.02, the operator should not normally cancel jobs. If a job needs to be canceled for some reason, the data usually needs to be re-run from the beginning.
Back to top
View user's profile Send private message
mytags

New User


Joined: 28 Apr 2008
Posts: 63
Location: US

PostPosted: Mon May 12, 2008 12:46 pm
Reply with quote

Hi,
You can specify the Disposition as cataloged in normal and abnormal terminations,So you can check your out put.Using some tools like Abend-aid you can easily locate this errors,if it is so tedious to track the programs.You can also check the class.
Thanks,
Hari
Back to top
View user's profile Send private message
gotlamitla

New User


Joined: 31 Oct 2006
Posts: 11

PostPosted: Mon May 12, 2008 2:28 pm
Reply with quote

dick scherrer wrote:
Hello,

Please post the jcl for this step of the job.

For my $.02, the operator should not normally cancel jobs. If a job needs to be canceled for some reason, the data usually needs to be re-run from the beginning.


Hi,

In the same scenario, If am updating the database for each read from the input file and also performing commit after each update, there will be some mismatch with the database updates happened and the number of records written to the output file.

For each input record read, I thought of open/write/close the output/error files. It seems to be this will work.

I need some other way to handle the above scenario to handle S222/S522 Abends from Cobol code/Any other utilities.

Please let me know ur suggestions/ideas.

Thanks & Regards,
Gotlamitla.
Back to top
View user's profile Send private message
Atul Tamboli

New User


Joined: 12 May 2008
Posts: 3
Location: Pune, India

PostPosted: Mon May 12, 2008 5:45 pm
Reply with quote

I don't think it is a good idea to open/close file for each record if you are concerned with the performance of the job.

When you say there is a mismatch between the records updated in database and records written to the file, is there a consistency. What I mean is - Are the number of records written in the file always less/more/1 less, etc?

Explicit closing of files is also not required, though recommended. So losing entire data (if already written to the file) due to a job failure seems strange.

If you have the set up available in test, I would recommend put displays after each write statement is executed then cancel the job. Then cross check the display and the actual records in the file.

So long the database updates are concerned, they should not be lost if your checkpoint logic is correct.

Taking a look at your JCL may be helpful.

Thanks,
Atul.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon May 12, 2008 7:03 pm
Reply with quote

As I recall, the system abend routines close all open files thereby emptying the buffers and making all O/P data available at EOJ. Use ,CATLG,CATLG as Hari suggested and you s/b able to access your data.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts run rexx code with jcl CLIST & REXX 15
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Compile rexx code with jcl CLIST & REXX 6
Search our Forums:

Back to Top