Re: Welcome to the "Ibm-netrexx" mailing list

classic Classic list List threaded Threaded
34 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome to the "Ibm-netrexx"mailing list]

Robert L Hamilton
My original question was: why does this,

say translate('123asdASDFfg$%^&*lkj-8.76', , xrange('a'  , 'z')xrange('A' , 'Z')'!@#$%^&*()<>?' )

work in REXX but the NetRexx version of this statement not work...

??

bobh

On Sun, Mar 28, 2010 at 4:23 AM, Mike Cowlishaw <[hidden email]> wrote:
Chip wrote:

> I was going to suggest:
>
>    s = "a0987654321sadf09253490-3t4l'dkfgdi09531=5798"
>    Say s.translate('1234567890','1234567890'||xrange)
>
> only to find that xrange() is conspicuous by its absence.
> I'm not sure why.
>
> Mike, can you elaborate?

Character strings in NetRexx/Java are Unicode (the subset that can be
UTF-8-encoded), whereas xrange in 'classic' Rexx produces a series of
bytes, which could really only be represented as a byte array.  However,
all the "BIFs" work on character strings (of type Rexx).  Indeed, the
NetRexx language as such does not require that binary data (such as bytes)
exist, although it admits that implementations might support such antique
concepts :-).

For the same reason x2c (for example) can only produce a single character.

Translate should be fine.

Mike



_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome to the "Ibm-netrexx"mailing list]

alansam

On 30 March 2010 20:45, Robert Hamilton <[hidden email]> wrote:
My original question was: why does this,

say translate('123asdASDFfg$%^&*lkj-8.76', , xrange('a'  , 'z')xrange('A' , 'Z')'!@#$%^&*()<>?' )

work in REXX but the NetRexx version of this statement not work...

??

bobh

Basically because NetRexx \== Rexx

There are significant syntax differences that you can't ignore.   NetRexx built-in functions are object oriented so they need to act on an object (typically an object of type Rexx.)

Another reason why your sample code doesn't work is that XRANGE isn't a built-in function in NetRexx (see other postings in this thread)

Try this instead:

say '123asdASDFfg$%^&*lkj-8.76'.translate('', 'a'.sequence('z') || 'A'.sequence('Z') || '!@#$%^&*()<>?')

Alan.

--
Needs more cow-bell!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome to the "Ibm-netrexx"mailing list]

Robert L Hamilton
That's basicly what i tried. I think.  

Sent from my iPhone
Enjoy your day
Bob Hamilton

On Mar 31, 2010, at 12:38 PM, Alan Sampson <[hidden email]> wrote:


On 30 March 2010 20:45, Robert Hamilton <[hidden email]> wrote:
My original question was: why does this,

say translate('123asdASDFfg$%^&*lkj-8.76', , xrange('a'  , 'z')xrange('A' , 'Z')'!@#$%^&*()<>?' )

work in REXX but the NetRexx version of this statement not work...

??

bobh

Basically because NetRexx \== Rexx

There are significant syntax differences that you can't ignore.   NetRexx built-in functions are object oriented so they need to act on an object (typically an object of type Rexx.)

Another reason why your sample code doesn't work is that XRANGE isn't a built-in function in NetRexx (see other postings in this thread)

Try this instead:

say '123asdASDFfg$%^&*lkj-8.76'.translate('', 'a'.sequence('z') || 'A'.sequence('Z') || '!@#$%^&*()<>?')

Alan.

--
Needs more cow-bell!
_______________________________________________
Ibm-netrexx mailing list
[hidden email]


_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome to the "Ibm-netrexx"mailing list]

Robert L Hamilton
In reply to this post by alansam
But I changed those to Sequence

bobh


On Wed, Mar 31, 2010 at 12:38 PM, Alan Sampson <[hidden email]> wrote:

On 30 March 2010 20:45, Robert Hamilton <[hidden email]> wrote:
My original question was: why does this,

say translate('123asdASDFfg$%^&*lkj-8.76', , xrange('a'  , 'z')xrange('A' , 'Z')'!@#$%^&*()<>?' )

work in REXX but the NetRexx version of this statement not work...

??

bobh

Basically because NetRexx \== Rexx

There are significant syntax differences that you can't ignore.   NetRexx built-in functions are object oriented so they need to act on an object (typically an object of type Rexx.)

Another reason why your sample code doesn't work is that XRANGE isn't a built-in function in NetRexx (see other postings in this thread)

