View previous topic :: View next topic
|
Author |
Message |
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
Hi,
I have a variable of 100 bytes (WS-A) and filling with two variable values (WS-B and WS-C) using string function. After that i search the table using WS-A-OUT (WS-B+WS-C) but getting -305 error while program execution. With the same value when i serach table using spufi i am getting the record successfully.
Program
WS-A pic x(100).
ws-b pic x(50)
ws-c pic x(50)
String WS-B delimited by space
WS-C delimited by space
into WS-A-OUT
:
:
Select * from table where WS-COL-A = WS-A-OUT
WS-COL-A is CHAR (100) NOT NULL definition in table
Please help me why I am not able to serach the value in table using program.
Is there any spaces need to be removed |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Since we don't know what your source values look like, or what values you expect, it is not possible to suggest anything. So... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Furthermore, what is the definition of WS-A-OUT? Your STRING and SELECT statements use that variable, yet you did not provide us with the definition of it, just something called WS-A. Maybe WS-A-OUT and WS-A are defined the same, and maybe not.
Plus, if you really want to debug the problem, why do you not simply put a DISPLAY of WS-A-OUT (or WS-A) just before the SELECT statement? That way, you can see precisely what is being used for the SELECT and compare it to your results using SPUFI. You claim to be using the same value in SPUFI as in your code, yet you are getting different results. This indicates that the SPUFI value you are using is NOT the same as the value in the program. |
|
Back to top |
|
|
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
1. PROBLEM may lie in your programming since you might have not handled NULL --> since -305
2. As robert said, before firing SELECT you should have displayed the values in A,B,C variables.
Remember DISPLAY is the simplest and quick debugging technique. |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Apart from all other's suggestions,
Could you also post your full SELECT statement. I guess, one of your SELECT column that has NULL value, which can't able to move to host variable.
-305:
Quote: |
THE NULL VALUE CANNOT BE ASSIGNED TO OUTPUT HOST VARIABLE NUMBER position-number BECAUSE NO INDICATOR VARIABLE IS SPECIFIED
A FETCH or embedded SELECT operation resulted in the retrieval of a null value to be inserted into the output host variable, designated by entry number 'position-number' of the output SQLDA, for which no indicator variable was provided. An indicator variable must be supplied if a column returns a null value. |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
and it may be that your host variable is ok.
you are getting a negative 305 (as sureshpathi10 pointed out)
and that is the problem you should solve first.
had you bothered to read the manual about a -305 SQL code
and thought a bit,
i doubt if you would have posted your question.
you need to improve your debugging methods. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
It is not about any SPACE issue and if it ever could have been then you would be ending up getting SQLCODE +100 and not -305. So as other experts pointed out please have it investigated by looking at the underlying qualified data for the above statement and as per my knowledge for SQLCODE -305 you would centainly get the column number in the log to which it had a problem which could be the easy start to correct the data or use NULL indicators or use COALESCE function
Note: Moreover, that is one of the reason I could think that SELECT * is not advised. |
|
Back to top |
|
|
|