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
 

 

COBOL - DB2 Tables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Fri Jul 10, 2015 9:11 pm    Post subject: COBOL - DB2 Tables
Reply with quote

Hi All,

Four Cobol-Db2 programs are accessing a Table EMP-TABLE. Later there was a requirement to add 2 new columns to the table to use it in the 5th new program.

Scenario-01: When new 2 columns added at the end of the table.

Do we need to recompile all the programs or only the 5th one? and why?

Scenario-02: When new 2 columns added in between the table?
Then do we need to recompile all the programs or only the 5th one? and why?
Back to top
View user's profile Send private message

Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Fri Jul 10, 2015 9:22 pm    Post subject:
Reply with quote

It's been a while since I've worked with DB2, but if I remember correctly, new columns only affect programs that access those columns. If the 1st 4 programs do not access the new columns, compile only program 5. If any of the 4 do a SELECT * (which is not recommended), those programs would have to be changed and recompiled. As to your 2nd question, it doesn't matter where the new columns appear in the table -- beginning, middle, or end.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 15, 2015 5:37 pm    Post subject:
Reply with quote

Well, you add columns to a row and not a table.
normally, and I apologize for exposing my ignorance here,
but how would one add new columns to the middle of a row?
Back to top
View user's profile Send private message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Wed Jul 15, 2015 7:50 pm    Post subject:
Reply with quote

I don't understand your point dbzTHEDinosauer, it's not row it's the column we add to the table. Suppose there is a requirement to add two new columns in the 3rd and 4th position of the table which has 10 columns already. Then we need to add columns based on the order of columns as per the requirement.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Thu Jul 16, 2015 3:13 am    Post subject:
Reply with quote

Columns belong to rows - you cannot have a column without a row. You cannot add columns 'between' other columns. You have to define a new table and probably write a program to migrate the data across.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Thu Jul 16, 2015 7:56 pm    Post subject:
Reply with quote

I disagree on this with the two moderators about semantics : columns belong to tables.
you can have columns (defined) without rows. you can not have rows without columns.
You do not ALTER ROW ADD COLUMN.

But On Topic :
(automatic) rebinds should suffice unless there is a "select *" or (an "insert" and the new columns are defined not null without default).

Adding columns in between requires dropping and recreating the table, but above rule about rebinds also applies.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Fri Jul 17, 2015 1:40 am    Post subject:
Reply with quote

GuyC - I stand corrected but I was speaking from the data point of view - one cannot have actual data in a column without having a row - but I did not point it out as such.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Jul 17, 2015 2:21 am    Post subject:
Reply with quote

if you drop a table its a good time to do a runstats
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Fri Jul 17, 2015 5:15 pm    Post subject:
Reply with quote

1. You don't. during the insert query if you have not listed the columns names then that will fail and then you got to change them.
2. Your DBA at first place won't allow to add columns in between as it does not make difference to a select or update or insert as to where is a new column being added and not recommended . And answer remains same as 1.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


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