Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

REXX Upper case letter issue

76 views
Skip to first unread message

Mainframe Mainframe

unread,
Nov 12, 2015, 3:21:18 AM11/12/15
to
I am new in Rexx and just trying to automate the host detail using this
rexx program.

In this rexx I am expecting user to pass host name and then rexx will
fetch all detail about that host.

The issue is that the input file from where the the rexx fetch the detail
are in small letters. So, when we run the rexx and if anybody type host
name in capital letter then rexx doesnt understand anythng and gives me
error.

I checked in rexx online manual but dont have any inbuilt function for
doing this task. Can you please help me solving this issue.

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Höglund Lars

unread,
Nov 12, 2015, 3:30:21 AM11/12/15
to
TRANSLATE?

//Lasse

-----Ursprungligt meddelande-----
Från: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] För Mainframe Mainframe
Skickat: den 12 november 2015 09:21
Till: TSO-...@VM.MARIST.EDU
Ämne: [TSO-REXX] REXX Upper case letter issue

Michael Klaeschen

unread,
Nov 12, 2015, 3:33:25 AM11/12/15
to
PARSE UPPER file input and go on with majuscles. Or TRANSLATE user input
to minuscles.
_________________________
_________________________
____________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
_________________________
_________________________
____________________


Basler Sachversicherungs-AG
Amtsgericht Bad Homburg v.d.H., HRB 9357 | USt-ID-Nr. DE 276021973
Basler Straße 4, 61345 Bad Homburg v.d.H.
Vorstand: Dr. Jürg Schiltknecht - Vorsitzender, Kay Bölke, Markus Jost,
Ralf Stankat, Dr. Alexander Tourneau
Aufsichtsratsvorsitzender: Dr. Martin Strobel

Basler Lebensversicherungs-AG |
Amtsgericht Hamburg, HRB 4659 | Ust-ID-Nr. DE 276021973
Ludwig-Erhard-Straße 22, 20459 Hamburg
Vorstand: Dr. Jürg Schiltknecht - Vorsitzender, Kay Bölke, Markus Jost,
Ralf Stankat, Dr. Alexander Tourneau
Aufsichtsratsvorsitzender: Dr. Martin Strobel

Basler Versicherung AG Direktion für Deutschland |
Amtsgericht Bad Homburg v.d.H., HRB 1228 | USt-ID-Nr. DE 281452875
Basler Straße 4, 61345 Bad Homburg v.d.H.
Hauptbevollmächtigter für Deutschland: Dr. Jürg Schiltknecht

Basler Leben AG Direktion für Deutschland |
Amtsgericht Bad Homburg v.d.H., HRB 1229 | Ust-ID-Nr. DE 281452875
Basler Straße 4, 61345 Bad Homburg v.d.H.
Hauptbevollmächtigter für Deutschland: Dr. Jürg Schiltknecht

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

Mainframe Mainframe

unread,
Nov 12, 2015, 3:45:44 AM11/12/15
to
I want to convert upper case to lower, if anybody type host name in upper
case . If they type in lower case , my script works fine but input text
file has all host name written in lower case.

Can you please explain in this detail.

Walter Pachl

unread,
Nov 12, 2015, 3:49:52 AM11/12/15
to
abc='abc...'
abc_u=translate(abc)
t=translate(s,abc,abc_u)
Walter

Lizette Koehler

unread,
Nov 12, 2015, 9:29:08 AM11/12/15
to
You might try putting in a test

(Pseudo code)

If data = Upper case, then X
Else, Y

Test to see if data is upper or lower case, then translate as needed. Or you could translate all the time. Use a temp var. You will not be changing the original data that way.

Lizette

Robin Ryerse

unread,
Nov 12, 2015, 9:41:00 AM11/12/15
to
always_lower = bitor(source_text,x'7f7f7f7f.....')


-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Mainframe Mainframe

Robin Ryerse

unread,
Nov 12, 2015, 9:59:34 AM11/12/15
to
My earlier response using BITOR() will work only if the source is all alpha. Numerics in the source will become unrecognizable.




-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Mainframe Mainframe
Sent: November 12, 2015 3:20 AM
To: TSO-...@VM.MARIST.EDU
Subject: [TSO-REXX] REXX Upper case letter issue

Ken MacKenzie

unread,
Nov 12, 2015, 10:09:47 AM11/12/15
to
In these situations (when users are involved) and are expected to type all
upper or all lower, I always allow for finger trouble and I would do
something like:

