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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: In COBOL pgm Sql 'select * from <table name'>
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    Post subject:
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    Post subject: Thank u
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    Post subject:
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: 149
Location: Ottawa Canada

PostPosted: Tue Jun 05, 2007 7:08 pm    Post subject:
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

Site Director


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

PostPosted: Tue Jun 05, 2007 9:30 pm    Post subject:
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    Post subject:
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    Post subject: Re: In COBOL pgm Sql 'select * from <table name'>
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    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
No new posts Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 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 SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 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