View previous topic :: View next topic
|
Author |
Message |
Sree Lekshmi
New User
Joined: 24 Dec 2013 Posts: 4 Location: India
|
|
|
|
Hi,
I have written a program in which it reads input data from a file and then updates the table with the values being read. In this Im reading a decimal value and moving to working storage.Please find the declarations below.
Input Record
Code: |
05 IN-REC-INT-PREM PIC 9(7)V9(2). |
Working Storage Variable
Code: |
05 WS-REC-INIT-PREM-AMT PIC 9(7)V9(2). |
In one place Im moving the value
MOVE IN-REC-INT-PREM TO WS-REC-INIT-PREM-AMT
I have given display statement for both the values and in SYSOUT Im getting as below.
Code: |
IN-REC-INT-PREM: 10.00
WS-REC-INIT-PREM-AMT: 10.00 0 |
Input Record value is showing correctly but the working storage variable has an additional zero by its side.
I have tried giving "9(9)" and
Code: |
"05 WS-REC-INIT-PREM-AMT PIC 9(7)V9(2) VALUE ZEROS." |
but the issue still holds.
Could you please help.
Code'd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please use the Code tags to preserve spacing.
The value you have DISPLAYed for IN-REC-INT-PREM is far from correct for that data-description. If IN-REC-INT-PREM had contained the logical value equivalent to 10,00 it would DISPLAY as
The decimal point is implied-only, by the V, it is a numeric definition, so right-justified and left zero-filled.
So your data does not match the PICture of IN-REC-INT-PREM. Either the data is wrong, or the PICture is wrong, and the data will need to be converted before you can use it in WS-REC-INT-PREM. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
What you have posted is EXACTLY what would happen if the input data were PIC X and you moved it to PIC 9(07)V9(02) -- the data is moved byte by byte (PIC X data is left-justified as your post shows) and the compiler ensures the last byte zone is F? (for unsigned), which changes a space to a zero (X'40' to X'F0').
Also, your post indicates the value is 10.00 -- which is not possible with the PICTURE you provided. The V in a COBOL PICTURE is an IMPLIED decimal point -- which means there is no such thing in the data. If your input were really PIC 9(07)V9(02), the value would have displayed as 000001000, not 10.00. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Please check if ther is any editing onf these fields being done before the display. Or the SYSOUT that you have shown may be of different execution. |
|
Back to top |
|
|
Sree Lekshmi
New User
Joined: 24 Dec 2013 Posts: 4 Location: India
|
|
|
|
Thanks a Lot for your resopnses. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Did you find out what was wrong? |
|
Back to top |
|
|
|