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 

Numeric edited conversions

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
rasprasads
Beginner


Joined: 10 Dec 2002
Posts: 59
Topics: 20
Location: Chennai

PostPosted: Fri Dec 20, 2002 1:15 am    Post subject: Numeric edited conversions Reply with quote

I have a S9(13)V99 filed.I should move it to a numeric edited field
such that the output would be like :

-$999,999,999,999.99(for value - 999999999999.99)
$0.00(for zero)
-$2.00(for -2)
-$12.50(for -12.5)

I tried -$$$,$$$,$$$,$$9.99.But i get output as:

- blanks $12.50

For me negative sign must be just before the $ sign...

Please help...
_________________
Rasprasad S
Back to top
View user's profile Send private message
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Fri Dec 20, 2002 3:34 am    Post subject: Reply with quote

Why don't you try to do something like
-$zz,zz,zz,z9.99

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Mike Tebb
Beginner


Joined: 02 Dec 2002
Posts: 20
Topics: 0
Location: Yorkshire, England

PostPosted: Fri Dec 20, 2002 4:28 am    Post subject: Reply with quote

Manas,

that gives fixed editing of -$spaces9.99.

Although the requirement seemed simple, I don't think you can get that result with a simple edit mask.

You can have floating currency symbols (as shown by Rasprasads), or you can have floating minus signs, but I don't think you can have both. (someone may prove me wrong of course).

I would just code something like:
Code:

03 WS-AMOUNT          PIC S9(13)V99 VALUE.
03 WS-AMOUNT-EDITED   PIC $$$$$$$$$$$$$9.99.       
03 WS-INDEX           PIC S9(4) BINARY VALUE 0.     

MOVE WS-AMOUNT TO WS-AMOUNT-EDITED                   
IF WS-AMOUNT < 0 THEN                                 
   PERFORM VARYING WS-INDEX FROM 1 BY 1               
           UNTIL WS-INDEX > 17                       
      IF WS-AMOUNT-EDITED(WS-INDEX:1) = '$' THEN     
         MOVE '-' TO WS-AMOUNT-EDITED(WS-INDEX - 1:1)
         MOVE 18 TO WS-INDEX                         
      END-IF                                         
   END-PERFORM                                       
END-IF   

_________________
Cheers - Mike


Last edited by Mike Tebb on Fri Dec 20, 2002 4:32 am; edited 1 time in total
Back to top
View user's profile Send private message
rasprasads
Beginner


Joined: 10 Dec 2002
Posts: 59
Topics: 20
Location: Chennai

PostPosted: Fri Dec 20, 2002 4:31 am    Post subject: Reply with quote

Manas, Thanks for your help ...
I have tried your idea .It would give the following result:

-$ BLANKS 21,230.00

I need no spaces betwwen the $ and sign and as well as the amount...

Hope i would get a solution for this...
_________________
Rasprasad S
Back to top
View user's profile Send private message
rasprasads
Beginner


Joined: 10 Dec 2002
Posts: 59
Topics: 20
Location: Chennai

PostPosted: Fri Dec 20, 2002 4:41 am    Post subject: Reply with quote

Mike,
Thanks a lot.
Your solution is ok.It works fine.
But i have some 3 such fields for a single record.
I also should perform this for a huge amount of records(around 1 million).
I think if there is some other solution than going for code it would be better.

So please suggest me if any other solution is possible...
_________________
Rasprasad S
Back to top
View user's profile Send private message
Mike Tebb
Beginner


Joined: 02 Dec 2002
Posts: 20
Topics: 0
Location: Yorkshire, England

PostPosted: Fri Dec 20, 2002 4:51 am    Post subject: Reply with quote

I wouldn't worry about the performance implications.

Anyway does it HAVE to look like that.

Coding $$$$$$$$$$$$$9.99- would give you $123.45-
_________________
Cheers - Mike
Back to top
View user's profile Send private message
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
Page 1 of 1

 
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