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 to be handled on a Table with No Primary Key

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

New User


Joined: 05 Apr 2011
Posts: 3
Location: India

PostPosted: Wed Apr 06, 2011 1:44 pm    Post subject: Restart Logic to be handled on a Table with No Primary Key
Reply with quote

Hi All,

I have to implement a Cobol-DB2 program, to update a particular table. I am selecting records from the table using a cursor and updating it in the program. I need to code a restart logic for this program, but my issue is that the table doesn't have a primary key to store in a file or table to identify the record in case of abend and to continue process. I need to issue commit at an interval of 10 records. So once commit is successful i need to write to my restart file with the unique or primary key associated with the 10th row. This is my requirement.

I have checked for the table index also, and the Unique rule is D(means duplicates are allowed). I am having 5 columns in the index list, If i use an ORDER BY clause in my select query with the 5 columns in INDEX, will it help me somehow?

Has anybody face this kind of situation? Please share your thoughts on this.
This is the cursor:
DECLARE Cur1 CURSOR WITH HOLD FOR
Select * from Table A
where upper(field_x) like '%XYZ%'
AND DATE_FIELD =' '
ORDER BY FIELD1,FIELD2,FIELD3,FIELD4,FIELD5
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1787
Location: UK

PostPosted: Wed Apr 06, 2011 2:17 pm    Post subject:
Reply with quote

Where does the information that you are updating the table with come from? If a sequential dataset hen record the number of records processed. On restart, skip that number of records.

More info needed.
Back to top
View user's profile Send private message
Minu Raju

New User


Joined: 05 Apr 2011
Posts: 3
Location: India

PostPosted: Wed Apr 06, 2011 2:33 pm    Post subject: Restart Logic to be handled on a Table with No Primary Key
Reply with quote

Nic-

I am using the same table for selecting and updating the rows. No files are used in the process.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Apr 06, 2011 2:50 pm    Post subject:
Reply with quote

two posts and you still have not explained what your update is.

maybe, if you include the criteria in the where clause, you could exclude those that have been updated.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Apr 06, 2011 4:43 pm    Post subject:
Reply with quote

if FIELD1,FIELD2,FIELD3,FIELD4,FIELD5 is not unique you might consider not to commit every 10th row but on every 10th or 5th break of FIELD1,FIELD2,FIELD3,FIELD4,FIELD5.
Back to top
View user's profile Send private message
vadim vashchenko

New User


Joined: 21 Mar 2011
Posts: 13
Location: usa

PostPosted: Wed Apr 06, 2011 5:13 pm    Post subject:
Reply with quote

GuyC wrote:
if FIELD1,FIELD2,FIELD3,FIELD4,FIELD5 is not unique you might consider not to commit every 10th row but on every 10th or 5th break of FIELD1,FIELD2,FIELD3,FIELD4,FIELD5.


Speaking of the commit frequency - it makes sense to put the value into a DB2 table and play with it until you achieve the best performance. Not so relevant to the topic though...
Back to top
View user's profile Send private message
Minu Raju

New User


Joined: 05 Apr 2011
Posts: 3
Location: India

PostPosted: Thu Apr 07, 2011 1:18 pm    Post subject:
Reply with quote

Hi All,

Thanks for the response.

I have got it confirmed that the 5 index columns will act as a unique record in real scenario. So planning to go ahead with ORDER BY clause in the CURSOR with 5 index columns.
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 unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Need help in building a logic Benchwarmer All Other Mainframe Topics 4 Wed Feb 22, 2017 2:49 am
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm


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