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
 
DB2 error or what

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Thu Apr 24, 2008 1:16 am    Post subject: DB2 error or what
Reply with quote

Hi All,

Please check the below spufis:

1
Code:

  SELECT * FROM TB019                                       
     WHERE  JSPN = '6775607' AND   START_DATE >= '03.04.2008' 
      AND   END_DATE <= '03.04.2008';                                 
---------+---------+---------+---------+---------+---------+---------+-
JS_PROD_CODE  BR_CODE  EFDTE       ADJ_ON_SALE_DATE  ORIG_ON_SALE_DATE
---------+---------+---------+---------+---------+---------+---------+-
DSNE610I NUMBER OF ROWS DISPLAYED IS 0                                 
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100           
---------+---------+---------+---------+---------+---------+---------+-


2
Code:
SELECT ADJ_ON_SALE_DATE FROM TB019                         
     WHERE  JSPN = '6775607' AND   START_DATE >= '03.04.2008' 
      AND   END_DATE <= '03.04.2008';                                 
---------+---------+---------+---------+---------+---------+---------+-
ADJ_ON_SALE_DATE                                                       
---------+---------+---------+---------+---------+---------+---------+-
DSNE610I NUMBER OF ROWS DISPLAYED IS 0                                 
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100   


3
Code:
SELECT MIN(ADJ_ON_SALE_DATE) AS IDATE FROM TB019         
     WHERE  JSPN = '6775607' AND   START_DATE >= '03.04.2008'
      AND   END_DATE <= '03.04.2008';                                 
---------+---------+---------+---------+---------+---------+---------+
IDATE                                                                 
---------+---------+---------+---------+---------+---------+---------+
----------                                                           
DSNE610I NUMBER OF ROWS DISPLAYED IS 1                               
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100   


4
Code:
SELECT MIN(ADJ_ON_SALE_DATE)  FROM TB019         
     WHERE  JSPN = '6775607' AND   START_DATE >= '03.04.2008'
      AND   END_DATE <= '03.04.2008';                                 
---------+---------+---------+---------+---------+---------+---------+

---------+---------+---------+---------+---------+---------+---------+
----------                                                           
DSNE610I NUMBER OF ROWS DISPLAYED IS 1                               
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100   


All the Spufis are same just having difference in the select, but the output is different.

The third and fourth spufi is giving some garbage value as hyphen, which causing some problem for a job.
Can anybody help why its giving different result, is it some error which can be corrected or a DB2 bug.

Thanks,
Nirmal
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Apr 24, 2008 1:26 am    Post subject:
Reply with quote

Quote:
DB2 error or what????


No just a user error!

The --------- is how SPUFI displays a null column.

In the first 2 you are getting the headings for the columns but since no rows satisfied your where there is not data under the headings.
In number 3 you got the column heading and the ----------- under that is a null value that was returned since no rows satisfied your where.
In number 4 you didn't get the column heading because you didn't specify what name to use for MIN(ADJ_ON_SALE_DATE) and the ----------- under that is a null value that was returned since no rows satisfied your where.
Back to top
View user's profile Send private message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Thu Apr 24, 2008 1:30 am    Post subject:
Reply with quote

Hi Craq,

Do you mean whenever i will do a select on a single column and there will be no data to fetch it will give some null value as the output?

Thanks,
Nirmal
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Apr 24, 2008 2:02 am    Post subject:
Reply with quote

When you use a column function that can return null as in number 3 & 4, yes. In number 1 & 2 you didn't get any data, look closely at the output from the samples you posted.

----+----+----+ separator before the headings
column headings
----+----+----+ separator before the data
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Thu Apr 24, 2008 12:03 pm    Post subject:
Reply with quote

when we are selecting a row from the table and no row matches the WHERE clause then we get 0 rows selected.

and in case of column function, if the WHERE clause is not satisfied with any rows then we get a NULL as the output.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Apr 24, 2008 5:46 pm    Post subject:
Reply with quote

So basically you need to add a null indicator variable to your program and on specify what it is on your select. Check that variable before further processing the record.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts FUSE - IBM MQ - CICS integration error Kevin Vaz CICS 1 Mon Sep 18, 2017 4:31 pm
No new posts Reply MQ open error Vignesh Sid COBOL Programming 6 Thu Sep 07, 2017 6:02 pm

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