Try this instead:

say '123asdASDFfg$%^&*lkj-8.76'.translate('', 'a'.sequence('z') || 'A'.sequence('Z') || '!@#$%^&*()<>?')

Alan.

--
Needs more cow-bell!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]




_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome to the "Ibm-netrexx"mailing list]

Aviatrexx
Okay... but did you read Alan's _first_ point about NetRexx syntax, Bob?

The Classic Rexx built-in functions operated on the string that was specified as
the first argument (in most cases).

The syntax to do the same thing in NetRexx specifies that string as the object
upon which the built-in function operates.  (A built-in function is now called a
"built-in method".)  The object is specified first, followed by the method(s)
acting upon it.  The rest of the built-in method's arguments remain inside the
parentheses.  For example:

             str = "Fred's Flying Flivver"
  [Classic]  say substr(str,8,6) ==> "Flying"
  [NetRexx]  say str.substr(8,6) ==> "Flying"

You cannot simply replace the "xrange" label with a "sequence" label and expect
it to work.  You must take the first argument of each function out of the
argument list and append the method (with the remaining arguments) to it with a
'.' (dot).

Note that this syntax greatly increases the clarity of your code when you apply
multiple methods to a string.  They are no longer nested, requiring you to find
the innermost method and work your way back out.  They are now simply executed
sequentially, left to right:

  [Classic]  say left(word(str,2),3) ==> "Fly"
  [NetRexx]  say str.word(2).left(3) ==> "Fly"

Or even:

  [Classic]  say left(word(str,2),3) substr(str,1,pos("'",str)-1) ==> "Fly Fred"
  [NetRexx]  say str.word(2).left(3) str.substr(1,str.pos("'")-1) ==> "Fly Fred"

[Note that Pos() was one of the functions whose first argument should have been
the string being inspected, not the "needle" being searched for.  This is now
fixed in NetRexx.]

I can highly recommend Mike's book, "The NetRexx Language" for its simple,
lucid, and complete explanation of the NetRexx syntax.  It's available on
Amazon.com as a new bound softback for $15 (used <$5) or as an updated (May/09)
PDF version here:

   http://speleotrove.com/misc/NetRexx2.pdf

Please read it before you go any further with your attempts to convert your
Classic Rexx programs to NetRexx.  It will be much less frustrating.

-Chip-

On 3/31/10 19:23 Robert Hamilton said:

> But I changed those to Sequence
>
> On Wed, Mar 31, 2010 at 12:38 PM, Alan Sampson <[hidden email]
>     On 30 March 2010 20:45, Robert Hamilton <[hidden email]
>
>         My original question was: why does this,
>
>         say translate('123asdASDFfg$%^&*lkj-8.76', , xrange('a'  ,
>         'z')xrange('A' , 'Z')'!@#$%^&*()<>?' )
>
>         work in REXX but the NetRexx version of this statement not work...
>
>     Basically because NetRexx \== Rexx
>
>     There are significant syntax differences that you can't ignore.  
>     NetRexx built-in functions are object oriented so they need to act
>     on an object (typically an object of type Rexx.)
>
>     Another reason why your sample code doesn't work is that XRANGE
>     isn't a built-in function in NetRexx (see other postings in this thread)
>
>     Try this instead:
>
>     say '123asdASDFfg$%^&*lkj-8.76'.translate('', 'a'.sequence('z') ||
>     'A'.sequence('Z') || '!@#$%^&*()<>?')

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome to the "Ibm-netrexx"mailing list]

Robert L Hamilton
Thanks very much, Folks; I really appreciate the help.

TNRL (maybe L.R.N.T ) has been on the shelf since the late 1990's and this is the first chance I've had to use it. The 'function' has been running in REXX (Objrexx 2.1) for some time but now needs to be run on other boxes.   I thought: No sweat; convert to NetREXX and run w/ Java. Over the years, the Rexx code has been moved up, over and back-again to different boxes and, except for a Date() deficiency in one of them, has run without any attention for over ten years. Now it has to run on at least two different boxes. . .And they want it in Java and have tried several times to do the function w/ Java to no avail; they called me.  Over the years these folks have become good friends and I need to help them.

I've Read whatever y'all've written but sometimes understanding takes a little longer.  TNRL has for 'position' method

pos(needle[,start]) .  How has it been changed?

THanks again and Y'all enjoy your day.

Bob Hamilton

