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

How to Restart from particular record


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vadivem

New User


Joined: 08 May 2006
Posts: 24
Location: pune

PostPosted: Tue Nov 20, 2007 1:49 am
Reply with quote

Hi All,

I had requirement like this after fetching and subsequent insertion of 100 records the program get abended but the fetching table contains 1000 records.

So how to restart from 101-th record please give me the solution with example codes.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Nov 20, 2007 2:14 am
Reply with quote

Has your program done any commits.

If NO then you will have to fix the abend cause and rerun.

If YES then you will have to have someway in your program to determine that it is a restart and where it should restart from. Check with others on your project and find out what is accepted practice for this.
Back to top
View user's profile Send private message
vadivem

New User


Joined: 08 May 2006
Posts: 24
Location: pune

PostPosted: Tue Nov 20, 2007 2:46 am
Reply with quote

Yes after insertion we have commits but it has not implemented yet. tel us how to implement commit along with restart logic.
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: Tue Nov 20, 2007 8:54 am
Reply with quote

Hello,

Until your group defines how restart will be supported across the environment or the application, i'd suggest you comment out the commit statements. When there is an abend, the work to that poit will be backed out (and yes, if it is a high volume, it will take a while).

Once you have designed your restart/recovery strategy, you can activate the commits as you incorporate the restart processing.

Someone here in the forum cannot effectively determine your strategy. Once you have a plan in place, we may be able to offer suggestions if there are questions.
Back to top
View user's profile Send private message
vadivem

New User


Joined: 08 May 2006
Posts: 24
Location: pune

PostPosted: Tue Nov 20, 2007 9:53 pm
Reply with quote

In my application each and every program must need to incorporate the commit and restart logic because almost all the programs does updates and insertions.

So some one can help me out how to incorporate?
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: Tue Nov 20, 2007 10:52 pm
Reply with quote

Hello,

Please re-read my previous reply.

While restart logic may be needed in "each and every program", each should not be treated as a new challange.
Your organization/project team needs to decide how restarts will handled cross the project. When you are going to restart bacth processes, ther is more to it than just doing the proper database processing. Any sequential files being created, any reports being created, any accumulated totals in these processes need to be considered.

Once you/your organization make a plan and determine your needs, we may be able to offer suggestions. We cannot establish the rules for your system - that needs to be determined there.

Due to the time it takes to "start from scratch" to create a restart methodology and due to much faster machines/database engines, the decision has been made in many applications to forego checkpoint/restart processing. In the rare event of an abend, it is often faster to simply restart the abended from the beginning (after the backout completes).
Back to top
View user's profile Send private message
vadivem

New User


Joined: 08 May 2006
Posts: 24
Location: pune

PostPosted: Tue Nov 20, 2007 11:22 pm
Reply with quote

Thanks for your response I agree with your suggestion as per my client intimation I need to incorporate restart logic. the scenario like this...

I am fetching data from 'A' table according certain match condition the table 'B' will be inserting the records but after records fetching and inserting the program has been abend due to data problem.

Now tel me solution for this one program? please don't think about total system and applications because my client won't worry about databases,cost as well.
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: Wed Nov 21, 2007 3:43 am
Reply with quote

Hello Vadie,

Quote:
Now tel me solution for this one program?
Unfortunately, good communication/understanding is not happening. We'll keep trying until we get it icon_smile.gif

Whether the restart methodology is for only this program or some larger set of processes, the "rules" still must be defined.

For example, restarts typically proceed from the last point the environment was stable. This point is known as the end of a logical unit of work (luw). Someone has to define what a luw will be for this program - we can't do that here as we know nothing about the process. Someone has to decide how you will manage restart info - i.e. how will the code know this is a restart and where will the restart begin?

As i mentioned before, if this program does anything more than simply read "A" rows and selectively insert "B" rows, that will need to be considered as well. For example, if the process produces statistics of any kind (say record counts), these need to be handled in a restart.
Back to top
View user's profile Send private message
vadivem

New User


Joined: 08 May 2006
Posts: 24
Location: pune

PostPosted: Wed Nov 21, 2007 5:12 am
Reply with quote

Hello Dick,

In my application no one has been defined how to defined the restart and where to include the restart so we have to defined the restart logic.

The program which I specified nothing is doing apart from reading and inserting.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Nov 21, 2007 7:27 am
Reply with quote

Then why even separate the read and insert? If you are doing no processing on the data and writing to only one table, your program is waste of time to write. DB2 could handle this with no program logic wrapped around it. Then the only way it would abend is on a Timeout (which would auto rollback) or a failure of DB2 (which means you have more problems than you as a programmer want to deal with). Restarts handled, just start from the top again either way.

INSERT INTO TABLEB SELECT xxxxxx FROM TABLEA
Back to top
View user's profile Send private message
vadivem

New User


Joined: 08 May 2006
Posts: 24
Location: pune

PostPosted: Wed Nov 21, 2007 9:15 am
Reply with quote

Thanks steve forget about all things what we discussed above because I got confusions due to where & when the restart logic needs to be implement.

So can you please give me example and explain how to implement restart logic in COBOL+ DB2 program?

Or else please show me one program the restart logic was implemented.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Nov 21, 2007 9:31 am
Reply with quote

A request for restart logic in a DB2 Cobol program is so generic that the only answers that can given are to generic to be useful at the level you seem to desire. It is no better than saying, I am processing a non-keyed file. Give me an example of restart logic. Or, I am processing a tape file give me an example of how to restart on an abend?

What has the business defined as the restart procedures? Do they want you to be able to restart from the middle or start again from the top each time? You haven't even given us what your rules are. Once you can actually define your process so we can understand it, maybe we could help.

Are you tracking successful records? Are you commiting after each insert or after every 50? If you get 49 successful inserts and the DB2 insert statement fails for record 50 are the first 49 going to rollback or will you do a commit and remove them from your input set for a restart? Are you not tracking success and just hoping that it works right the first time through and if not... well crap we gotta go digging now? Are you writing data to a temporary pointer file so you know where to restart? If you are producing reports from this data will a restart provide complete report data if you don't reprocess the successful records or are 2 partial reports ok? IF the first one abends though you won't have a report, so what then?

Your question just has too many holes for us to provide anything useful to you. There are design considerations that it looks like you haven't even considered here and you are just looking for an example that may not even be applicable to your situation.
Back to top
View user's profile Send private message
vadivem

New User


Joined: 08 May 2006
Posts: 24
Location: pune

PostPosted: Wed Nov 21, 2007 10:22 pm
Reply with quote

Thanks steve really as a beginner i don't know these much of procedures involving in restart logic like design,business considerations. Just I want to see how the restart logic code has been implemented in DB2 Cobol program.

As per your determination we will take it as business has defined the restart has to be restart from middle of the business now tel me ways how we can start from middle?
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: Thu Nov 22, 2007 9:13 am
Reply with quote

Hello Vadie,

Quote:
as a beginner i don't know these much of procedures involving in restart logic
This is the reason why our efforts are not providing you much help. Until you learn some basics, we cannot be much help.

You can ask for and receive "the code" to calculate a discount, determine a square root, search an array etc. From my experience, restart/recovery is not at all the same. Someone must define the methodology - one way or another - it is not just a "bit of code".

If your client has demanded that you incorporate some sort of restart, they need to also define how they want this implemented. Is it possible that this is something they have heard of and want with no idea of how it will help support their system?
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top