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
 

 

Moving decimal value to alphanumeric field.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Moving decimal value to alphanumeric field.
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: 7931
Location: Bellevue, IA

PostPosted: Fri Oct 31, 2008 5:26 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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