On Thu, Apr 1, 2010 at 1:44 AM, Chip Davis <[hidden email]> wrote:
Okay... but did you read Alan's _first_ point about NetRexx syntax, Bob?

The Classic Rexx built-in functions operated on the string that was specified as the first argument (in most cases).

The syntax to do the same thing in NetRexx specifies that string as the object upon which the built-in function operates.  (A built-in function is now called a "built-in method".)  The object is specified first, followed by the method(s) acting upon it.  The rest of the built-in method's arguments remain inside the parentheses.  For example:

           str = "Fred's Flying Flivver"
 [Classic]  say substr(str,8,6) ==> "Flying"
 [NetRexx]  say str.substr(8,6) ==> "Flying"

You cannot simply replace the "xrange" label with a "sequence" label and expect it to work.  You must take the first argument of each function out of the argument list and append the method (with the remaining arguments) to it with a '.' (dot).

Note that this syntax greatly increases the clarity of your code when you apply multiple methods to a string.  They are no longer nested, requiring you to find the innermost method and work your way back out.  They are now simply executed sequentially, left to right:

 [Classic]  say left(word(str,2),3) ==> "Fly"
 [NetRexx]  say str.word(2).left(3) ==> "Fly"

Or even:

 [Classic]  say left(word(str,2),3) substr(str,1,pos("'",str)-1) ==> "Fly Fred"
 [NetRexx]  say str.word(2).left(3) str.substr(1,str.pos("'")-1) ==> "Fly Fred"

[Note that Pos() was one of the functions whose first argument should have been the string being inspected, not the "needle" being searched for.  This is now fixed in NetRexx.]

I can highly recommend Mike's book, "The NetRexx Language" for its simple, lucid, and complete explanation of the NetRexx syntax.  It's available on Amazon.com as a new bound softback for $15 (used <$5) or as an updated (May/09) PDF version here:

 http://speleotrove.com/misc/NetRexx2.pdf

Please read it before you go any further with your attempts to convert your Classic Rexx programs to NetRexx.  It will be much less frustrating.

-Chip-


On 3/31/10 19:23 Robert Hamilton said:
But I changed those to Sequence

On Wed, Mar 31, 2010 at 12:38 PM, Alan Sampson <[hidden email]     On 30 March 2010 20:45, Robert Hamilton <[hidden email]


       My original question was: why does this,

       say translate('123asdASDFfg$%^&*lkj-8.76', , xrange('a'  ,
       'z')xrange('A' , 'Z')'!@#$%^&*()<>?' )

       work in REXX but the NetRexx version of this statement not work...

   Basically because NetRexx \== Rexx

   There are significant syntax differences that you can't ignore.      NetRexx built-in functions are object oriented so they need to act
   on an object (typically an object of type Rexx.)

   Another reason why your sample code doesn't work is that XRANGE
   isn't a built-in function in NetRexx (see other postings in this thread)

   Try this instead:

   say '123asdASDFfg$%^&*lkj-8.76'.translate('', 'a'.sequence('z') ||
   'A'.sequence('Z') || '!@#$%^&*()<>?')

_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome to the "Ibm-netrexx"mailing list]

Aviatrexx
The behavior of Pos() has not changed.  It works exactly the same as it did in
Classic Rexx on VM, back in the day.

As a general rule, you convert a Classic Rexx built-in function into a NetRexx
built-in method by simply removing the first function argument and using it as
the object on which the method acts:

   say substr(foo, 3, 12)
becomes:
   say foo.substr(3, 12)

Pos() is different only in that the function's arguments were always in the
order (needle, haystack, start).  This is one of the very few cases where the
term being acted upon (haystack) is not the first term in the argument list.
Thus, the arguments to the NetRexx Pos() method are (needle, start) and it acts
on "haystack":

   say haystack.pos(needle, start)

That's the only difference from your standpoint.  As for your code running
unchanged in ObjRexx, as Mike points out in TNRL:

"Choosing the JVM as a target environment does, however, place significant
constraints on the design of a language suitable for that environment. For
example, the semantics of method invocation are in several ways determined by
the environment rather than by the source language, and, to a large extent, the
object model (class structure, etc.) of the Java environment is imposed on
languages that use it."
   ...
"The constraints of safety, efficiency, and environment necessitated that
NetRexx would have to differ in some details of syntax and semantics from Rexx;
_unlike Object Rexx, it could not be a fully upwards-compatible extension of the
language_. The need for changes, however, offered the opportunity to make some
significant simplifications and enhancements to the language, both to improve
its keyword safety and to strengthen other features of the original Rexx design.
Some additions from Object Rexx and ANSI Rexx are also included."

