[comp.lang.rexx] AREXX vs REXX

rap@peck.ardent.com (Rob Peck) (08/16/89)

When preparing to give a tutorial on AREXX, I had the chance to study the
IBM tutorial document on REXX, (my thanks to Lionel Hummel of PDC fame
for telling me about it), the Colinshaw book (which at 42.95 was more
than I paid for AREXX in the first place) and Bill Hawes AREXX reference
manual.   What folks will be interested in is that yes, all of the basics
of REXX are in AREXX.  However there are some extensions that are certainly
Amiga specific.  The one that comes to mind most vividly is the ability
of AREXX to open/read/write files line by line or character by character.
I don't recall seeing this in the IBM version.  I suppose SOMEONE could go
through the documentation (Colinshaw vs Hawes) and explicitly list the
extensions so that folks familiar with REXX would see, as scripts are
posted, where extensions are being used.  However if there is relatively
little traffic here, it may not matter.  How about we just identify
which of the two worlds it comes from (Amiga/IBM) and let the reader
decide if it would be worth perusing the script for ideas.

For those who might be interested, I'll be giving an AREXX tutorial at
Ami Expo, Santa Clara, CA, on October 22, 1989.  Primary emphasis will be
on new user's intro, however the last time around, I had two (of 14)
registrants with a great deal of experience and I was pleasantly surprized
at having been able to answer their questions as well.  I had posted a
message that I am collecting scripts for public consumption and would be
pleased to acknowledge their source.  I make the same offer here -- if
you have something you feel might be useful to a lot of folks, I'd be
pleased to look it over and include it on disk (modified if necessary
for its environment -- REXX->AREXX if appropriate).  For example,
I've created a file HELP.REXX that prints the comment lines from any
AREXX script up to a point where the comments are interrupted by either
a blank line or a line with no comment on it.  The file works, but has
a slight problem with nested comments (which are allowed by AREXX).
When it is fixed, I'll post it.  It is AREXX specific because it reads
files, as compared to the equivalent program (segment) in the REXX
tutorial that prints the help lines in a particular file (built in help)
by using the 'sourceline()' function.


Rob Peck

patterso@hardees.rutgers.edu (Ross Patterson) (08/16/89)

Rob Peck <rap@peck.ardent.com> writes:
>... tutorial document on REXX, (my thanks to Lionel Hummel of PDC fame
>for telling me about it), the Colinshaw

That's Cowlishaw, not Colinshaw. Mike Cowlishaw designed the REXX language
while working for IBM both in England and at the Watson Labs in Yorktown
Heights, New York. In addition to designing the language, he also wrote the
IBM 370 implementation (in assembler), which is the basis of the CMS and TSO
REXX products. 

>                                        book (which at 42.95 was more
>than I paid for AREXX in the first place) and Bill Hawes AREXX reference
>manual.   What folks will be interested in is that yes, all of the basics
>of REXX are in AREXX.  However there are some extensions that are certainly
>Amiga specific.  The one that comes to mind most vividly is the ability
>of AREXX to open/read/write files line by line or character by character.

This isn't an  Amiga-specific extension.   The  LineIn(), LineOut(), CharIn(),
and CharOut() functions were defined by Cowlishaw, but never incorporated into
the IBM 370 versions.  There is an appendix in Cowlishaw's book that describes
the IBM 3270 implementations, and explicitly  states the  differences from the
language as defined in the book.  I don't have my copy here, but  as I recall,
they are:

	1) No LineIn(), LineOut(), CharIn(), CharOut(), Lines() and Chars()
	   functions. Other facilities, native to CMS and imported into TSO,
	   are used for file I/O ("EXECIO" to those who care).

	2) The IBM 370 versions use Parse External instead of Parse LineIn,
	   and have an Externals() function that returns the number of lines 
	   in the external data queue.

>                                                     For example,
>I've created a file HELP.REXX that prints the comment lines from any
>AREXX script up to a point where the comments are interrupted by either
>a blank line or a line with no comment on it.  The file works, but has
>a slight problem with nested comments (which are allowed by AREXX).

Nested comments are allowed in standard REXX as well.

Ross Patterson
Rutgers University

kenm@natinst.com (Ken McKinney) (08/17/89)

        IBM REXX (at least up to VM/SP 5.0) doesn't have any facilities
for reading files in it.  At IBM, we used the CMS EXECIO command or invoked
an XEDIT macro when we wanted to do file I/O (which was pretty much all the
time).  The EXECIO command was fairly primitive due to the limitations of
the CMS file structure; It couldn't read in less than a line at a time.  Of
course there was always XEDIT;  you could do almost anything with it.  XEDIT
blows VI away (and it has to work in block mode!).  It's the most customizable
editor I've ever seen, although I understand EMACS comes close.
REXX and XEDIT make a great team.  Does AREXX work well with the amiga editor?


Ken McKinney (ex REXX programmer)
National Instruments
 Austin, TX

