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
 

 

Restart logic in COBOL and DB2 program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sreenigacc

New User


Joined: 16 Oct 2007
Posts: 15
Location: bangalore

PostPosted: Wed Feb 23, 2011 8:47 pm    Post subject: Restart logic in COBOL and DB2 program
Reply with quote

Hi,

I need some help on restart logic in cobol and db2 program.

For example i have a program, which is reading a file/table and then updating a table. For every 50 records the program is issuing commit.

Now assume that the program gets abend at 63rd record, when we restart the program then the program should start from 51st record instead of starting from the beginning.

Thanks in advacne,
Sreenivasulu
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Feb 23, 2011 8:50 pm    Post subject: Reply to: Restart logic in COBOL and DB2 program
Reply with quote

restart logic must be implemented according to Your organization standards
and not left to the whims of the single developer!
get in touch with the application support team for the requirements and methodologies.
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: Wed Feb 23, 2011 9:00 pm    Post subject:
Reply with quote

Hello,

And if your organization does not already have a recovery/restart process in place, suggest you NOT implement one for this.
Back to top
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Thu Feb 24, 2011 9:01 am    Post subject: Reply to: Restart logic in COBOL and DB2 program
Reply with quote

Hello Mr Dick Scherrer,

I was actually surprised by the suggestion -
Quote:
And if your organization does not already have a recovery/restart process in place, suggest you NOT implement one for this.


I had implemented the below once in a similar scenario:
1. Read a parm file (contains restart count, restart flag, commit count, update timestamp)
2. If Restart Flag is 'Y', read until the restart count and then process. Else start from the first record on the file and process.

Is it not a good idea to use this if the organization does not have a restart process in place ?

-Thanks,
Rakesh.
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: Thu Feb 24, 2011 9:14 am    Post subject:
Reply with quote

Hello,

Due to the incredible increase in cpu speeds and dasd speed, most places that i've supported since before y2k do not implement restart/recovery if it is not already in place on the system. It is faster, safer, less complex, etc, etc, etc to either completely back out the abended run or reload the data to the point before the the problem process and re-run.

One of the problems with adding recovery/restart "on the fly" is that most processes do more than read one input file and update some table(s). There may be other files written to feed external processes, reports and/or summary totals for the run and other things (such as an audit trail). Each of these must also be re-synched for the run to be "complete".
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Feb 24, 2011 12:49 pm    Post subject:
Reply with quote

rakesh1155,

1. restart procedure/process should-must be a site standard process.

2. your idea of the parm file is very primative. I would suggest more research on your part and discover the use of a restart db2 table...
incorporating db2 tables as output for print and or data files simplifies the restart process.
Back to top
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Thu Feb 24, 2011 7:45 pm    Post subject: Reply to: Restart logic in COBOL and DB2 program
Reply with quote

Hello Mr Dick Scherrer,

I assume it (whether to include restart logic or not) would depend on what is needed as part of requirement OR what is the amount of data being updated/inserted into table which will be held into the buffer and a lot of other factors like that.


Hello Mr. dbzTHEdinosauer,

I certainly agree to your point. I am aware of the db2 restart tables and have coded the restart routines in the cobol programs using db2 restart tables.

I mentioned that method where some restart process is NOT in place. And I definitely agree that the parm file method is very primitive. icon_smile.gif

-Thanks,
Rakesh.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Thu Feb 24, 2011 8:03 pm    Post subject:
Reply with quote

Do you think the Parm file contains the last record written after abend?
How will you know where to restart?
Back to top
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Thu Feb 24, 2011 10:02 pm    Post subject: Reply to: Restart logic in COBOL and DB2 program
Reply with quote

Hi GuyC,

We will NOT get the last record updated in database in the parm file, but we are looking for the last record committed in database.

So, after every commit, re-write into the file with the update record identifier or the record count with the restart flag set to 'Y'. While successfully exiting the program, re-write into the file with restart flag = 'N'.

At the start of the program
- Read the PARM file, if restart flag = 'N' then its normal processing from the start.
- If restart flag = 'Y', then read the file until the record identifier found/record count reached. And then continue processing.

Please let me know if my logic doesn't make sense.

-Thanks,
Rakesh.
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: Fri Feb 25, 2011 12:23 am    Post subject:
Reply with quote

Hello,

Quote:
would depend on what is needed as part of requirement

Any "requirement" for this is probably false/artificial. . . Or exaggerated. . .

Quote:
what is the amount of data being updated/inserted into table which will be held into the buffer and a lot of other factors like that
Only very rarely. . . The system/application downtime and people cost of coordinating some conplex restart/recovery "in the middle" often outweighs the machine resources needed to simply re-ren from the beginning.

The real requirement is for a process to be in place to deal with an abended (or other data corrupting) job to be corrected.

The process you describe could possibly work for the most simple situations, but would not for many. If the system already has a standard method for restart/recovery, by all means, consider using it.

Typically a recovery point is after some logical unit of work rather than some number of input records processed. . .
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 641
Location: Whitby, ON, Canada

PostPosted: Fri Feb 25, 2011 2:56 am    Post subject:
Reply with quote

Remember that if DB2 takes 15 minutes to apply your updates, then it may take it twice as long for it back them out when you abend. If you have a very generous batch window you may be able to tolerate that, but you need to take it into consideration when deciding whether or not a process needs to be restartable.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


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