(My emphasis added, and bringing up the point that having -and reading- Mike's
TRL and TNRL are invaluable for learning _why_ he designed it the way he did.
This is at least as valuable as knowing how it works, and sadly is the very
information omitted from the IBM REXX Reference.)

Bottom line: You can count on one hand the number of platforms on which ObjRexx
runs (a few more for ooRexx).  It may be hard to make a complete list of all the
Java (and thus NetRexx) platforms, it's growing so fast.

-Chip-

On 4/1/10 14:16 Robert Hamilton said:

> Thanks very much, Folks; I really appreciate the help.
>
> TNRL (maybe L.R.N.T ) has been on the shelf since the late 1990's and
> this is the first chance I've had to use it. The 'function' has been
> running in REXX (Objrexx 2.1) for some time but now needs to be run on
> other boxes.   I thought: No sweat; convert to NetREXX and run w/ Java.
> Over the years, the Rexx code has been moved up, over and back-again to
> different boxes and, except for a Date() deficiency in one of them, has
> run without any attention for over ten years. Now it has to run on at
> least two different boxes. . .And they want it in Java and have tried
> several times to do the function w/ Java to no avail; they called me.  
> Over the years these folks have become good friends and I need to help them.
>
> I've Read whatever y'all've written but sometimes understanding takes a
> little longer.  TNRL has for 'position' method
>
> pos(needle[,start]) .  How has it been changed?
>
> THanks again and Y'all enjoy your day.
>
> Bob Hamilton
>
> On Thu, Apr 1, 2010 at 1:44 AM, Chip Davis <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Okay... but did you read Alan's _first_ point about NetRexx syntax, Bob?
>
>     The Classic Rexx built-in functions operated on the string that was
>     specified as the first argument (in most cases).
>
>     The syntax to do the same thing in NetRexx specifies that string as
>     the object upon which the built-in function operates.  (A built-in
>     function is now called a "built-in method".)  The object is
>     specified first, followed by the method(s) acting upon it.  The rest
>     of the built-in method's arguments remain inside the parentheses.
>      For example:
>
>                str = "Fred's Flying Flivver"
>      [Classic]  say substr(str,8,6) ==> "Flying"
>      [NetRexx]  say str.substr(8,6) ==> "Flying"
>
>     You cannot simply replace the "xrange" label with a "sequence" label
>     and expect it to work.  You must take the first argument of each
>     function out of the argument list and append the method (with the
>     remaining arguments) to it with a '.' (dot).
>
>     Note that this syntax greatly increases the clarity of your code
>     when you apply multiple methods to a string.  They are no longer
>     nested, requiring you to find the innermost method and work your way
>     back out.  They are now simply executed sequentially, left to right:
>
>      [Classic]  say left(word(str,2),3) ==> "Fly"
>      [NetRexx]  say str.word(2).left(3) ==> "Fly"
>
>     Or even:
>
>      [Classic]  say left(word(str,2),3) substr(str,1,pos("'",str)-1) ==>
>     "Fly Fred"
>      [NetRexx]  say str.word(2).left(3) str.substr(1,str.pos("'")-1) ==>
>     "Fly Fred"
>
>     [Note that Pos() was one of the functions whose first argument
>     should have been the string being inspected, not the "needle" being
>     searched for.  This is now fixed in NetRexx.]
>
>     I can highly recommend Mike's book, "The NetRexx Language" for its
>     simple, lucid, and complete explanation of the NetRexx syntax.  It's
>     available on Amazon.com as a new bound softback for $15 (used <$5)
>     or as an updated (May/09) PDF version here:
>
>      http://speleotrove.com/misc/NetRexx2.pdf
>
>     Please read it before you go any further with your attempts to
>     convert your Classic Rexx programs to NetRexx.  It will be much less
>     frustrating.
>
>     -Chip-
>
>
>     On 3/31/10 19:23 Robert Hamilton said:
>
>         But I changed those to Sequence
>
>         On Wed, Mar 31, 2010 at 12:38 PM, Alan Sampson
>         <[hidden email] <mailto:[hidden email]>     On 30
>         March 2010 20:45, Robert Hamilton <[hidden email]
>         <mailto:[hidden email]>
>
>
>                My original question was: why does this,
>
>                say translate('123asdASDFfg$%^&*lkj-8.76', , xrange('a'  ,
>                'z')xrange('A' , 'Z')'!@#$%^&*()<>?' )
>
>                work in REXX but the NetRexx version of this statement
>         not work...
>
>            Basically because NetRexx \== Rexx
>
>            There are significant syntax differences that you can't
>         ignore.      NetRexx built-in functions are object oriented so
>         they need to act
>            on an object (typically an object of type Rexx.)
>
>            Another reason why your sample code doesn't work is that XRANGE
>            isn't a built-in function in NetRexx (see other postings in
>         this thread)
>
>            Try this instead:
>
>            say '123asdASDFfg$%^&*lkj-8.76'.translate('',
>         'a'.sequence('z') ||
>            'A'.sequence('Z') || '!@#$%^&*()<>?')
>
>
>     _______________________________________________
>     Ibm-netrexx mailing list
>     [hidden email] <mailto:[hidden email]>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome to the "Ibm-netrexx"mailing list]

