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
 
Getting a -401 SQL code

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

New User


Joined: 23 Feb 2007
Posts: 25
Location: Dallas, TX

PostPosted: Thu Mar 22, 2007 8:51 pm    Post subject: Getting a -401 SQL code
Reply with quote

Hi,

In a SQL query, Iam using the following predicate in the 'WHERE' clause:

Code:

OR  (SUBSTR (GN_TXN_DATA,191,15)               
                          = :D011-IWA-AMT-1)



As per the rule, scalar function SUBSTRING always returns the data in character format. The host variable D011-IWA-AMT-1 has been defined as X(15). But when I bind the module, it gives me a SQL CODE -401 which is "THE OPERANDS OF AN ARITHMETIC OR COMPARISON OPERATION ARE NOT COMPARABLE".

Could someone please tell me where am going wrong !!!
Back to top
View user's profile Send private message

vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Thu Mar 22, 2007 9:17 pm    Post subject:
Reply with quote

I'm not so sure about cobol firstly.
I believe X(15) declaration should be changed to A(15).
I might be wrong since am very bad in COBOL.
Can you paste the entire query and the declaration of :D011-IWA-AMT-1.

Are you sure your bind is failing @ this query..?
Can you paste the bind error message.
Back to top
View user's profile Send private message
girias

New User


Joined: 09 Feb 2007
Posts: 26
Location: Chennai

PostPosted: Tue May 29, 2007 5:23 pm    Post subject:
Reply with quote

Hi,
I too got the same error. Can any one help me out.

Let us take the above scenario itself.
I tried giving it as 9(15). But I am getting compilation error saying

Code:
"SQL host variable had invalid syntax or the referenced host variable was an invalid SQL variable type.  The statement was discarded."


Thanks
Giri
Back to top
View user's profile Send private message
munikumar
Currently Banned

New User


Joined: 18 Apr 2007
Posts: 24
Location: India

PostPosted: Thu Jun 07, 2007 11:48 am    Post subject:
Reply with quote

Try this,

OR CHAR((SUBSTR (GN_TXN_DATA,191,15))
= :D011-IWA-AMT-1)

I have not checked this.
Back to top
View user's profile Send private message
priyamnavada

New User


Joined: 24 Dec 2005
Posts: 52
Location: hyderabad

PostPosted: Thu Jun 07, 2007 3:37 pm    Post subject:
Reply with quote

use this---

(SUBSTR (CHAR(GN_TXN_DATA),191,15)
= :D011-IWA-AMT-1)
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 IBEGENER RETURN CODE 12 anilkumar922 All Other Mainframe Topics 5 Wed Dec 13, 2017 11:41 am
No new posts Finding the plan when code compiled u... Ahemad DB2 1 Fri Dec 01, 2017 6:38 pm
No new posts Strange Code amitc23 COBOL Programming 6 Tue Nov 28, 2017 11:25 am
No new posts Speed-up/reduce CPU use of code prino PL/I & Assembler 0 Tue Sep 26, 2017 12:05 am
This topic is locked: you cannot edit posts or make replies. how to code for GDG in Rexx cvnlynn CLIST & REXX 13 Wed Aug 09, 2017 9:13 pm

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