If Translate(user_supplied_data) = Translate(data_from_file) Then
Whatever

So, if the data contains BaNaNa and the user types bAnAnA it still
matches.

Nice simple approach - no data is changed permanently.

Ken MacKenzie
Pramerica Systems Ireland Limited
is a private company limited by shares
incorporated and registered in the Republic of Ireland with registered
number 319900
and registered office at 6th Floor, South Bank House, Barrow Street,
Dublin 4, Ireland.




From: Mainframe Mainframe <mainfr...@GMAIL.COM>
To: TSO-...@VM.MARIST.EDU,
Date: 12/11/2015 08:21
Subject: [TSO-REXX] REXX Upper case letter issue

Farley, Peter x23353

unread,
Nov 12, 2015, 10:32:16 AM11/12/15
to
TRANSLATE(hostname, XRANGE('a', 'z'), XRANGE('A', 'Z'))

You can make the XRANGE's a concatenation of a-I, j-r, s-z if you want to be totally accurate, but the single ranges should do for most characters that can be typed at a keyboard.

HTH

Peter

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Mainframe Mainframe
Sent: Thursday, November 12, 2015 3:20 AM
To: TSO-...@VM.MARIST.EDU
Subject: REXX Upper case letter issue

I am new in Rexx and just trying to automate the host detail using this
rexx program.

In this rexx I am expecting user to pass host name and then rexx will
fetch all detail about that host.

The issue is that the input file from where the the rexx fetch the detail
are in small letters. So, when we run the rexx and if anybody type host
name in capital letter then rexx doesnt understand anythng and gives me
error.

I checked in rexx online manual but dont have any inbuilt function for
doing this task. Can you please help me solving this issue.

--


This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.

Ken MacKenzie

unread,
Nov 12, 2015, 10:46:35 AM11/12/15
to
There's no need for the second and third parameters. The default for
TRANSLATE is to convert to UPPER-CASE.

From REXX Reference manual:
If you specify neither translation table and omit pad, string is simply
translated to uppercase (that is, lowercase a?z to uppercase A?Z)

Ken MacKenzie
Pramerica Systems Ireland Limited
is a private company limited by shares
incorporated and registered in the Republic of Ireland with registered
number 319900
and registered office at 6th Floor, South Bank House, Barrow Street,
Dublin 4, Ireland.




From: "Farley, Peter x23353" <Peter....@BROADRIDGE.COM>
To: TSO-...@VM.MARIST.EDU,
Date: 12/11/2015 15:33
Subject: Re: [TSO-REXX] REXX Upper case letter issue
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>



Farley, Peter x23353

unread,
Nov 12, 2015, 11:23:56 AM11/12/15
to
Please re-read the OP's second message. He asks how to convert input to lower case, not upper.

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Ken MacKenzie
Sent: Thursday, November 12, 2015 10:46 AM
To: TSO-...@VM.MARIST.EDU

Robert Zenuk

unread,
Nov 12, 2015, 4:53:50 PM11/12/15
to
I frequently use the same technique Ken suggests. Here is something quick and dirty that does lookups against "mixed" data.

/* rexx */
arg hostlist
host.1 = 'myhost1'
host.2 = 'MYHOST2'
host.3 = 'myhost3'
host.4 = 'MYHOST4'
host.5 = 'myhost5'
host.6 = 'MYHOST6'
host.7 = 'myhost7'
host.8 = 'MYHOST8'
host.9 = 'myhost9'
host.10 = 'vmhost1'
host.11 = 'VMHOST2'
host.12 = 'vmhost3'
host.13 = 'VMHOST4'
host.14 = 'vmhost5'
host.15 = 'VMHOST6'
host.16 = 'vmhost7'
host.17 = 'VMHOST8'
host.18 = 'vmhost9'
host.0 = 18
hosts = 0
say 'Looking for hosts containing:' hostlist
do l=1 to host.0
do h=1 to words(hostlist)
if pos(word(hostlist,h),translate(host.l)) <> 0 then
do
say host.l
hosts = hosts + 1
end
end
end
say hosts 'hosts found'


This will accept a list of full names or partial names and return the ones found in the stem.

Rob

Paul Gilmartin

unread,
Nov 12, 2015, 6:44:03 PM11/12/15
to
On 2015-11-12 08:31, Farley, Peter x23353 wrote:
> TRANSLATE(hostname, XRANGE('a', 'z'), XRANGE('A', 'Z'))
>
> You can make the XRANGE's a concatenation of a-I, j-r, s-z if you want to be totally accurate, but the single ranges should do for most characters that can be typed at a keyboard.
>
Or, you could try (untested):

