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
 

 

Updating a DB2 Sequence object

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Updating a DB2 Sequence object
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    Post subject:
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    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 Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Sequence number add in SORT pshongal SYNCSORT 3 Fri Sep 02, 2016 3:32 pm
No new posts Updating online Db2 table kishpra DB2 3 Fri Aug 12, 2016 2:44 pm
This topic is locked: you cannot edit posts or make replies. Updating value of key using rewrite s... ParminderKumar COBOL Programming 4 Thu Aug 04, 2016 12:46 am


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