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 query has like in that is returning wrong values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
lakshmi_ta

New User


Joined: 23 Aug 2006
Posts: 13

PostPosted: Tue Sep 23, 2008 5:49 am    Post subject: DB2 query has like in that is returning wrong values
Reply with quote

Hi ,

I have copy book in my program in which i wrote a sql query as

Code:
SELECT SUM(PROCESS_CNT),                           
       SUM(TOTAL_EVENT_AMT),                       
       SUM(ZB_TTL_PREMIUM_AMT),                   
       SUM(ZB_TTL_FEE_AMT)                         
INTO   :TBBL-PROCESS-CNT :WS-SUM-IND4,             
       :TBBL-TOTAL-EVENT-AMT :WS-SUM-IND1,         
       :TBBL-ZB-TTL-PREMIUM-AMT :WS-SUM-IND2,     
       :TBBL-ZB-TTL-FEE-AMT :WS-SUM-IND3           
FROM   ZB_TTB_BALANCING A                         
WHERE  PROCESS_DT        = CURRENT DATE           
 AND   PROCESS_CD        = :TBBL-PROCESS-CD       
 AND   PROCESS_ITERATION = :TBBL-PROCESS-ITERATION
 AND   PROGRAM_NAME      = :TBBL-PROGRAM-NAME     
 AND   PROCESSING_ACTION = :TBBL-PROCESSING-ACTION
 AND   TARGET_NAME LIKE :TBBL-TARGET-NAME         
WITH UR                                           

I'm passing data to the copy book variables as below:

Code:
MOVE 'O'                      TO TBBL-PROCESS-CD.         
MOVE ZEROS                    TO TBBL-PROCESS-ITERATION.   
MOVE 'ZBO460'                 TO TBBL-PROGRAM-NAME.       
MOVE 'WRITE'                  TO TBBL-PROCESSING-ACTION.   
MOVE ZEROS                    TO TBBL-PROCESS-CNT.         
MOVE ZEROS                    TO TBBL-ZB-TTL-PREMIUM-AMT. 
MOVE "'RGNOC%'"                 TO TBBL-TARGET-NAME.       


It is returning TBBL-PROCESS-CNT , TBBL-TOTAL-EVENT-AMT as zeros where as the same query in QMF returns 3 and 863.45 .

Can any body help me in finding out the error??

Thanks and Regards,
Lakshmi
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Sep 23, 2008 6:17 am    Post subject:
Reply with quote

Hello,

Why are there both single and double quotes around the literal in the last MOVE?

I'd try without the double quotes. It is not something i can test just now.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Sep 23, 2008 10:58 am    Post subject:
Reply with quote

what is the length of TBBL-TARGET-NAME?

Quote:

where as the same query in QMF ....


That is not true.
it can not be the same query. you can not use host variables in QMF.
Back to top
View user's profile Send private message
lakshmi_ta

New User


Joined: 23 Aug 2006
Posts: 13

PostPosted: Wed Sep 24, 2008 5:14 am    Post subject: Reply to: DB2 query has like in that is returning wrong valu
Reply with quote

Hi Friends,

Thanks for the reply. I didn't use the same query in qmf. Same query i mean to say same select sum( ) not with the host variables, with the hard coded values in Where clause.

I don't know the reason why like 'RGNOC%' failed in the program. but initialized Target_name and used 'RGNOC___' in target name (as the length is 8 bytes). It worked fine.

Thanks and Regards,
Lakshmi
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm

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