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 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
janmejay
Warnings : 1

New User


Joined: 22 Jun 2007
Posts: 81
Location: bangalore

PostPosted: Wed Nov 04, 2009 10:00 am    Post subject: updating a db2 table
Reply with quote

Hello

i have a db2 table which contains a phone_no field.
lets example
phone_no
___________

5223432
5234567
5244568
5367902

now i need to update the phone_no field.the starting no. 5 should be replaced by 6.
how to update at a single time , so that all phone nos starting with 5 should be replaced by 6.
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: Wed Nov 04, 2009 10:20 am    Post subject:
Reply with quote

Hello,

Is there some reason this is posted in the idms part of the forum?

You need to provide more info. . .

How is phone_no defined? If it the primary key? Is it a unique key?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Nov 04, 2009 10:28 am    Post subject:
Reply with quote

Code:

UPDATE yourtablename
SET phone_no = phone_no + 1000000       
WHERE phone_no BETWEEN 5000000 AND 5999999;


If it is not unique or primary key.. above will work for you.
Back to top
View user's profile Send private message
santosh100678

New User


Joined: 21 Sep 2009
Posts: 55
Location: Kolkatta

PostPosted: Wed Nov 04, 2009 12:21 pm    Post subject: upload db2 table using input as file throu jcl
Reply with quote

Hi

I need sample jcl throu which i upload db2 table using input as a file

1.Input file I have 2 generate thru cobol pgogram
2. first create input file thru cobol
3. submit jcl usiing above input file.
4. if some column in db2 table is varchar then during upload process from file to db2 table any change required .
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Nov 04, 2009 1:27 pm    Post subject:
Reply with quote

Sambhaji wrote:
Code:

UPDATE yourtablename
SET phone_no = phone_no + 1000000       
WHERE phone_no BETWEEN 5000000 AND 5999999;


If it is not unique or primary key.. above will work for you.

Why shouldn't it be primary key ?
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 Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 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 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