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

Restart the file from abended records not from the begening


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

New User


Joined: 23 Oct 2009
Posts: 4
Location: Hyderabad

PostPosted: Mon Mar 28, 2011 2:59 pm
Reply with quote

Suppose one of my program is reading a file which contains 10,000 records and writing to another output file,it got abend after processing 500 records.I need to restart the program so that it will start processing of records from 501 records not from the begening.So what would be my code insite the program so that it will process the record from 501 record.

Thanks
Pratap
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Mar 28, 2011 3:10 pm
Reply with quote

The restartability of any program depends entirely on what it is doing, what it has done up to and including the point of abend.

So without a heck of a lot more details from you the question is impossible to answer.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Mar 28, 2011 3:15 pm
Reply with quote

Unless your program was written from scratch to handle this type of restart scenario, you most likely cannot do so now. The program has to have a way to identify which record to restart from, read and ignore that many input records, and so forth. The logic is not complicated but unless the program was written this way it is usually not worth the effort to go back and add the logic.

Furthermore, most sites have decided the cost of rerunning the entire job (especially for such a small record count) doesn't justify adding restart logic into the code these days.
Back to top
View user's profile Send private message
Tunaj

New User


Joined: 23 Oct 2009
Posts: 4
Location: Hyderabad

PostPosted: Mon Mar 28, 2011 3:43 pm
Reply with quote

How I will write the logic(Code in cobol) in the program so that it will read and bypass the 500 record and start processing from 501 record.I am not geting any idea how to code.if someone will help me in code it will be great.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon Mar 28, 2011 3:46 pm
Reply with quote

You should definitely not write your own logic for rolling back changes since last commit point, and positioning into datasets at restart.

If your site has IMS, you could use IMS checkpoint/restart to handle this.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Mar 28, 2011 3:52 pm
Reply with quote

if You cannot by Yourself discover/imagine that You need to initialize a counter, read one record, increment the counter, keep reading until the counter is equal to the <restart> record (*)
You do not have a place in IT!

(*) a PERFORM might be another approach... but I do not speak COBOLESE, and I might be wrong
Back to top
View user's profile Send private message
vadim vashchenko

New User


Joined: 21 Mar 2011
Posts: 13
Location: usa

PostPosted: Mon Mar 28, 2011 5:39 pm
Reply with quote

Tunaj wrote:
How I will write the logic(Code in cobol) in the program so that it will read and bypass the 500 record and start processing from 501 record.I am not geting any idea how to code.if someone will help me in code it will be great.


I am getting old - I can not understand your problem. Rewrite a "restart" dataset with every processed record and re-start updating from the saved record. You also can save a count. The "restart" dataset could be anything: a flat, DB2 table and so on. :)
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon Mar 28, 2011 6:16 pm
Reply with quote

Checkpoint/restart is not a simple task. You have to control writing to sequential output files so that you are able to roll back changes done since last checkpoint if an abend occurs. Likewise, database updates should be syncronised, committed in checkpoints.

Positioning your input dataset is just one of these challenges. Usually, relative block address (RBA) is used to track position in a sequential dataset.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Mar 28, 2011 10:21 pm
Reply with quote

If its just a situation like this :

old master + updates = new master (old master in the following run) :

then make a copy with for example of your update file skipping the first 500 records, and do a rerun with your new update file.

And yes this kind of nonsense worked around 40 years ago when nobody had heard about any kind of totals to check if the update process was valid.

And kjeld ims has nothing to do with this, i didnt see anything related to ims. Restart logic for normal batch update programs is quite another story.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Tue Mar 29, 2011 4:11 am
Reply with quote

PeterHolland wrote:
And kjeld ims has nothing to do with this, i didnt see anything related to ims. Restart logic for normal batch update programs is quite another story.

Just for info, we have been using IMS BMPs and DBBs for many years at my installation for their checkpoint/restart facilities, even though TP nowadays is handled by CICS.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Mar 29, 2011 1:44 pm
Reply with quote

This link could help :

publib.boulder.ibm.com/infocenter/ratdevz/v7r6/index.jsp?topic=/com.ibm.ent.cbl.zos.doc/topics/PGandLR/concepts/cpchk02.htm
Back to top
View user's profile Send private message
Peter Nancollis

New User


Joined: 15 Mar 2011
Posts: 47
Location: UK

PostPosted: Wed Mar 30, 2011 5:07 am
Reply with quote

Guys the question asked was
"I need to restart the program so that it will start processing of records from 501 records not from the begening"

enrico hit the mark ....

Outputs havent even been considered
Too simplistic for words
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Mar 30, 2011 10:27 am
Reply with quote

do a right click and save this pdf and then read it:
pdf with restart logic
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top