Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
manugeorge2004

New User

Joined: 17 Jun 2009
Posts: 35
Location: Denver

 Posted: Wed Jan 20, 2010 2:26 am    Post subject: Need help with character to numeric conversion 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

dick scherrer

Site Director

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

 Posted: Wed Jan 20, 2010 2:38 am    Post subject: 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
Terry Heinze

JCL Moderator

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

 Posted: Wed Jan 20, 2010 3:53 am    Post subject: 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.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Invalid XML character while producing... nikhil.bhole IBM Tools 4 Tue Mar 20, 2018 1:24 am Conversion of DLI update Jobs as BMP ... Gopinath Shanmugam IMS DB/DC 3 Wed Dec 20, 2017 12:02 pm Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm Conversion of UTF-8 to EBCDIC muralikrishnan_new COBOL Programming 1 Tue Nov 21, 2017 5:33 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us