translate( hostname, xrange( 'a', 'z' ), translate( xrange( 'a', 'z' ) ) )

... which should change only alphabetic characters.

(Why is it called "Xrange"? Since it's a range of characters, "Crange"
would be more appropriate.)

-- gil

Paul Gilmartin

unread,
Nov 13, 2015, 9:52:09 AM11/13/15
to
On 2015-11-12, at 08:46, Ken MacKenzie wrote:

> There's no need for the second and third parameters. The default for
> TRANSLATE is to convert to UPPER-CASE.
>
But the intent was to convert to lower case.

> From: "Farley, Peter x23353"
> Date: 12/11/2015 15:33
>
> TRANSLATE(hostname, XRANGE('a', 'z'), XRANGE('A', 'Z'))

-- gil

Paul Gilmartin

unread,
Nov 13, 2015, 10:00:56 AM11/13/15
to
On 2015-11-12, at 07:41, Robin Ryerse wrote:

> always_lower = bitor(source_text,x'7f7f7f7f.....')
>
Won't that convert every character in source_text either to '7f'x or
to 'ff'x?

-- gil

Nims,Alva John , Al

unread,
Nov 13, 2015, 10:41:13 AM11/13/15
to
Yes, I think it would and anything that attempted to use any of the "bitxxxx" routines of REXX (attempt to turn the second bit of the 8 bit string off ("0")), you would have to make sure that only letters are involved, if there was a number in there it make it an unusable character, let alone what would happen if there were any of the allowed special characters in the string.

I think the best method would be to use a more "brute force" method:
Lower = xrange("a","i")||xrange("j","r")||xrange("s","z");
Upper = xrange("A","I")||xrange("J","R")||xrange("S","Z");
........
Always_lower = translate(source,lower,upper);

This way any numbers or special characters would be unaffected.

Al Nims
Systems Admin/Programmer 3
EI&O
University of Florida
(352) 273-1298

Styles, Andy , SD EP zPlatform

unread,
Nov 13, 2015, 10:43:44 AM11/13/15
to
But XRANGE doesn't only do alphabetic characters:

say c2x(xrange('I','J'))
C9CACBCCCDCECFD0D1

say x2c(c2x(xrange('I','J')))
I ôöòóõ}J

(on my screen in EBCDIC anyway).

--
Andy Styles

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Paul Gilmartin
Sent: 12 November 2015 23:44
To: TSO-...@VM.MARIST.EDU
Subject: Re: [TSO-REXX] REXX Upper case letter issue

-- This email has reached the Bank via an external source --
Lloyds Banking Group plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland no. SC95000. Telephone: 0131 225 4555. Lloyds Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales no. 2065. Telephone 0207626 1500. Bank of Scotland plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland no. SC327000. Telephone: 03457 801 801. Cheltenham & Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered in England and Wales 2299428. Telephone: 0345 603 1637

Lloyds Bank plc, Bank of Scotland plc are authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and Prudential Regulation Authority.

Cheltenham & Gloucester plc is authorised and regulated by the Financial Conduct Authority.

Halifax is a division of Bank of Scotland plc. Cheltenham & Gloucester Savings is a division of Lloyds Bank plc.

HBOS plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland no. SC218813.

This e-mail (including any attachments) is private and confidential and may contain privileged material. If you have received this e-mail in error, please notify the sender and delete it (including any attachments) immediately. You must not copy, distribute, disclose or use any of the information in it or any attachments. Telephone calls may be monitored or recorded.

Paul Gilmartin

unread,
Nov 13, 2015, 10:47:41 AM11/13/15
to
On 2015-11-13, at 08:26, Nims,Alva John (Al) wrote:

> Yes, I think it would and anything that attempted to use any of the "bitxxxx" routines of REXX (attempt to turn the second bit of the 8 bit string off ("0")), you would have to make sure that only letters are involved, if there was a number in there it make it an unusable character, let alone what would happen if there were any of the allowed special characters in the string.
>
> I think the best method would be to use a more "brute force" method:
> Lower = xrange("a","i")||xrange("j","r")||xrange("s","z");
> Upper = xrange("A","I")||xrange("J","R")||xrange("S","Z");
> ........
> Always_lower = translate(source,lower,upper);
>
> This way any numbers or special characters would be unaffected.
>
Yet one might wonder why, given that z/OS resources (DSNs, member names,
system names) are conventionally, canonically in majuscule, they appear
perversely in lower case in the OP's reference file.