Aviatrexx
It appears that my attempt to add emphasis was not entirely successful. :-/

The line should read:

"_unlike_Object_Rexx,_it_could_not_be_a_fully_upwards-compatible_extension_of_the_language_."

-Chip-

On 4/1/10 15:46 I said:
> The behavior of Pos() has not changed.  It works exactly the same as it
> did in Classic Rexx on VM, back in the day.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome tothe "Ibm-netrexx"mailing list]

measel
In reply to this post by Aviatrexx
Re: [Ibm-netrexx] Translate question [was: Welcome tothe "Ibm-netrexx"mailing list]

But as a standalone language it would likely _lack_ many of the handy features of java.  Can't have everything.

----- Original Message -----
From: [hidden email] <[hidden email]>
To: IBM Netrexx <[hidden email]>
Sent: Thu Apr 01 11:58:01 2010
Subject: Re: [Ibm-netrexx] Translate question [was: Welcome tothe       "Ibm-netrexx"mailing list]

It appears that my attempt to add emphasis was not entirely successful. :-/

The line should read:

"_unlike_Object_Rexx,_it_could_not_be_a_fully_upwards-compatible_extension_of_the_language_."

-Chip-

On 4/1/10 15:46 I said:
> The behavior of Pos() has not changed.  It works exactly the same as it
> did in Classic Rexx on VM, back in the day.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome tothe "Ibm-netrexx"mailing list]

Aviatrexx
One might think so, but do you have an example?  Java-the-language has many
barnacles as a result of its 1970's C/C++ heritage.  It probably turns on one's
definition of "handy" versus "sensible".  But MikeC would be the better
authority to respond to your assertion.

-Chip-

On 4/1/10 16:02 Measel, Mike said:

> But as a standalone language it would likely _lack_ many of the handy
> features of java.  Can't have everything.
>
> ----- Original Message -----
> From: [hidden email]
> <[hidden email]>
> To: IBM Netrexx <[hidden email]>
> Sent: Thu Apr 01 11:58:01 2010
> Subject: Re: [Ibm-netrexx] Translate question [was: Welcome tothe      
> "Ibm-netrexx"mailing list]
>
> It appears that my attempt to add emphasis was not entirely successful. :-/
>
> The line should read:
>
> "_unlike_Object_Rexx,_it_could_not_be_a_fully_upwards-compatible_extension_of_the_language_."

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was:Welcome tothe "Ibm-netrexx"mailing list]

measel
In reply to this post by Aviatrexx
Re: [Ibm-netrexx] Translate question [was:Welcome tothe "Ibm-netrexx"mailing list]

RMI, JDBC, Hibernate, Swing...?

----- Original Message -----
From: [hidden email] <[hidden email]>
To: IBM Netrexx <[hidden email]>
Sent: Thu Apr 01 13:04:14 2010
Subject: Re: [Ibm-netrexx] Translate question [was:Welcome      tothe   "Ibm-netrexx"mailing list]

One might think so, but do you have an example?  Java-the-language has many
barnacles as a result of its 1970's C/C++ heritage.  It probably turns on one's
definition of "handy" versus "sensible".  But MikeC would be the better
authority to respond to your assertion.

-Chip-

