View previous topic :: View next topic
|
Author |
Message |
sreenigacc
New User
Joined: 16 Oct 2007 Posts: 15 Location: bangalore
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
rakesh1155
New User
Joined: 21 Jan 2009 Posts: 84 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
rakesh1155
New User
Joined: 21 Jan 2009 Posts: 84 Location: India
|
|
|
|
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.
-Thanks,
Rakesh. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Do you think the Parm file contains the last record written after abend?
How will you know where to restart? |
|
Back to top |
|
|
rakesh1155
New User
Joined: 21 Jan 2009 Posts: 84 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
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 |
|
|
|