IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Moving decimal value to alphanumeric field.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Fri Oct 31, 2008 3:06 pm
Reply with quote

Hi

I have a field WS-AMOUNT PIC 9(17)V99.
I want to move this value to a WS-AMOUNT PIC X(19).

I want a decimal in the alphanumeric field after the 17th number.

But If I delare the variable like this , I will lose data which I do not want.

Code:
03 WS-AMOUNT.                           
   05 WS-AMT-X              PIC 9(17)V99.
   05 WS-AMT REDEFINES W300-AMT-X.       
      07 WS-AMT-PART1       PIC X(16).   
      07 WS-AMT-PART2       PIC X(01).   
      07 WS-AMT-PART3       PIC X(02).   

Is there any other way of moving it without losing data?

My data should look like this after moving 100.50

Thanks,
Roshnii.


Edited: Please use BBcode when You post some code, that's rather readable...Anuj
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 31, 2008 5:26 pm
Reply with quote

Code:
05  WS-MOVED-AMOUNT     PIC Z(17).99.
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Fri Oct 31, 2008 5:54 pm
Reply with quote

Hi,
Thank you for the solution.

Thanks,
Roshnii
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Fri Oct 31, 2008 8:24 pm
Reply with quote

Are you saying that you want 17 digits to the left of the decimal + 1 decimal point + 2 digits to the right of the decimal (17+1+2=20) and you want to store these 20 characters in a 19 character field with no loss of data?
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Sat Nov 01, 2008 11:30 am
Reply with quote

No, I am storing these in a 20 char field. and the format is

Quote:

17 digits to the left of the decimal + 1 decimal point + 2 digits to the right of the decimal (17+1+2=20)



But I got the solution . Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top