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

DB2 PRIMARY Key Update in COBOL code


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

New User


Joined: 11 Sep 2007
Posts: 65
Location: Gurgaon

PostPosted: Mon Aug 20, 2012 11:06 pm
Reply with quote

Is it possible to update DB2 Primary Key field in DB2 Cobol code with a unique value?
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: Mon Aug 20, 2012 11:41 pm
Reply with quote

Hello,

If i understand your question, NO - the primary key cannot be updated. This has nothing to do with COBOL.

Searching in the db2 part of the forum might have lead you to this previous topic:
ibmmainframes.com/viewtopic.php?t=11822&highlight=change+primary+key

Please ignore this post - it is NOT correct
d
Back to top
View user's profile Send private message
raj_mainframe08

New User


Joined: 11 Sep 2007
Posts: 65
Location: Gurgaon

PostPosted: Mon Aug 20, 2012 11:44 pm
Reply with quote

Thanks Dick. I also have the same feeling untill i read below page. So thought of confirming.

www.allinterview.com/showanswers/83989.html
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 Aug 21, 2012 1:03 am
Reply with quote

Primary keys can be changed, the new value must unique and be careful of foreign key constrains.
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 Aug 21, 2012 1:04 am
Reply with quote

Ooops - looks like my bad . . . icon_redface.gif

d
Back to top
View user's profile Send private message
Jaggu.r

New User


Joined: 07 Aug 2012
Posts: 2
Location: India

PostPosted: Tue Aug 21, 2012 5:46 pm
Reply with quote

Yes. We can do that.

We can DROP and ALTER primary key of a DB2 Table.

Try to create a cobol program with static sql with ALTER table query to do this but there is a constraint in using this. You need excess authorization for this.
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 Aug 21, 2012 7:54 pm
Reply with quote

Hello and welcome to the forum,

Please re-read the topic. Your reply does not address the question asked.

It is best to ensure the question is understood before posting a reply.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts run rexx code with jcl CLIST & REXX 15
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Compile rexx code with jcl CLIST & REXX 6
Search our Forums:

Back to Top