View Single Post
Old 04 July 2015, 15:30   #9
BigFan
Registered User
 
BigFan's Avatar
 
Join Date: Feb 2014
Location: Germany
Posts: 261
Thanks for the flowers

Now after we did what the author said without asking why, it's time to have a look at syntax!
Though DOS batchfiles and Rexx scripts look similar there are fundamental differences.

Check out quotation marks. Where DOS expects double quotes ", Rexx uses single quotes '. THIS IS VERY IMPORTANT !

DOS will not deal with path names as strings if they contain white spaces, until wrapped in "".

ARexx on the other hand uses ' single quotes. If you want to send a " from within a rexx script,
wrap it in single quotes which is very hard to read and prone to errors.
e.g.
path0 = 'Ram Disk:'
Address command 'cd 'path0

Though arexx correctly concatenates strings ('cd ' is first string and content of path0 is 2nd) it will throw
an error. The path contains white space. The error code is sent by DOS command cd. Cd can't find "Ram".

alter it to
path0 = 'Ram Disk:'
Address command 'cd "'path0'"'

to make it work.
The command string is now build from
'cd " ' + content of path0 + ' " '=
cd " + Ram Disk: + " =
cd "Ram Disk:"

This is hell. The more you glue together, the more gibberish it looks like.
from example above
Code:
Address command 'version >' tempfile ' "'actdir||item'" file 'fullversion
If there is a quote missing or too much, ARexx will complain and tell you the
line in source that is causing trouble, but damn, which one of these flyspecks was set wrong ?

Another big difference is the way we set comments.
In DOS you just place a semicolon ; in front and everything behind is ignored till end of line like:

version >NIL: icon.library version 46 ; check for peters lib

In ARexx the semicolon is used to separate commands from each other in one line. f.e.:

Address dopus.1;verify 'are you sure?';if rc=1 then exit;

A comment in ARexx starts with this pair of characters /*
and ends with its counterpart */
All text in between will be ignored, no matter how many lines of text are encapsuled.
/*
Our first script
*/

or for a single line

Say Show('p',rexx) /* check for rexx port*/

Nested comments are allowed like /* outer /*inner comment*/ comment*/
Beware that this is difficult to read and if you forget to set one of these "slashterixes" ARexx may start to interpret the next word
as a command.
.

Last edited by BigFan; 05 July 2015 at 01:07.
BigFan is offline  
 
Page generated in 0.04549 seconds with 11 queries