home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.rexx
- Path: sparky!uunet!mcsun!sunic!sejnet.sunet.se!eric
- From: eric@sejnet.sunet.se (Eric Thomas)
- Subject: Re: Eric's question
- Message-ID: <1992Aug29.170623.1@sejnet.sunet.se>
- Lines: 93
- Sender: news@sunic.sunet.se
- Reply-To: ERIC@SEARN.SUNET.SE
- Organization: SUNET, Stockholm, Sweden
- References: <ANDERS.92Aug29050537@lise3.lise.unit.no> <1992Aug29.163731.1@sejnet.sunet.se>
- Date: Sat, 29 Aug 1992 17:06:23 GMT
-
- I apologize for the previous post where I quoted everything and said nothing -
- I must have hit the wrong key. Here is what I meant to say :-)
-
- In article <ANDERS.92Aug29050537@lise3.lise.unit.no>, anders@lise3.lise.unit.no (Anders Christensen) writes:
- > Eric Thomas <eric@sejnet.sunet.se> wrote:
- >
- >> Ok, time for the usual stupid question. Say I have a program that does:
- >>
- >> Parse var line ':'tagname'.'value' :'line
- >
- > I assume:
- >
- > * You have a program containing this line, and you have a NAMES file
- > as data which it shall process.
-
- Noooooooooooooooooooo! Forget the NAMES file, this has nothing to do with the
- NAMES format and the NAMEFIND utility. I just have the habit to give "real
- life" examples, to prevent people from saying "yeah but in reality you'd never
- need to do that". There are thousands of other examples, this is a REXX problem
- not a problem with the NAMES format. Let me change my example to:
-
- Parse var data a b . ' A('c')' d
-
- > * You want to be able to use the program on several platforms,
-
- No, and in my opinion this portability concern is what keeps you guys off track
- all the time. Portability between different systems is totally irrelevant, the
- only thing that matters is portability between different REXX interpreters on
- the same type of system. That is, if I write a neat REXX utility for bsd 4.3,
- it would be nice if it worked on all bsd 4.3 systems, regardless of the REXX
- interpreter they are using. I know very well that it won't work on other
- systems regardless of how clever the command trapping syntax comp.lang.rexx
- designed is, because 'ls' won't quite do what my program expects on CMS, VMS,
- MVS, MS-DOS, you name it. I also know that my knowledge of REXX on CMS won't
- help me write anything but simple scripts on unix, because anything beyond the
- format of expressions and if/then/else &co will be different - I'll have to
- forget about DIAG and learn about LINEIN and the like.
-
- My question was more simple: say I have to write a program on one of these
- systems with the 200 types of blanks, and you give me a REXX interpreter that
- supports them the way you suggested. What does my PARSE statement do? I won't
- be able to write working REXX programs if the interpreter and I don't agree on
- the meaning of such simple thing as a PARSE statement with a literal string.
- How do I tell the interpreter which of my spaces mean SPACE and which mean
- white space, given that REXX must accept any literal string?
-
- > Since EBCDIC
- > don't use Tabs, the Tabs in ASCII are translated into EBCDIC
- > Spaces.
-
- By the way, ASCII tabs are translated to EBDIC "program tab". XEDIT does
- support tabs, but they are a software concept (controlled by a SET TABS editor
- command, rather than something you define on the setup screen of your
- terminal). XEDIT normally expands tabs when you enter them, but you can get
- them if you really want to (for more information, see the help on the COMPRESS,
- EXPAND and SET IMAGE commands).
-
- > Or suppose
- > that you wanted the pattern to match any number of 'a's before two
- > 'b's? You can match a specific number of 'a's before two 'b's, but not
- > an arbitrary number of 'a's.
-
- I've written some 100k lines of REXX and never had that need. If the few cases
- where I do need to do such things, I code 2-3 lines of REXX instead of a magic
- formula. What do you prefer?
-
- --------------- Program 1 --------------------
- /* Warning: typed from memory on a VMS system, please forgive errors */
- Parse Value Diag(8,'Q F *') with ':' a . ',' b . ',' c . '15'x
- t = 0
- If Datatype(a,'W') Then t = t + a
- If Datatype(b,'W') Then t = t + b
- If Datatype(c,'W') Then t = t + c
- Return t
- --------------- Program 2 --------------------
- /* Program split into 2 lines for easier reading */
- Interpret "Return 0+0"Translate(Space(Translate(Diag(8,'Q F *'),,,
- XRange('00'x,'EF'x))),'+',' ')
- ----------------------------------------------
-
- If REXX function names were less verbose, the second program might almost look
- unixish :-)
-
- > Regexps are very powerful, and definitively more powerful than the
- > pattern matching of parse. Including regexps into parse' pattern
- > matching would indeed add to its power.
-
- Oh, please. Why not include awk as well, and all the other unix stuff? People
- who want to program in perl can (and do) use perl. REXX is designed to be easy
- to learn by people without a DP background. Regular expressions are not
- precisely intuitive for this type of people :-)
-
- Eric
-