|
There was a presentation many many moons ago at COMMON that did this. It was a two piece process. Piece one translated the equation from infix notation (parenthesis and signs between the factors) to reverse polish notation (RPN) also referred to as Postfix notation. Postfix is very easy to evaluate. We implemented this for custom costing routings for a large printing company. I do remember having at least source listings of this stuff somewhat recently but don't think I have magnetic copies available. I do recall that the code was not all that complicated and involved some simple stack handling. This code was all RPGIII level too and should be simpler now with the string handling available. Interestingly when we evaluated performance using the stored postfix expressions instead of compiled expressions did not affect run time noticably. I will look for the printed source. If I recall there was only a couple pages of code. - Larry Eric Panissard wrote: > > Hi everybody, > > I am looking for an RPG sub-program who can recognize and calculate a text > equation like : > (250*(12+45.5))-10 > > the equation can contain : the 4 basic operation, decimal point, multiple > parenthesis > > Eric Panissard > EPanissard@idt.pf > > +--- > | This is the Midrange System Mailing List! > | To submit a new message, send your mail to MIDRANGE-L@midrange.com. > | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. > | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: david@midrange.com > +--- -- Larry Bolhuis | What if it's True? Arbor Solutions, Inc | (616) 451-2500 | (616) 451-2571 -fax | lbolhui@ibm.net | +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.