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
 

 

Need help with character to numeric conversion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
manugeorge2004

New User


Joined: 17 Jun 2009
Posts: 35
Location: Denver

PostPosted: Wed Jan 20, 2010 2:26 am    Post subject: Need help with character to numeric conversion
Reply with quote

I have a requirement to multiply a quantity with an amount ( sounds simple). But the value coming in for quantity is not predictable. Amount is alway 7 dollar positions and 2 cents positions

The quantity is coming in as X(10).
The value can be in any of the below format

00000001.5
0000001.55
000001.555
00001.5555
0001.55555
001.555555
01.5555555
1.55555555

How can I do the muliplication
How can I convert the above values to numeric with same data and do the multiply.
Can I use NUMVAL.

eg.COMPUTE QTY-NUM = FUNCTION NUMVAL(QTY-ALPHANUM)
If so, if I define QTY-NUM as 9(8)V9(8), can I give this directly in my multiplication

I want to avoid looping. Also, if NUMVAL wont do this, can I use any other functions or statements like UNSTRING,INSPECT etc
Your advice is appreciated
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jan 20, 2010 2:38 am    Post subject:
Reply with quote

Hello,

Yes, if i understand correctly, you should be able to do what you want with NUMVAL.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr40/7.1.32
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1239
Location: Richfield, MN, USA

PostPosted: Wed Jan 20, 2010 3:53 am    Post subject:
Reply with quote

If the X(10) quantity could contain a currency sign, look at NUMVAL-C also. In addition to the Reference Manual Dick pointed to, see the Programming Guide for more information about NUMVAL and NUMVAL-C.
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 File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts EBCDIC to ASCII conversion using OCOPY mistah kurtz All Other Mainframe Topics 5 Tue Sep 06, 2016 2:26 pm


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