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

In COBOL pgm Sql 'select * from <table name'>


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bh

New User


Joined: 19 Mar 2006
Posts: 26
Location: India

PostPosted: Tue Jun 05, 2007 8:50 am
Reply with quote

Hi,

Can anyone tell me what happens if one uses
'select * from <table name'> in a COBOl pgm ?

Regards,
bh.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Tue Jun 05, 2007 8:58 am
Reply with quote

Hi


If you not using the Cursor in the Program for a query whose result set is more than 1 row,then you will get Sqlcode -811






Thanks
Sai
Back to top
View user's profile Send private message
bh

New User


Joined: 19 Mar 2006
Posts: 26
Location: India

PostPosted: Tue Jun 05, 2007 9:12 am
Reply with quote

Thank u
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Tue Jun 05, 2007 10:57 am
Reply with quote

select * would get all the rows meeting the criteria for all columns , which you may not need instead it is always a good practice to name the coulmns that you need in the query. Also when a column in the tbale is dropped you need not compile again if you use the column names in the query. Performance also would be better if you use specific column names
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 148
Location: Ottawa Canada

PostPosted: Tue Jun 05, 2007 7:08 pm
Reply with quote

Agree with Prasadvrk's advice. Where I work "SELECT *" is forbidden in COBOL programs. The DBAs would raise a bloody stink if someone coded it.

However, SELECT * is perfectly fine for SPUFI.
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 Jun 05, 2007 9:30 pm
Reply with quote

Hello,

One drawback of SELECT * is that it can make impact analysis more time consuming.
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 Jun 05, 2007 10:23 pm
Reply with quote

With
Code:
SELECT * INTO

in a cobol program you have to have a structure to receive all the data items and a structure to receive null indicators for all the data items.[/u]
Back to top
View user's profile Send private message
pingte

Active User


Joined: 03 Dec 2005
Posts: 120
Location: india

PostPosted: Wed Jun 06, 2007 12:10 pm
Reply with quote

Analyse the program and figure out which all columns u need in the program...
Put only those cols in select statement.
This will make ur program more efficient and easier to maintain.

Also in future if there are any changes to table strusture (like columns added), then impact on ur program will be less.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts Load new table with Old unload - DB2 DB2 6
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top