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
 

 

SQLCODE = -303 or UNDEFINED OR UNUSABLE HOST VARIABLE.

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

New User


Joined: 09 Oct 2006
Posts: 12
Location: Chennai, India

PostPosted: Sun May 17, 2009 9:47 am    Post subject: SQLCODE = -303 or UNDEFINED OR UNUSABLE HOST VARIABLE.
Reply with quote

Hi!

I'm not able to get the number of rows from a table using the following command.

Code:
EXEC SQL                 
     SELECT COUNT(*)     
     INTO               
      :TOT-TABLE-RCD-CNT
      FROM ABCD.TABLE1
END-EXEC                 


ABCD.TABLE1 -
This table has 8 columns. All are of the datatype - CHAR or DATE.

TOT-TABLE-RCD-CNT -

I have declared this variable in the working storage section.
When I created this variable type ALPHANUMERIC, the pgm compiles and runs successfully. But the above SQL statement returns SQLCODE = -303. This is because the datatypes are NOT comparable.

But, when I try to declare this variable as NUMERIC, I get the following message.

UNDEFINED OR UNUSABLE HOST VARIABLE "TOT-TABLE-RCD-CNT"
SELECT COUNT(*)INTO : TOT-TABLE-RCD-CNT FROM ABCD.TABLE1

Also, in the message I see a SPACE between ":" and the variable name(as seen above).

Pls help me solve this.

Thanks!
Sheshadri
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun May 17, 2009 10:14 am    Post subject:
Reply with quote

Hello,

This TOT-TABLE-RCD-CNT is your problem. The definition you've used is not compatable with the count function. How have you defined this variable?

PIC S9(9) COMP should work.

Complete info is available in the DB2 documentation available via the "IBM Manuals" link at the top of the page.
Back to top
View user's profile Send private message
Sheshadri

New User


Joined: 09 Oct 2006
Posts: 12
Location: Chennai, India

PostPosted: Sun May 17, 2009 3:21 pm    Post subject: Reply to: SQLCODE = -303 or UNDEFINED OR UNUSABLE HOST VARIA
Reply with quote

Its working now!!!
Thanks a ton Dick!!! icon_biggrin.gif

Cheers!!!
Sheshadri
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun May 17, 2009 9:38 pm    Post subject: Reply to: SQLCODE = -303 or UNDEFINED OR UNUSABLE HOST VARIA
Reply with quote

You're welcome - good to hear it is working.

Thanks for letting us know icon_smile.gif

d
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 Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts DB2 SQL Error: SQLCODE=-440, SQLSTATE... kishpra DB2 1 Sat Feb 18, 2017 2:31 am


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