jac@muslix.llnl.gov (James Crotinger) (08/17/89)

In article <4060@natinst.natinst.com> kenm@natinst.com (Ken McKinney) writes:
[...]
>REXX and XEDIT make a great team.  Does AREXX work well with the amiga editor?
>

  There are now several Amiga editors which support AREXX, and since
AREXX will be bundled with the next version of the OS, I suspect that
having an AREXX interface will be a pretty basic requirement for text
editors. 

  The REXX/Editor combination is definitly a great one. For instance,
AmigaTeX (the Amiga implementation of Knuth's TeX typesetting package)
has excellent AREXX support. With AREXX and a compatible editor, this
allows one to build a very nice integrated environment. For instance,
I can send a file off to be previewed or printed, or (my favorite) I
can mark a section of text (e.g. an equation or table) and have TeX
preview only that piece. 

  I've also written a REXX macro that works with an AREXX compatible
database program. I use that database program for interactive entry
of bibliographical material. Then I have a AREXX macro that will
read the database and create a BibTeX database file. 

>
>Ken McKinney (ex REXX programmer)
>National Instruments
> Austin, TX

  Jim

patterso@hardees.rutgers.edu (Ross Patterson) (08/17/89)

Back at home now, I've had a chance to check Cowlishaw's book. He details
the differences between 370 REXX and his definition in Part 3, Section 5.
The 370 implementation differs in that:

	1) Literal strings are allowed to cross line boundaries.

	2) There is no WordPos() function. Instead, there is a Find()
	   function that takes the arguments reversed (but lacks a "start"
	   argument.

	3) The Time() function doesn't accept the "Civil" or "Normal"
	   options. [remedied in VM/SP release 6]

	4) The Date() function doesn't accept the "Normal" option. [also
	   remedied in VM/SP 6]

	5) The Verify() function doesn't accept the "NoMatch" option,
	   although it is the default action.

	6) SIGNAL ON FAILURE and TRACE FAILURE are not implemented.
	   [remedied in VM/SP 6]

	7) NUMERIC FORM doesn't accept the VALUE option, and the Digits(),
	   Form() and Fuzz() functions aren't implemented.

	8) "\" isn't a "not sign" (the EBCDIC not sign is used instead).

	9) "==" and "\==" are the only implemented strict comparison
	   operators.

	10) The CharIn(), CharOut(), Chars(), LineIn(), and LineOut()
	    functions aren't implemented. Lines() is implemented as
	    Externals(), and PARSE LINEIN is implmented as PARSE EXTERNAL.

	11) Several functions are included that the language doesn't define.
	    They are:

		Find(string,phrase) - Search "string" for "phrase", blank
		delimited. Returns the number of the first matching
		word, or 0 to indicate failure.

		Index(haystack,needle[,start]) - Search "haystack" for
		"needle", beginning at character "start". Returns the number
		of the first matching character, or 0 to indiciate failure.

		Justify(string,length[,padchar]) - Insert "padchar"s between
		blank delimited words in "string" until it is "length"
		characters long. The default "padchar" is the space. Returns
		the justfied string.

		LineSize() - Returns the maximum line length for the SAY
		instruction, or 0 if indeterminate.

		UserId() - Returns the userid of the user running the REXX
		program.

	12) The Date() function accepts an option not defined in the
	    language, "Julian-OS". This returns the date as yyddd, where ddd
	    is the number of days since January 0, 19yy (e.g. 1/1/89 is
	    89001).

	13) The TRACE instruction and the Trace() function accept a "!"
	    prefix, which indicates that Host Commands are not to be passed
	    to the execution environment.

	14) There is an UPPER instruction to translate variables to upper
	    case.

	15) Later release of VM/SP have supported OPTIONS DBCS, for Double
	    Byte Character Set support. This allows things like Japanses Kanji
	    characters in literal strings.

That's the definitive list.

Ross Patterson
Rutgers University

MJB@cup.portal.com (Martin J Brown-Jr) (08/18/89)

In:
6854.3.45.3 Re: AREXX vs REXX
8/16/89 11:00 15/743 kenm@natinst.com (Ken McKinney)

Ken McKinney asks:
                   "Does AREXX work well with the amiga editor?"

I've used both UE (a highly configurable editor) and TxEd Plus, each has
an AREXX port. Mostly, due to its smaller size, I have spent a fair amount
of time with TxEd Plus and its AREXX port. I've found it quite helpful to
control the reference texts in in background windows from the foreground
window where I'm writing source code. In this particular case, I call a
command line in the foreground window (source code), type in a command
(roughly: "address TxEd_Plus_2/c LOA df1:include/xxxxx.h" -- which reads
           command to TxEd window 2, load file xxxxx.h from floppy disk 1 )
to any of the other two or three TxEd editing windows I have open and get
results. I'm  convinced that (A)REXX is the next best thing to multitasking
itself, a great pairing!!

                                 - MJB -