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: 8055
Location: East Dubuque, Illinois, USA

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 READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am


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