MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQLCODE -420 - Please help!!!

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
vsr100481
Beginner


Joined: 02 May 2006
Posts: 9
Topics: 5

PostPosted: Mon Nov 20, 2006 1:02 pm    Post subject: SQLCODE -420 - Please help!!! Reply with quote

Hi Every one,

Can any one help me to fine out how to compare a character field which has integer value with an Comp-2 field in SQL:

I tried with CAST function its giving me -420 as sqlerror. So please kindly have a look at the below query and let me know the way to compare

Example:

Code:

EXEC SQL DECLARE V040-F7-CURSOR CURSOR WITH HOLD FOR
     SELECT TOP.MCC_GRK
           ,TOP.VERSION_NO
           ,TOP.VERSION_STATUS
           ,TOP.SYSTEM_ID
           ,TOP.PRODUKT_ID
           ,FIL.FILTER_EXP_CODE
           ,MAP.MAP_ATTR2
      FROM MC060T AKT
          ,MC030T TOP
          ,MC035T TRANS
          ,MC093T FIL
          ,MC094T MAP
     WHERE AKT.PRODUKT_ID      = 'COMM'
       AND AKT.ST_TRADE_RELEV  <> 'N'
       AND AKT.AVK_DATE        = '10.11.2006'
       AND AKT.VERSION_STATUS  = 2
       AND AKT.MCC_GRK         = TOP.MCC_GRK
       AND AKT.VERSION_NO      = TOP.VERSION_NO
       AND AKT.VERSION_STATUS  = TOP.VERSION_STATUS
       AND AKT.MCC_GRK         = TRANS.MCC_GRK
       AND AKT.VERSION_NO      = TRANS.VERSION_NO
       AND AKT.VERSION_STATUS  = TRANS.VERSION_STATUS
       AND TOP.SYSTEM_ID       = FIL.SYSTEM_ID
       AND TOP.PRODUKT_ID      = FIL.PRODUKT_ID
       AND FIL.ST_ACTIVE       = 'Y'
       AND FIL.CLIENT_ID       = ' '
       AND FIL.FILTER_NAME     = 'LAST-REVAL-PV'
       AND CAST(FIL.FILTER_CRIT_4 AS INTEGER) > CAST(ABS(TRANS.MTM_EUR) AS INTEGER
       AND '10.11.2006' BETWEEN FIL.VALID_FROM AND FIL.VALID_UNTIL
       AND MAP.PRODUKT_ID      = AKT.produkt_id
       AND MAP.MAP_ID          = 'EXC_DESC'
       AND MAP.MAP_ATTR1       = FIL.FILTER_EXP_CODE
       AND MAP.ST_ACTIVE       = 'Y'
       AND '10.11.2006' BETWEEN MAP.VALID_FROM AND MAP.VALID_UNTIL


In the above query FIL.FILTER_CRIT_4 is char(40) not null. and TRANS.MTM_EUR is USAGE COMP-2.

Note: the above query is running successfully when i run thru SPUFI. But when i run thru the program its giving me SQLCODE as -420.

Please let me know the correct query to compare in this scenorio.

many thanks!!!
with regards
Sundar
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Mon Nov 20, 2006 1:34 pm    Post subject: Reply with quote

vsr100481,

Do you always have numeric value in FILTER_CRIT_4 ? If so you wouldn't have any problem. If you have alphabets in the column then your comparision will fail.

you can try this
Code:

DOUBLE(FIL.FILTER_CRIT_4) > TRANS.MTM_EUR


Hope this helps....

Cheers

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group