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

SELECT COUNT(Column1), SUM(column2) not working


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shakti

New User


Joined: 20 Jan 2004
Posts: 42

PostPosted: Fri Aug 21, 2009 6:05 pm
Reply with quote

Hi,

I am facing issue with this batch query.

SELECT COUNT(col1), SUM(col2)
FROM table1
WHERE col3 = 'abc';


The output of the above query is written to the output file with wrong count and sum.

We submit this query through IKJEFT01.


Any idea what is wrong in this queru why I am not able to get the right valules.

Same query works fine with SPUFI.

Thanks much in advance.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Aug 21, 2009 6:17 pm
Reply with quote

Which program are you executing using IKJEFT01? DSNTEP2 or DSNTIAUL? What values you are getting in the output? What are your expected values? Please provide some more details.
Back to top
View user's profile Send private message
shakti

New User


Joined: 20 Jan 2004
Posts: 42

PostPosted: Fri Aug 21, 2009 6:24 pm
Reply with quote

Hi We use DSNTIAUL and the expected result should be 5 and 50.55 respectively..Butr in the output dataset shows som hex value with in correct data.

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

Global Moderator


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

PostPosted: Fri Aug 21, 2009 6:36 pm
Reply with quote

as usual, we only see what the TS deems relevent -
which is sorta silly since the TS does not know the answer to his question -
how could he know what we need to know.

anyway,
the query as you have given will not work in spufi, because you have not qualified the table, thus the query is against the TS's userid/qualifier.

in batch, the run command will associate the proper qualifier.

shakti,

since we don't know what the query is, we can not provide an answer.

suggest that you provide the exact query (cut & paste) that you use in SPUFI
and the exact query that you run in the TMP as well as the RUN command.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Aug 21, 2009 6:41 pm
Reply with quote

Quote:
Any idea what is wrong in this queru why I am not able to get the right valules.


Quote:
Butr in the output dataset shows som hex value with in correct data.


nothing wrong from the db2 side...
the only wrong is in Your understanding of the different functionality of different db2 utilities

before whining do a bit more of manual reading
for example differences in behavior and output of...
SPUFI, DSNTEP., DSNTIAUL
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Mon Aug 24, 2009 2:58 pm
Reply with quote

Quote:
Same query works fine with SPUFI.

Its about the representaion of data which makes you believe that the query works in SPUFI and not with DSNTIAUL(or else you are poiting to different DB2 region/Creator for the two runs).
Quote:
shows som hex value with in correct data.
How did you reach to this conclusion,what is the HEX value present over there ?did you try viewing the data set against a cobol copybook with DB2 equivalent Cobol data type representation?Few points to remember:
The COUNT function returns an integer number
The SUM of SMALLINT values returns an INTEGER result
The SUM of single precision floating point(REAL) values returns a double precision floating-point (DOUBLE or FLOAT)result.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
Search our Forums:

Back to Top