Yes it would - trash a bunch of other characters that is.
But I was also taking advantage here that the OP specified he was working
with domain names, and the only valid characters for domain names are the
alphabetics, the numerics, plus . (dot) and - (hyphen).
So none of the other characters should ever appear in any of the data he's
working with. If they do, then it's not a valid domain name. I supposed I
should have added one more character to the "restore" logic and that would
have been : (colon) x'7A' for cases when there's an explicit port specified
along with the domain name (if that applies to his situation).
Again, I'm not saying my solution was the "best", it was just another way to
accomplish the stated job that I found mentally entertaining.
Here's a modified way to do it that doesn't trash any characters and avoids
having to type in the alphabet multiple times (still EBCDIC only).
/* This only needs to be done once to initialize _LOWMASK and _HIGHMASK */
_RANGE1 = BITAND('123456789',COPIES('10001111'b,9)); /*generate lowercase a
thru i */
_RANGE2 = BITAND('123456789',COPIES('10011111'b,9)); /*generate lowercase j
thru r */
_RANGE3 = BITAND('23456789',COPIES('10101111'b,9)); /*generate lowercase s
thru z */
_LOWMASK = _RANGE1||_RANGE2||_RANGE3; /* lowercase alphabet */
_HIGHMASK = TRANSLATE(_LOWMASK); /* uppercase alphabet */
/* Then whenever you need to convert upper to lower, just... */
_OUTPUT = TRANSLATE(_INPUT,_LOWMASK,_HIGHMASK);
I love REXX. For working with and manipulating character data in an
arbitrary format, "scraping" information out of formatted reports, command
output, etc. there is no other language that comes close to its capabilities
- especially when you need/want to design logic that has the ability to
insulate itself from minor format changes in the input data without
breaking.
For the 'heavy lifting', I write Assembler.
Robert