View previous topic :: View next topic |
Author |
Message |
kollanag Beginner
Joined: 04 Sep 2007 Posts: 3 Topics: 1 Location: Chennai
|
Posted: Mon Sep 17, 2007 1:07 pm Post subject: COMP-3 issues - S0C7 |
|
|
I have my input value as: -89000.50. I want to update this value (many of this) into DB2 where we defined as Decimal(16,2).
I used a sort UTILITY to convert -89000.50 to Packed decimal and I formatted the value as
0000000000000900
000000000000805D
In the cobol program I defined the input value as
05 WS-A PIC S9(14)V9(2) USAGE COMP-3
Then when I am trying to update this value I got SQL = -311
When I defined 05 WS-B PIC S9(14)V9(2) USAGE COMP-3
when I tried to move the value
MOVE WS-A TO WS-B, I am getting the S0C7.
Could you please help me why this SOC7? |
|
Back to top |
|
 |
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Mon Sep 17, 2007 1:24 pm Post subject: Re: COMP-3 issues - S0C7 |
|
|
kollanag wrote: | I have my input value as: -89000.50. I want to update this value (many of this) into DB2 where we defined as Decimal(16,2).
I used a sort UTILITY to convert -89000.50 to Packed decimal and I formatted the value as
0000000000000900
000000000000805D
In the cobol program I defined the input value as
05 WS-A PIC S9(14)V9(2) USAGE COMP-3
Then when I am trying to update this value I got SQL = -311
When I defined 05 WS-B PIC S9(14)V9(2) USAGE COMP-3
when I tried to move the value
MOVE WS-A TO WS-B, I am getting the S0C7.
Could you please help me why this SOC7? |
A comp-3 field with a picture of s9(14)v9(2) would only take up 9 bytes, you are showing 16 bytes and you have the wrong number of zeros between the 9 and the 5. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Mon Sep 17, 2007 1:31 pm Post subject: |
|
|
kollanag,
Show us the DB2 column definition.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
kollanag Beginner
Joined: 04 Sep 2007 Posts: 3 Topics: 1 Location: Chennai
|
Posted: Mon Sep 17, 2007 1:40 pm Post subject: |
|
|
The input value is -8900.50 in my file.
The DB2 definition is fld-amt decimal(16,2). |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Mon Sep 17, 2007 2:38 pm Post subject: |
|
|
Kollanag,
As mentioned by CraigG S9(14)V9(2) USAGE COMP-3 occupies only 9 bytes, but you show a much bigger number.
Quote: |
I used a sort UTILITY to convert -89000.50 to Packed decimal and I formatted the value as
|
I don't know how you converted the values from input to output but this is how you need to convert the numbers to packed decimal numbers
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
-8900.50
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC FIELDS=(1,7,SFF,PD,LENGTH=9)
/*
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Mon Sep 17, 2007 2:39 pm Post subject: Re: COMP-3 issues - S0C7 |
|
|
kollanag wrote: | I used a sort UTILITY to convert -89000.50 to Packed decimal and I formatted the value as
0000000000000900
000000000000805D
| Which one is real and which one is 'Memeoex"?
-89000.50 is
0000000000008000
000000000000905D
and
0000000000000900
000000000000805D is
-8900.50
Since we are not seeing the full true picture, what "sort UTILITY" statements did you use to convert this field? |
|
Back to top |
|
 |
kollanag Beginner
Joined: 04 Sep 2007 Posts: 3 Topics: 1 Location: Chennai
|
Posted: Mon Sep 17, 2007 2:59 pm Post subject: |
|
|
I will try with 9 bytes field length and get back to you on this. Thanks for your help. |
|
Back to top |
|
 |
|
|