On 4/1/10 16:02 Measel, Mike said:
> But as a standalone language it would likely _lack_ many of the handy
> features of java.  Can't have everything.
>
> ----- Original Message -----
> From: [hidden email]
> <[hidden email]>
> To: IBM Netrexx <[hidden email]>
> Sent: Thu Apr 01 11:58:01 2010
> Subject: Re: [Ibm-netrexx] Translate question [was: Welcome tothe      
> "Ibm-netrexx"mailing list]
>
> It appears that my attempt to add emphasis was not entirely successful. :-/
>
> The line should read:
>
> "_unlike_Object_Rexx,_it_could_not_be_a_fully_upwards-compatible_extension_of_the_language_."

_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was: Welcome to the "Ibm-netrexx"mailing list]

Thomas.Schneider.Wien
In reply to this post by Aviatrexx
Hello CHIP & all,
   may I *again* suggest to use Rexx2Nrx (see www.Rexx2Nrx.com) to do
this subtle changes automatically ?
The next version of Rexx2Nrx, which  I am just preparing for release,
does even support Obeject Rexx
(version 1.00, as a starter) Syntax ...

When interested to become a BETA Tester, just send my a private mail!

Thomas Scvhneider (Tom.)

Happy Eastern to all of you, by the way....
Tom.
=====================================================================0
Chip Davis schrieb:

