View previous topic :: View next topic
|
Author |
Message |
sweta.ssm
New User
Joined: 28 Feb 2010 Posts: 3 Location: India
|
|
|
|
Hi All,
I have a DB2 table for storing a 10 digit numeric data.. I have defined the datatype as DECIMAL(10,0) and the PIC clause is s9(10)V COMP-3. Am fetching the value from SELECT statement, using the value in my program and again incrementing the value by 1 and updating the same table with the incremented value. When I do this, am getting abend 4038. I see in CEDF that SQLCODE for select is zero and soon after executing this command, am getting abend.
If I delete the row in the table and leave the table with no rows at all, then am not getting any abend since SQLCODE is 100 for both select and update.
Not sure what exactly is causing abend 4038. Appreciate any suggestions. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
A 4038 abend is an LE abend code indicating that there is an unhandled error in the program. In other words, the 4038 just says something else didn't work -- you need to find out what and fix it. You may need to talk to your site support group for assistance. |
|
Back to top |
|
|
sweta.ssm
New User
Joined: 28 Feb 2010 Posts: 3 Location: India
|
|
|
|
Thanks for the reply..
I found that error is in MOVE statements where am trying to move between COMP-3 and numeric items...
01 WS-PR-COMP PIC S9(13)V COMP-3.
01 WS-PR REDEFINES WS-PR-COMP.
05 WS-DATA PIC --9.
05 WS-R-NUM PIC ---------9.
MOVE WS-COMMAREA-DATA TO WS-DATA
MOVE H-RN (from DB2 table which is comp-3) TO WS-R-NUM
MOVE WS-PR-COMP TO H-COM-VAR
The problem is with the last MOVE statement. I have SQLCODE -310 when I used H-COM-VAR (which is host variable defined as COMP-3 in the table) to insert into a table..
Cant we move NUMERIC DATA to COMP-3? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
You can move numeric data to a COMP-3 field -- since both are numeric. However, your redefine on the COMP-3 field shows a complete lack of understanding of the format COBOL uses to store COMP-3 variables internally. I strongly recommend you click on the manuals link at the top of the page, find the COBOL manuals, and read up on internal formats until you see why what you've done is completely wrong. Hint: your two 05 level variables are both USAGE DISPLAY which are redefined on a USAGE COMP-3 variable. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
With a redefinition like the one posted, what could it do if it did work?
After reading about how numerics are stored/used, you may want to diagram what is you are actrying to accomplish. Suggest also you speak with some senior or your team leader so they can explain what you have as data and what must be done with this data.
No only can the system not do what has been coded, it is not at all clear why this would be required |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Haven't you got a message at compile about the redefine field larger than the original field ?
Because it's a warning, can you ignore such message ??? NO!
WS-PR-COMP is 7 bytes long, WS-PR is 13 bytes, this should have ring a bell!
Remove the COMP-3 and replace the '-'s by '9's, maybe it will do what you want. |
|
Back to top |
|
|
|