× 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: dhandy@xxxxxxxxxxx (Douglas Handy)
  • Date: Mon, 20 Dec 1999 23:01:15 -0500

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.

REXX is interpreted and will let you do things like take strings with
expressions and evaluate the result.  In the sample programs appendix
of the REXX/400 Programmer's Guide is this example of a program which
does something similar, but displays the result instead of returning
it.  I *think* you may be able to change "Exit" to "Exit i" to have it
return a string with the result, then drop the "Say i" instruction.
You could also add a NUMERIC DIGITS statement to set the precision (or
even accept the precision as an argument), or use FORMAT() to get the
result variable i with a fixed number of decimals, etc.

Anyway, quoting from the REXX/400 Programmer's Guide (V3R7):
 
SAY:  This program is a simple REXX example that evaluates the
argument passed to it and displays the result.  This program displays
this description if called with a parameter of '?' or 'help'.  If the
expression is not a valid REXX expression, this program will issue a
message saying so.  You can add REXX instructions to the expression,
by using a semicolon as a delimiter.
 
  Parse Arg rest   /* Capture the argument (in mixed case).*/
  /* If the argument is ? or help (in upper or lower case),*/
  /* then display the prolog comment.                      */
  If rest=? | translate(rest)='HELP' Then
     Do i = 1 Until Sourceline(i) = '*/'
     Say Sourceline(i)
     End
  Else
     Do
     Signal on Syntax         /* Catch not valid expressions.*/
     Interpret 'I =' rest;    /* Evaluate the expression.  */
     Say i                    /* Display the result.       */
     End
  Exit
 
  Syntax:
   Say 'Sorry, that argument was not a valid REXX expression.'
   Say 'The error was:' Errortext(rc)    /* rc gets set to the error
*/
   Exit                               /* number.  Errortext returns */
                                      /* the error message for a    */
                                      /* given error number.        */
 
 

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

Follow-Ups:
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.