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

DB2 BIND ERROR


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

New User


Joined: 24 May 2010
Posts: 92
Location: Pune

PostPosted: Mon May 20, 2013 1:09 pm
Reply with quote

While binding a DB2 program, I am getting the below error as -

Statement 2140 – SQLcode -338 - AN ON CLAUSE IS INVALID

Statement 3572 – SQLcode -206 - TOKENS=A.CARD_NM_SUR - IS NOT VALID IN THE CONTEXT WHERE IT IS USED

Code:
EXEC SQL                                 
  DECLARE LNBR                         
  CURSOR FOR                             
  SELECT                                 
     K.CASENO                         
   , K.CASETYP                         
   , K.MCH_RS_MCHNO                   
   , K.MCH_RS_MCH_TYP                 
    , K.QS_CAT_QSTYP                   
   , A.CARD_NBR                         
   , A.CARD_NM_SUR                   
  FROM                                   
       CASE K                       
       LEFT OUTER jOIN ACI A         
ON    M_MCHNO   = :SQL-MCH-NUM       
AND   M_RS_MCH_TYP = :SQL-MCH-TYP       
AND   CASENO         = CASE_DFN_CASENO   
AND   CASETYP        = CASE_DFN_CASETYP   
AND   QS_CAT_QRTYP   = 'DFR'             
AND   CASENO         > :SQL-CASENO       

Also CARD_NM_SUR is a column of table A.

Please suggest.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon May 20, 2013 1:48 pm
Reply with quote

Quote:
-338 AN ON CLAUSE IS INVALID
Explanation:
This return code reports a violation of one of the
following:
v One expression of the predicate must only reference
columns of one of the operand tables of the
associated join operator, full join, and the other
expression of the predicate must only reference
columns of the other operand table.


Quote:
-206 => -206 name IS NOT VALID IN THE
CONTEXT WHERE IT IS USED


Check if A.CARD_NM_SUR name is correct
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon May 20, 2013 2:18 pm
Reply with quote

Please learn to use BBcode Tags - I've added them to align your code. Have you looked at the explanation of -338?

Quote:
-338 AN ON CLAUSE IS INVALID

Explanation: This return code reports a violation of one of the following:

    o One expression of the predicate must only reference columns of one of the operand tables of the associated join operator, full join, and the other expression of the predicate must only reference columns of the other operand table.
    o A VALUE or COALESCE function is allowed in the ON clause only when the join operator is a FULL OUTER JOIN or FULL JOIN.
    o An operator other than '=' is not allowed in a FULL OUTER JOIN or FULL JOIN.
    o A subquery is not allowed in the ON clause.
Can you use host-variable :SQL-MCH-NUM for "ON" in this case?
Is CASE a table name?
What tables do the ON columns qualifies to?
And why do you post your thread under the subject "DB2 BIND ERRO(r)"?
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 Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Getting Error while trying to establi... DB2 3
Search our Forums:

Back to Top