View previous topic :: View next topic
|
Author |
Message |
ibmcoolz
New User
Joined: 20 Sep 2006 Posts: 6
|
|
|
|
Hi All,
I am encountering a peculiar problem in one of our COBOL applications. THere is a COBOL program which has (example only) the following
picture clause.
01 WS-VAR1 PIC S9(15)V999 COMP-3.
01 WS-VAR2 PIC S9(15)V999 COMP-3.
These 2 variables are getting their input field from an Oracle Table
field which is of type NUMBER .
Both these variables are getting their input from similar fields which
has following attributes
Length of field is 21, before decimal 18 places, after decimal it has 3 places. ie. (18,3).
DUe to Cobol limitations WS-VAR1 , WS-VAR2 has been described with the above mentioned picture clauses.
Surprisingly WS VAR1 gets its values correctly whereas WS-VAR2 doesnt.
For eg.
If Source field in oracle is 3000058.678 for WS-VAR1, the WS-VAR1 shows
as 1000058.2348 ,but
If Source field in oracle is 3000058.678 for WS-VAR2, the WS-VAR2 shows
as 1000023.4.
Tried everything but didnt work. Would appreciate some thoughts from you.
Thanks |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
have you read your post? nothing in your last part of the post makes any sense.
try posting your example input and output again.
There are compiler options which will allow you to go exceed the default 18 digit cobol decimal limitation. But, I don't think that is your problem. |
|
Back to top |
|
|
ibmcoolz
New User
Joined: 20 Sep 2006 Posts: 6
|
|
|
|
Sorry abt the type errors :
The text should read as :
For eg.
If Source field in oracle is 3000058.678 for WS-VAR1, the WS-VAR1 shows
as 3000058.678 ,but
If Source field in oracle is 1000023.478 for WS-VAR2, the WS-VAR2 shows
as 1000023.4.
Tried everything but didnt work. Would appreciate some thoughts from you.
Thanks
Back to top |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please post the Oracle column definitions and the code where the WS-VAR fields are the receiving fields.
Quote: |
01 WS-VAR1 PIC S9(15)V999 COMP-3.
01 WS-VAR2 PIC S9(15)V999 COMP-3. |
Were these put in by copy/paste or were they typed into the post? If wa-var2 was defined with only 1 decimal place and there was no rounding, 1000023.4 is the correct result. |
|
Back to top |
|
|
ibmcoolz
New User
Joined: 20 Sep 2006 Posts: 6
|
|
|
|
THe fields WS-VAR1 , WS-VAR2 are target/destination fields.
The source fields are both of type NUMBER in Oracle . THe field format is :
Length of field is 21.Before decimal 18 places, after decimal it has 3 places. ie. (18,3).
Hope this clarifies.
The problem as mentioned earlier is one of the fields ie. WS-VAR1 is
getting correctly populated whereas WS-VAR2 is not getting correctly populated.
Thanks,
Arvind |
|
Back to top |
|
|
sanjayis01 Warnings : 1 New User
Joined: 13 Jun 2007 Posts: 55 Location: banaglore
|
|
|
|
please post your query in clear format
as per my understanding , if ur fetching columns from tables , u should move the values to some working storage variables to get correct values
for example : X is the column name is table and ur moving column X to Y PIC S9(15)V999 COMP-3. variable , later u have to move Y value to Z variable defined as Z pic s9(15)v999 sign leading seperate. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
I assume you are using WS-VAR1 & WS-VAR2 as host variables in an SQL statement involving and Oracle DB.
If WS-VAR1 & WS-VAR2 are defined in the COBOL program as you say (i.e. PIC S9(15)V9(3) COMP-3), then- the SQL (which we have not seen) is causing the rounding
- the Oracle DB definition of the 2nd column is not what you think.
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
What is the DCLGEN definition of the two DB columns? Or is it not in your COBOL program? |
|
Back to top |
|
|
ibmcoolz
New User
Joined: 20 Sep 2006 Posts: 6
|
|
|
|
Hi,
The problem for the numeric data has since been resolved. THe
problem was traced to the calls to the ORacle database from the COBOL
programs. These are third-party provided softwares, there was an error
in the parameters being passed to the COBOL program. Strangely in the
first case( ie. in case of WS-VAR1) the parameter was being correctly passed and in the second case (ie. for WS-VAR2 ) it was not . This was
traced to one of the LINKAGE section variables getting incorrecly
populated in the calls to the database. We are still trying to decipher
why such a difference would occur.
Thanks to all who spent their valuable time in responding to this query.
Arvind |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Thank you for posting what you found
d |
|
Back to top |
|
|
|