TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Ivan Todoroski
from: Murray Lesser
date: 1999-01-18 15:35:02
subject: Pl/I

Excerpted from a message dated 01-18-99, Ivan Todoroski to Mike Ruskai:

 IT>> But I was wondering if there is some PL/I equivalent to REXX's
 IT>> xrange(), so that one could avoid typing the translation tables by
 IT>> hand?

 IT>> say translate(infile, xrange("A","Z"),
xrange("a","z"))
 MR> [snip]

 MR> While this works in ASCII and EBCDIC, there's no guarantee that
 MR> letters in a code page are assigned in alphabetical order.  Simply
 MR> typing the alphabet once avoids the potential problem (I'll admit
 MR> I don't know of any character set where it is a problem), and it
 MR> only needs to be typed once.

IT>   Hmmm... haven't thought of this. Good point!

Hi Ivan--

    By now, I assume that you have seen David Noon's PL/I macro that
provides an xrange equivalent.  David is very fond of demonstrating
(sometimes unnecessary) complex constructs with simple PL/I macros :-).
But, as Mike pointed out, you only need write the translate strings once
per module (even in REXX), no matter how many times (or in which
direction) they are to be used.  And you can do things with translate
strings that cannot be done with xrange.  Note the example in the OS/2
REXX documentation showing how you can use translate to reorder the
characters in a string.

    A good computer-system architect provides for a reasonable
generality such that a knowledgeable user can do things that the
architect never thought of.  Think about how much less useful REXX would
be if translate() could be used only with xrange (or the default), but
not with arbitrary translate strings.  On the other hand, how much would
you really lose if REXX's translate() didn't provide xrange and the
default?

    Regards,

        --Murray

___
 * MR/2 2.25 #120 * You can lead a user to Docs, but you can't make 'em read.

--- Maximus/2 2.02
* Origin: OS/2 Shareware BBS, telnet://bbs.os2bbs.com (1:109/347)
SEEN-BY: 396/1 632/0 371 633/260 262 267 270 371 635/444 506 728 639/252
SEEN-BY: 670/218
@PATH: 109/347 104 8 13/25 270/101 140/1 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.