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
 

 

Movement of Decimal value

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

New User


Joined: 24 Dec 2013
Posts: 4
Location: India

PostPosted: Thu Jul 24, 2014 11:14 am    Post subject: Movement of Decimal value
Reply with quote

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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jul 24, 2014 12:02 pm    Post subject: Reply to: Movement of Decimal value
Reply with quote

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

Code:
000001000


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

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Thu Jul 24, 2014 6:33 pm    Post subject:
Reply with quote

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

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Thu Jul 24, 2014 8:11 pm    Post subject:
Reply with quote

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

New User


Joined: 24 Dec 2013
Posts: 4
Location: India

PostPosted: Tue Jul 29, 2014 12:16 pm    Post subject:
Reply with quote

Thanks a Lot for your resopnses. icon_biggrin.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Jul 29, 2014 7:37 pm    Post subject:
Reply with quote

Did you find out what was wrong?
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 Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Convert Decimal to hexadecimal Steve Ironmonger DFSORT/ICETOOL 5 Fri May 27, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. JCL to convert float decimal into rea... polymathtarun JCL & VSAM 3 Sun May 15, 2016 9:57 pm
No new posts conversion from char to packed decimal Musab Ahmed DFSORT/ICETOOL 7 Fri Apr 08, 2016 1:12 pm
No new posts SIGNED DECIMAL TO COMP-3 using cobol ... ram_vizag COBOL Programming 1 Tue Mar 01, 2016 11:32 pm


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