Joined: 02 Jan 2009 Posts: 114 Location: Hyderabad
I have a table in which a field "accno" is defined as numeric(5). Wen i genereated the DCLGEN for the table, the same field is decimal(5,0) and the corresponding hoset variable is "ws-accno" with data type s9(5)v usage comp-3.
Now when i try to use a query in tha program, it is throwing an error.
The query is
Select MAX(accno) into :ws-accno from account
The error is undefined or unusable host variable ws-accno.
1) I tried using a local variable
2) i tried using a comp variable instead of comp-3
3) i changed the query to write max function in a sub query.
There are a lot of functions which are nullable even though the columns are not nullable. This is one of them. But I do not think it would say unusable host variable. We'll get this if the variable is not declared or : is missing from the query. Check this in your program. If it is not the problem, paste the code from your program(both declaration and the SQL).