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 How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm


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