Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6968
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: 6968
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
This topic is locked: you cannot edit posts or make replies. how to code for GDG in Rexx cvnlynn CLIST & REXX 13 Wed Aug 09, 2017 9:13 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts I want to retire TRX and use only Rex... Abhinav Sharma CLIST & REXX 6 Sat Jul 29, 2017 2:53 am
No new posts UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us