IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

-310 while inserting two decimal fields in the table


IBM Mainframe Forums -> ABENDS & Debugging
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Daphne

New User


Joined: 28 Aug 2006
Posts: 27
Location: NY, US

PostPosted: Thu Feb 01, 2007 12:05 am
Reply with quote

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
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Feb 01, 2007 2:47 am
Reply with quote

Daphne,

Please post your exact SQL you are using to do the insert with explination of the column in question.

Thanks,
Back to top
View user's profile Send private message
Daphne

New User


Joined: 28 Aug 2006
Posts: 27
Location: NY, US

PostPosted: Fri Feb 02, 2007 10:22 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Feb 02, 2007 11:45 pm
Reply with quote

Hi Daphne,

V is an implied decimal.

. is an explicit decimal.
Back to top
View user's profile Send private message
Daphne

New User


Joined: 28 Aug 2006
Posts: 27
Location: NY, US

PostPosted: Sat Feb 03, 2007 2:54 am
Reply with quote

Hi Dick,

Thanks for the reply.

Daphne
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sat Feb 03, 2007 3:16 am
Reply with quote

You're welcome icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> ABENDS & Debugging

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top