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
 

 

DB2 PRIMARY Key Update in COBOL code

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: DB2 PRIMARY Key Update in COBOL code
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Aug 20, 2012 11:41 pm    Post subject:
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:
http://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    Post subject:
Reply with quote

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

http://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    Post subject:
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 21, 2012 1:04 am    Post subject: Reply to: DB2 PRIMARY Key Update in COBOL code
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    Post subject: Reply to: DB2 PRIMARY Key Update in COBOL code
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 21, 2012 7:54 pm    Post subject:
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    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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm
No new posts CA Workload Automation event code help vinu78 CA Products 10 Wed Mar 01, 2017 10:05 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


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