Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

iswa (IS/IT--Management) (OP)
7 Dec 06 12:23
Running DB2 v8.2. I have a field defined as numeric (15,0). In my cobol program I define the field as S9(15)v comp-3. When I try to access this field using embedded SQL, the cursor fetch statement returns the following message -
--- error report ---
ERROR occurred : Fetch Cursor
SQLCODE : -00304
SQL0304N  A value cannot be assigned to a host variable because the
value is not within the range of the host variable's data type.
SQLSTATE=22003
SQLSTATE 22003: A numeric value is out of range.

If I define the field as s9(7)v99 comp-3, the error goes away, but the data is incorrect, because it maps the field as 5 bytes, not 8.

How do I get round this.

The box is hp-ux, the compiler is acucobol and the pre-compiler is the ibm pre-compiler
PHV (MIS)
7 Dec 06 12:33
I don't think that ANY numeric SQL data type is compatible with COMP-3 ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886

ceh4702 (Programmer)
7 Dec 06 13:47
Try a DB2 or an SQL forum.  Not everyone knows what some field description in DB2 means or how that affects SQL.  No such thing as SQL in Standard COBOL.

If you do not like my post feel free to point out your opinion or my errors.

fredericofonseca (IS/IT--Management)
7 Dec 06 14:47
have you tried without the "V" at the end?

Regards

Frederico Fonseca
SysSoft Integrated Ltd
www.syssoft-int.com

BrianTyler (IS/IT--Management)
8 Dec 06 6:44
From the IBM help files:

SMALLINT
(500 or 501)
 01 name PIC S9(4) COMP-5.  16-bit signed integer  

INTEGER
(496 or 497)
 01 name PIC S9(9) COMP-5.  32-bit signed integer  

BIGINT
(492 or 493)
 01 name PIC S9(18) COMP-5.  64-bit signed integer  

DECIMAL(p,s)
(484 or 485)
 01 name PIC S9(m)V9(n) COMP-3.  Packed decimal  


Hope this helps

Brian
MarcLodge (Programmer)
8 Dec 06 8:52
iswa,

I've not seen NUMERIC used as a DB2 data type and would use DECIMAL(15, 0) instead. Your Cobol definition should be PIC S9(15)V USAGE COMP-3.

Marc
iswa (IS/IT--Management) (OP)
8 Dec 06 10:00
OK , problem solved.

In precompiling under windows, the sql-host-var-length is wrong. Working out a solution now.


Thanks for all the replies.
fredericofonseca (IS/IT--Management)
11 Dec 06 4:22
from yourlast reply seems that you are declaring the variable inside the "declare section".
Try do it outside of it if that is the case.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
www.syssoft-int.com

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close