View previous topic :: View next topic
|
Author |
Message |
Daphne
New User
Joined: 28 Aug 2006 Posts: 27 Location: NY, US
|
|
|
|
Hi all,
I have two decimal fields in the table in which I am tring to insert.
Field1 decimal(15,2)
Field2 decimal(9,2)
My host variables are defined as
WS-FIELD1 PIC S9(13)V9(2) USAGE COMP-3 VALUE 0.
WS-FIELD2 PIC S9(07)V9(2) USAGE COMP-3 VALUE 0.
respectively.
Still I am getting -310 while inserting.
Appreciate if someone can help me figure this out.
Thanks,
Daphne |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Daphne,
Please post your exact SQL you are using to do the insert with explination of the column in question.
Thanks, |
|
Back to top |
|
|
Daphne
New User
Joined: 28 Aug 2006 Posts: 27 Location: NY, US
|
|
|
|
Hi David,
Thanks for the reply.
I could resolve the issue after some research.
Here are the details:
The original input host variable is a string variable.
WS-FIELD1-CHAR PIC X(15)
To put it in a packed decimal format, first I moved it into a numeric variable.
WS-FIELD1-DEC REDEFINES
WS-FIELD1-CHAR PIC 9(06)v9(08).
And then moved the numeric to packed decimal.
MOVE WS-FIELD1-DEC TO WS-FIELD1.
When I tried to insert using this host variable WS-FIELD1 I got
-310.
The problem was with the numeric variable. Instead of V(assumed decimal) in the declaration of WS-FIELD1-DEC I had to use the decimal point.
WS-FIELD1-DEC REDEFINES
WS-FIELD1-CHAR PIC 9(06).9(08).
Once I did this change it worked fine. :-)
I don't really know the difference between V and (.) and how it affects this.
Thanks for your time.
Daphne |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Daphne,
V is an implied decimal.
. is an explicit decimal. |
|
Back to top |
|
|
Daphne
New User
Joined: 28 Aug 2006 Posts: 27 Location: NY, US
|
|
|
|
Hi Dick,
Thanks for the reply.
Daphne |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome |
|
Back to top |
|
|
|