Baldon, David

unread,
Nov 13, 2015, 10:59:20 AM11/13/15
to
lcase = 'abcdefghijklmnopqrstuvwxyz'
ucase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

if translate(user_host, lcase, ucase) = file_host then
say "Bob's your uncle"

Flip the lcase and ucase variables in the translate function to go the other way.

If you need to compare the value in user_host more than once, I recommend translating the value just once and then using the translated value in any subsequent comparisons. Like this;
user_host = translate(user_host, lcase, ucase)
if user_host = file_host then
say "Bob's your uncle"

...David

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Mainframe Mainframe
Sent: Thursday, November 12, 2015 2:45 AM
To: TSO-...@VM.MARIST.EDU
> For more information please visit https://urldefense.proofpoint.com/v2/url?u=http-3A__www.symanteccloud.com&d=BQIFaQ&c=UrUhmHsiTVT5qkaA4d_oSzcamb9hmamiCDMzBAEwC7E&r=KigCN-TlaQoAQDZrna0ZVLUX9H9vZpSibySEyujWvHQ&m=I42TKubvjxqdBf7TuEynRX_AKykaod2tWoPFlRNk0yI&s=8yBwVp5KV9-HM8kT0_tEijLlr9Ox2JsX8vwVBEYa8c0&e=
> For more information please visit https://urldefense.proofpoint.com/v2/url?u=http-3A__www.symanteccloud.com&d=BQIFaQ&c=UrUhmHsiTVT5qkaA4d_oSzcamb9hmamiCDMzBAEwC7E&r=KigCN-TlaQoAQDZrna0ZVLUX9H9vZpSibySEyujWvHQ&m=I42TKubvjxqdBf7TuEynRX_AKykaod2tWoPFlRNk0yI&s=8yBwVp5KV9-HM8kT0_tEijLlr9Ox2JsX8vwVBEYa8c0&e=

Robert Garrett

unread,
Nov 13, 2015, 12:57:23 PM11/13/15
to
Use this old assembler programmers trick, which takes advantage of the fact that in EBCDIC, the only difference between upper and lower case characters is the x'40' bit.
So...

_DATA = 'THIS.IS.UPPERCASE';

_LOWDATA = BITAND(_DATA,COPIES('10111111'b,LENGTH(_DATA))); /* This does the conversion, but also will mess up numerics plus the - and . characters, so to restore those... */
_LOWDATA = TRANSLATE(_LOWDATA,'0123456789.-',,
BITAND('0123456789.-',COPIES('10111111'b,12)),
); /* Translate the messed up versions of those characters back to the corresponding originals */

say _LOWDATA;

Yes, this transformation requires two statements when you could do the same thing with just one TRANSLATE as mentioned previously, but this method does have a 'cool' factor going for it.
(Note, this logic won't come CLOSE to working correctly on an ASCII system either...)

Rob

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Mainframe Mainframe
Sent: Thursday, November 12, 2015 2:20 AM
To: TSO-...@VM.MARIST.EDU

Christel und Walter Pachl

unread,
Nov 13, 2015, 4:52:10 PM11/13/15
to
I posted pretty much the same with
ucase=translate(lcase)
instead of typing the alphabet twice
And for the reverse target=translate(source) is good enough (without flipping)

Walter

-----Ursprüngliche Nachricht-----
Von: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] Im Auftrag von Baldon, David
Gesendet: Freitag, 13. November 2015 16:58
An: TSO-...@VM.MARIST.EDU
Betreff: Re: [TSO-REXX] REXX Upper case letter issue

lcase = 'abcdefghijklmnopqrstuvwxyz'
ucase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

Robert Garrett

unread,
Nov 14, 2015, 12:17:40 PM11/14/15
to
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

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of
Paul Gilmartin
Sent: Friday, November 13, 2015 8:54 AM
To: TSO-...@VM.MARIST.EDU

Robert Garrett

unread,
Nov 14, 2015, 12:25:14 PM11/14/15
to
...or similarly...

_LOWER = TRANSLATE(_UPPER,XRANGE('a','i')||XRANGE('j','r')||XRANGE('s','z'),
XRANGE('A','I')||XRANGE('J','R')||XRANGE('S','Z'));

... all in one swell foop... :)

Robert

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of
Paul Gilmartin
Sent: Friday, November 13, 2015 8:54 AM
To: TSO-...@VM.MARIST.EDU
Message has been deleted
0 new messages