> The behavior of Pos() has not changed.  It works exactly the same as
> it did in Classic Rexx on VM, back in the day.
>
> As a general rule, you convert a Classic Rexx built-in function into a
> NetRexx built-in method by simply removing the first function argument
> and using it as the object on which the method acts:
>
>   say substr(foo, 3, 12)
> becomes:
>   say foo.substr(3, 12)
>
> Pos() is different only in that the function's arguments were always
> in the order (needle, haystack, start).  This is one of the very few
> cases where the term being acted upon (haystack) is not the first term
> in the argument list. Thus, the arguments to the NetRexx Pos() method
> are (needle, start) and it acts on "haystack":
>
>   say haystack.pos(needle, start)
>
> That's the only difference from your standpoint.  As for your code
> running unchanged in ObjRexx, as Mike points out in TNRL:
>
> "Choosing the JVM as a target environment does, however, place
> significant constraints on the design of a language suitable for that
> environment. For example, the semantics of method invocation are in
> several ways determined by the environment rather than by the source
> language, and, to a large extent, the object model (class structure,
> etc.) of the Java environment is imposed on languages that use it."
>   ...
> "The constraints of safety, efficiency, and environment necessitated
> that NetRexx would have to differ in some details of syntax and
> semantics from Rexx; _unlike Object Rexx, it could not be a fully
> upwards-compatible extension of the language_. The need for changes,
> however, offered the opportunity to make some significant
> simplifications and enhancements to the language, both to improve its
> keyword safety and to strengthen other features of the original Rexx
> design. Some additions from Object Rexx and ANSI Rexx are also included."
>
> (My emphasis added, and bringing up the point that having -and
> reading- Mike's TRL and TNRL are invaluable for learning _why_ he
> designed it the way he did. This is at least as valuable as knowing
> how it works, and sadly is the very information omitted from the IBM
> REXX Reference.)
>
> Bottom line: You can count on one hand the number of platforms on
> which ObjRexx runs (a few more for ooRexx).  It may be hard to make a
> complete list of all the Java (and thus NetRexx) platforms, it's
> growing so fast.
>
> -Chip-
>
> On 4/1/10 14:16 Robert Hamilton said:
>> Thanks very much, Folks; I really appreciate the help.
>>
>> TNRL (maybe L.R.N.T ) has been on the shelf since the late 1990's and
>> this is the first chance I've had to use it. The 'function' has been
>> running in REXX (Objrexx 2.1) for some time but now needs to be run
>> on other boxes.   I thought: No sweat; convert to NetREXX and run w/
>> Java. Over the years, the Rexx code has been moved up, over and
>> back-again to different boxes and, except for a Date() deficiency in
>> one of them, has run without any attention for over ten years. Now it
>> has to run on at least two different boxes. . .And they want it in
>> Java and have tried several times to do the function w/ Java to no
>> avail; they called me.  Over the years these folks have become good
>> friends and I need to help them.
>>
>> I've Read whatever y'all've written but sometimes understanding takes
>> a little longer.  TNRL has for 'position' method
>>
>> pos(needle[,start]) .  How has it been changed?
>>
>> THanks again and Y'all enjoy your day.
>>
>> Bob Hamilton
>>
>> On Thu, Apr 1, 2010 at 1:44 AM, Chip Davis <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>     Okay... but did you read Alan's _first_ point about NetRexx
>> syntax, Bob?
>>
>>     The Classic Rexx built-in functions operated on the string that was
>>     specified as the first argument (in most cases).
>>
>>     The syntax to do the same thing in NetRexx specifies that string as
>>     the object upon which the built-in function operates.  (A built-in
>>     function is now called a "built-in method".)  The object is
>>     specified first, followed by the method(s) acting upon it.  The rest
>>     of the built-in method's arguments remain inside the parentheses.
>>      For example:
>>
>>                str = "Fred's Flying Flivver"
>>      [Classic]  say substr(str,8,6) ==> "Flying"
>>      [NetRexx]  say str.substr(8,6) ==> "Flying"
>>
>>     You cannot simply replace the "xrange" label with a "sequence" label
>>     and expect it to work.  You must take the first argument of each
>>     function out of the argument list and append the method (with the
>>     remaining arguments) to it with a '.' (dot).
>>
>>     Note that this syntax greatly increases the clarity of your code
>>     when you apply multiple methods to a string.  They are no longer
>>     nested, requiring you to find the innermost method and work your way
>>     back out.  They are now simply executed sequentially, left to right:
>>
>>      [Classic]  say left(word(str,2),3) ==> "Fly"
>>      [NetRexx]  say str.word(2).left(3) ==> "Fly"
>>
>>     Or even:
>>
>>      [Classic]  say left(word(str,2),3) substr(str,1,pos("'",str)-1) ==>
>>     "Fly Fred"
>>      [NetRexx]  say str.word(2).left(3) str.substr(1,str.pos("'")-1) ==>
>>     "Fly Fred"
>>
>>     [Note that Pos() was one of the functions whose first argument
>>     should have been the string being inspected, not the "needle" being
>>     searched for.  This is now fixed in NetRexx.]
>>
>>     I can highly recommend Mike's book, "The NetRexx Language" for its
>>     simple, lucid, and complete explanation of the NetRexx syntax.  It's
>>     available on Amazon.com as a new bound softback for $15 (used <$5)
>>     or as an updated (May/09) PDF version here:
>>
>>      http://speleotrove.com/misc/NetRexx2.pdf
>>
>>     Please read it before you go any further with your attempts to
>>     convert your Classic Rexx programs to NetRexx.  It will be much less
>>     frustrating.
>>
>>     -Chip-
>>
>>
>>     On 3/31/10 19:23 Robert Hamilton said:
>>
>>         But I changed those to Sequence
>>
>>         On Wed, Mar 31, 2010 at 12:38 PM, Alan Sampson
>>         <[hidden email] <mailto:[hidden email]>     On 30
>>         March 2010 20:45, Robert Hamilton <[hidden email]
>>         <mailto:[hidden email]>
>>
>>
>>                My original question was: why does this,
>>
>>                say translate('123asdASDFfg$%^&*lkj-8.76', ,
>> xrange('a'  ,
>>                'z')xrange('A' , 'Z')'!@#$%^&*()<>?' )
>>
>>                work in REXX but the NetRexx version of this statement
>>         not work...
>>
>>            Basically because NetRexx \== Rexx
>>
>>            There are significant syntax differences that you can't
>>         ignore.      NetRexx built-in functions are object oriented so
>>         they need to act
>>            on an object (typically an object of type Rexx.)
>>
>>            Another reason why your sample code doesn't work is that
>> XRANGE
>>            isn't a built-in function in NetRexx (see other postings in
>>         this thread)
>>
>>            Try this instead:
>>
>>            say '123asdASDFfg$%^&*lkj-8.76'.translate('',
>>         'a'.sequence('z') ||
>>            'A'.sequence('Z') || '!@#$%^&*()<>?')
>>
>>
>>     _______________________________________________
>>     Ibm-netrexx mailing list
>>     [hidden email] <mailto:[hidden email]>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)
Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was:Welcome tothe "Ibm-netrexx"mailing list]

Aviatrexx
In reply to this post by measel
I'm sure someone will correct me if I'm wrong, but all of those handy features
are readily available to NetRexx.  The "killer app" example I used in my SHARE
NetRexx presentations a decade or so ago demonstrated how easy it was to create
a GUI application (not an applet) using Swing.  It was easier than ISPF... :-)

NetRexx transparently supplants Java-the-language.  All of the cool things you
can do with Java-the-platform are readily available to NetRexx classes.

