× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: text equation
  • From: "L. S. Russell" <leslier@xxxxxxxxxx>
  • Date: Wed, 22 Dec 1999 07:49:45 -0600

Here is a tiny perl script that will do everything you want.
You could place the expression in either a member or a streamfile and read it 
into

$test_exp. Perl is so easy to install on the 400 and so valuable for things like
this, and so easy to learn.
Look, what would take hundreds of lines of code in RPG can be done with a five
line program...

# Program evaluates a complex mathmatical expression
#
#

# This next line you might need to change.
#!/usr/bin/perl

$test_exp = "";
$num = "";

#Main()
 $test_exp = '$num = ((100 * 10) + 1);';  # DO NOT FORGET THE SEMI COLON
                                                               # AT THE END OF 
THE
EXPRESSION
                                                               # BEFORE THE
CLOSING QUOTE!!!

 eval($test_exp);     # High level language function

 print($num);

exit;


Jim Langston wrote:

> Okay, REXX is easy to use.
>
> I created a source file called QREXXSRC and created a
> member called testing.  I then entered the source code shown
> below, saved it, and then did a 16 on the member.  After being
> told that my argument wasn't a regular expression, I did a 16
> and hit F4, then typed in 1 + 2 * 3 as the parameter.  A screen
> popped up and told me 7.
>
> Now I only have one question.  How do I run a REXX procedure
> from the command line?
>
> As it is, I now have a calculator for the AS/400.
>
> Regards,
>
> Jim Langston
>
> Douglas Handy wrote:
>
> > Eric,
> >
> > >I never used REXX, do you have exemple or a good way to learn what I can do
> > >with it.
> >
> > I don't use it either -- but it is what you may want to use in this
> > case.  REXX is included on every system as part of OS/400 so your
> > machine will definitely be able to support it.
>
> <SNIP>
>
> +---
> | 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
> +---

--
L. S. Russell Programmer/Analyst
Datrek Professional Bags, Inc.
2413 Industrial Drive
Springfield, TN. 37172
mailto:leslier@datrek.com
http://www.datrek.com
--


+---
| 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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.