MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Separating integer and decimal parts from comp3
Goto page Previous  1, 2
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
GuyC
Supermod


Joined: 27 May 2011
Posts: 35
Topics: 0

PostPosted: Tue Jun 05, 2012 8:32 am    Post subject: Reply with quote

COMPUTE INT-ANS-WS = FUNCTION INTEGER-PART(123.456) => returns 123
COMPUTE WS-RESULT = FUNCTION REM (123.456, 1) => returns .456
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Jun 05, 2012 10:37 am    Post subject: Reply with quote

rajeshm01 wrote:
thanks guys.

kolusu,
FieldA should be COMP-3. I got s0c7 when moving FieldA(Comp3) to Temp.


Oops. You just need 1 redefine that's all. Here is the updated code.

Code:

WORKING-STORAGE SECTION.
01 FLD-A                       PIC S9(3)V99 COMP-3 VALUE 234.56.
01 TEMP                        PIC 9(3)V99.                     
01 TEMP-NUM   REDEFINES TEMP.                                   
   05 TEMP-C                   PIC 999.                         
   05 TEMP-D                   PIC 99.                         
01 FLD-B                       PIC 999.99.                     
01 FLD-C                       PIC 999.99.                     

PROCEDURE DIVISION.                     
                                         
     MOVE FLD-A                TO TEMP   
     MOVE TEMP-C               TO FLD-B 
     MOVE TEMP-D               TO FLD-C 
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group