Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
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

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us