That's why I tell folks that NetRexx is "Rexx with the World's Largest Built-in
Function Package".

-Chip-

On 4/1/10 17:20 Measel, Mike said:

> RMI, JDBC, Hibernate, Swing...?
>
> ----- Original Message -----
> From: [hidden email]
> <[hidden email]>
> To: IBM Netrexx <[hidden email]>
> Sent: Thu Apr 01 13:04:14 2010
> Subject: Re: [Ibm-netrexx] Translate question [was:Welcome      tothe  
> "Ibm-netrexx"mailing list]
>
> One might think so, but do you have an example?  Java-the-language has many
> barnacles as a result of its 1970's C/C++ heritage.  It probably turns
> on one's
> definition of "handy" versus "sensible".  But MikeC would be the better
> authority to respond to your assertion.
>
> -Chip-
>
> On 4/1/10 16:02 Measel, Mike said:
>  > But as a standalone language it would likely _lack_ many of the handy
>  > features of java.  Can't have everything.
>  >
>  > ----- Original Message -----
>  > From: [hidden email]
>  > <[hidden email]>
>  > To: IBM Netrexx <[hidden email]>
>  > Sent: Thu Apr 01 11:58:01 2010
>  > Subject: Re: [Ibm-netrexx] Translate question [was: Welcome tothe      
>  > "Ibm-netrexx"mailing list]
>  >
>  > It appears that my attempt to add emphasis was not entirely
> successful. :-/
>  >
>  > The line should read:
>  >
>  >
> "_unlike_Object_Rexx,_it_could_not_be_a_fully_upwards-compatible_extension_of_the_language_."
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Translate question [was:Welcome tothe "Ibm-netrexx"mailing list]

Thomas.Schneider.Wien
Exactly, Chip .. :-)

that's why I did invent Rexx2Nrx (see www.Rexx2Nrx.com) nearly a decade
ago ..

Just to update the community:
I'm currently working on the *next release* of Rexx2Nrx, which will be
Open Object Rexx
(sorry, only release 1.00 compliant) compatible, as well as IBM Rexx
Compiler compatible,
which it has always been by DESIGN, by the way....)

Kind regards from dark Vienna, Austria,

Tom. (Thomas Schneider)
========================================================================

Chip Davis schrieb:

> I'm sure someone will correct me if I'm wrong, but all of those handy
> features are readily available to NetRexx.  The "killer app" example I
> used in my SHARE NetRexx presentations a decade or so ago demonstrated
> how easy it was to create a GUI application (not an applet) using
> Swing.  It was easier than ISPF... :-)
>
> NetRexx transparently supplants Java-the-language.  All of the cool
> things you can do with Java-the-platform are readily available to
> NetRexx classes.
>
> That's why I tell folks that NetRexx is "Rexx with the World's Largest
> Built-in Function Package".
>
> -Chip-
>
> On 4/1/10 17:20 Measel, Mike said:
>> RMI, JDBC, Hibernate, Swing...?
>>
>> ----- Original Message -----
>> From: [hidden email]
>> <[hidden email]>
>> To: IBM Netrexx <[hidden email]>
>> Sent: Thu Apr 01 13:04:14 2010
>> Subject: Re: [Ibm-netrexx] Translate question [was:Welcome      
>> tothe   "Ibm-netrexx"mailing list]
>>
>> One might think so, but do you have an example?  Java-the-language
>> has many
>> barnacles as a result of its 1970's C/C++ heritage.  It probably
>> turns on one's
>> definition of "handy" versus "sensible".  But MikeC would be the better
>> authority to respond to your assertion.
>>
>> -Chip-
>>
>> On 4/1/10 16:02 Measel, Mike said:
>>  > But as a standalone language it would likely _lack_ many of the handy
>>  > features of java.  Can't have everything.
>>  >
>>  > ----- Original Message -----
>>  > From: [hidden email]
>>  > <[hidden email]>
>>  > To: IBM Netrexx <[hidden email]>
>>  > Sent: Thu Apr 01 11:58:01 2010
>>  > Subject: Re: [Ibm-netrexx] Translate question [was: Welcome
>> tothe       > "Ibm-netrexx"mailing list]
>>  >
>>  > It appears that my attempt to add emphasis was not entirely
>> successful. :-/
>>  >
>>  > The line should read:
>>  >
>>  >
>> "_unlike_Object_Rexx,_it_could_not_be_a_fully_upwards-compatible_extension_of_the_language_."
>>
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)
12