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
 

 

What SQL CODE would be returned?

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

New User


Joined: 25 Aug 2006
Posts: 2

PostPosted: Thu Aug 30, 2007 8:33 pm    Post subject: What SQL CODE would be returned?
Reply with quote

Consider that I have coded the following query in my Cobol Program:

SELECT MAX(SEQ_NO)
INTO :HOSTVARIABLESEQNO
FROM TABLE1
WHERE ID = 123
AND NAME = ABC
AND DATE = 20070827
AND CODE = 1

Note : The host variable 'HOSTVARIABLESEQNO' does not contain a NULL indicator.

Consider that TABLE1 has the following data.

ID NAME CODE DATE SEQ_NO

123 ABC 1 20070825 10
123 ABC 2 20070827 11


Now when this query is run, it whould return an SQLCODE -305.

Please do confirm whether there is a possiblity for this query to return an SQLCODE 100, when where clause fails..
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Aug 30, 2007 8:59 pm    Post subject:
Reply with quote

Craig Mullins, DB2 Dev Guide 4th, & 5th Edition wrote:

The result of any column function (except the COUNT and COUNT_BIG functions) can be null. COUNT and COUNT_BIG always return a numeric result.

Columns functions will not return a SQLCODE of +100 if the predicate specified in the WHERE clause finds no data. Instead, a null is returned.
Back to top
View user's profile Send private message
Albina

New User


Joined: 25 Aug 2006
Posts: 2

PostPosted: Thu Aug 30, 2007 9:09 pm    Post subject: Reply to: What SQL CODE would be returned?
Reply with quote

Hi Dick,

Thanks alot for confirming that the posted query cannot return SQL CODE 100.

Regards,
Albina
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Aug 30, 2007 9:41 pm    Post subject:
Reply with quote

if you add a null-ind-var, that will preclude a -305, but

a Column function will never give you an SQLCODE +100.
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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 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 MAX-RC 88 and Return code 606 in DFH0... lind sh CICS 2 Tue Jan 24, 2017 1:23 pm
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 2 Thu Jan 12, 2017 12:02 pm


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