Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
a query on DB2

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

New User


Joined: 01 Feb 2006
Posts: 3

PostPosted: Mon Feb 06, 2006 3:18 pm    Post subject: a query on DB2
Reply with quote

Hi All,

i have a doubt in DB2.

An application program is updating 100 rows in a table.
the job got abended after 50 records are updated.from here if i restart the job. The updation is starting from 1st record,i don't want from 1st.
i want it to update from 51st record.

how to do this task???

how can one know that 50 records r updated before the job is abended.

u r help is highly appreciated.......

Krishnakanth.
Back to top
View user's profile Send private message

nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Mon Feb 06, 2006 3:30 pm    Post subject:
Reply with quote

Hi,
The number of records got updated can be known by using a count in the loop. Then use restart logic by using this count after the abend to load from the last record updated.
Back to top
View user's profile Send private message
krishnakanth
Warnings : 1

New User


Joined: 01 Feb 2006
Posts: 3

PostPosted: Mon Feb 06, 2006 3:40 pm    Post subject:
Reply with quote

Hi Nuthan,

Can u pls explain this in more practicle way....
Back to top
View user's profile Send private message
prabs2006

Active User


Joined: 12 Jan 2006
Posts: 103

PostPosted: Mon Feb 06, 2006 3:41 pm    Post subject:
Reply with quote

Hi Krishnakanth,

You need to have a restart table to do this.If so,
I will take ur example only to explain this.

Give a commit say after a count of 10.This means for every 10 records ur changes will be commited.As soon as u commit, store the very next record in the restart table. This inserted row needs to be updated after every commit.

Suppose your program abends on 56th record, your 50 records would have been commited and 51st row would be in the restart table.
So when you restart the pgm,you have to fetch the restart table and start from there on.

I hope you understand this. I would also be interested to know if any other easy solution is available for this.

Thanks & regards
Prabs
Back to top
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Mon Feb 06, 2006 4:12 pm    Post subject:
Reply with quote

Hi prabs,
what u told is correct. I think now with this krishnakanth doubt has been solved.
Back to top
View user's profile Send private message
prakash271082

New User


Joined: 09 Sep 2005
Posts: 53

PostPosted: Mon Feb 06, 2006 4:46 pm    Post subject:
Reply with quote

Hi,
If you had Copied SQLCA in your WSS, you could check in SQLERRD field which would give you how many records ( Rows ) got updated.
Hope this helps.
Back to top
View user's profile Send private message
ragshere

New User


Joined: 20 Dec 2004
Posts: 70

PostPosted: Wed Feb 08, 2006 4:09 pm    Post subject: Re: a query on DB2
Reply with quote

hello Krishnakanth,
you told program updated 50 among 100 records. is it through single query? I mean when you run the query will it update 100 rows?

If it is the case, everything will be rolled back because of job abend.

If your program is updating each row at a time and job abended, the changes will be saved until latest commit point. changes after commit and before abend will be rolled back.

In this case your program has to be written such that it will fetch needed rows freshly and process.
I mean if it fetch the rows always when the program starts, data consistency will be maintained and no row processes 2 times.
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 HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us