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
 

 

-310 while inserting two decimal fields in the table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging
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    Post subject: -310 while inserting two decimal fields in the table
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    Post subject: Re: -310 while inserting
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    Post subject:
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

Site Director


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

PostPosted: Fri Feb 02, 2007 11:45 pm    Post subject:
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    Post subject:
Reply with quote

Hi Dick,

Thanks for the reply.

Daphne
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: Sat Feb 03, 2007 3:16 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm


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