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

Updating a DB2 Sequence object


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

New User


Joined: 10 Aug 2007
Posts: 1
Location: India

PostPosted: Fri Aug 10, 2007 3:29 pm
Reply with quote

Hi,

How to update a DB2 sequence object?

The scenario is:

Am using a DB2 sequence object for a column which is a primary key to a table.

In a COBOL program, am fetching the next value of the sequence object in a working storage variable and incrementing that variable for the number of input records.

After processing all the input records i need to update the sequence object to the current value(value in the working storage variable).

Am using DB2 load utility and not the insert statements to load the table.

First time the load will go through fine. If i try to run the program and the load job again, then i need to update the latest value obtained in the COBOL program to the sequence object to avoid duplicate entries. Is it possible to update the sequence object in the program?
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Fri Aug 10, 2007 5:06 pm
Reply with quote

You shouldn't be using a sequence object as the primary key of a table. It is almost always discouraged and usually ends up causing problems like this. The normal reccomendation is to add a Timestamp field to the table and define the primary key as the "natural" key of the data.
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 Cobol program with sequence number ra... COBOL Programming 5
No new posts Updating a 1 byte thats in occurs mul... DFSORT/ICETOOL 6
No new posts Find missing sequence for every key DFSORT/ICETOOL 3
No new posts GDG all in sequence order JCL & VSAM 9
No new posts Sequence number generation for multip... DFSORT/ICETOOL 2
Search our Forums:

Back to Top