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

What SQL CODE would be returned?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
No new posts Monitoring production job progress. N... JCL & VSAM 4
Search our Forums:

Back to Top