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
 

 

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 DB2 Program abending without giving a... rahulgarg14 DB2 3 Mon May 29, 2017 8:10 pm
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm


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