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
 

 

Handling Operator/User Cancelled Job Return Code in Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Handling Operator/User Cancelled Job Return Code in Cobol
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

Site Director


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

PostPosted: Mon May 12, 2008 12:42 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


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