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
 

 

COBOL Numeric data issue

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ibmcoolz

New User


Joined: 20 Sep 2006
Posts: 6

PostPosted: Tue Aug 28, 2007 6:16 pm    Post subject: COBOL Numeric data issue
Reply with quote

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

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Tue Aug 28, 2007 6:42 pm    Post subject:
Reply with quote

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

New User


Joined: 20 Sep 2006
Posts: 6

PostPosted: Tue Aug 28, 2007 8:38 pm    Post subject: Reply to: COBOL Numeric data issue
Reply with quote

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

Site Director


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

PostPosted: Tue Aug 28, 2007 9:06 pm    Post subject:
Reply with quote

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

New User


Joined: 20 Sep 2006
Posts: 6

PostPosted: Wed Aug 29, 2007 4:43 pm    Post subject: COBOL Numeric data issue
Reply with quote

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
View user's profile Send private message
sanjayis01
Warnings : 1

New User


Joined: 13 Jun 2007
Posts: 55
Location: banaglore

PostPosted: Wed Aug 29, 2007 5:04 pm    Post subject: Reply to: COBOL Numeric data issue
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Wed Aug 29, 2007 5:13 pm    Post subject:
Reply with quote

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
  1. the SQL (which we have not seen) is causing the rounding
  2. the Oracle DB definition of the 2nd column is not what you think.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Wed Aug 29, 2007 5:15 pm    Post subject:
Reply with quote

What is the DCLGEN definition of the two DB columns? Or is it not in your COBOL program?
Back to top
View user's profile Send private message
ibmcoolz

New User


Joined: 20 Sep 2006
Posts: 6

PostPosted: Fri Aug 31, 2007 11:29 am    Post subject: Reply to: COBOL Numeric data issue
Reply with quote

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

Site Director


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

PostPosted: Fri Aug 31, 2007 9:46 pm    Post subject: Reply to: COBOL Numeric data issue
Reply with quote

Thank you for posting what you found icon_smile.gif

d
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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