Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DB2 BIND ERROR

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

New User


Joined: 24 May 2010
Posts: 86
Location: Pune

PostPosted: Mon May 20, 2013 1:09 pm    Post subject: DB2 BIND ERROR
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

Moderator


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

PostPosted: Mon May 20, 2013 1:48 pm    Post subject:
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

Senior Member


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

PostPosted: Mon May 20, 2013 2:18 pm    Post subject:
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    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 OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us