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
 

 

Problem with MAX() query

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

Active User


Joined: 02 Jan 2009
Posts: 114
Location: Hyderabad

PostPosted: Tue Jan 27, 2009 7:31 pm    Post subject: Problem with MAX() query
Reply with quote

Hi,

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.

Nothing worked out.

Please help me
Back to top
View user's profile Send private message

Suresh Ponnusamy

Active User


Joined: 22 Feb 2008
Posts: 107
Location: New York

PostPosted: Tue Jan 27, 2009 9:51 pm    Post subject:
Reply with quote

Hi

1) What is the definition of ws-accno in your program.

2) Are you directly using this variable in the query or doing some operation (initialize or move) before that.
Back to top
View user's profile Send private message
muthukannan

New User


Joined: 03 Aug 2006
Posts: 42
Location: Chennai

PostPosted: Wed Jan 28, 2009 1:48 am    Post subject: Reply to: Problem with MAX() query
Reply with quote

Hi,

Have you included the DCLGEN in your COBOL program.
Back to top
View user's profile Send private message
CHANDAN KAPOOR

New User


Joined: 12 Apr 2008
Posts: 36
Location: NOIDA

PostPosted: Wed Jan 28, 2009 12:47 pm    Post subject: Is the column is null defined
Reply with quote

I think you shull use null indicator variable also if the column is nullable in the database.
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Wed Jan 28, 2009 12:55 pm    Post subject:
Reply with quote

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).
Back to top
View user's profile Send private message
sumit agarwalla

New User


Joined: 13 Nov 2008
Posts: 17
Location: hyderabad

PostPosted: Wed Jan 28, 2009 2:02 pm    Post subject:
Reply with quote

Quote:
The error is undefined or unusable host variable ws-accno


Check if u have included the DCLGEN member in Area B.This error is sometimes thrown when the DCLGEN member is not in Area B and thus the variable is not recognised by the application program
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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am


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