View previous topic :: View next topic
|
Author |
Message |
justjpr
New User
Joined: 03 Nov 2022 Posts: 33 Location: INDIA
|
|
|
|
Hi,
Please provide me the logic to compare 2 alphabets in a REXX. I need to find the greatest alphabet among them.
Inputs are always in UPPER CASE ALPHABETS.
If anyone of the input is Z, I need to say "Invalid scenario".
eg:
Inputs ==> Output
B,C ==> C
A,C ==> C
F,B ==> F
Z,A ==> I need to say "Invalid scenario"
Y,Z ==> I need to say "Invalid scenario"
I know I can do this by comparing the ASCII values. But I see neither ALPHABET to ASCII conversion nor ASCII to ALPHABET conversion in rexx.
Thanks. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
You can convert character sets by using the TRANSLATE() function, but you need to provide your own translate tables.
You should be able to do your comparisons using the MAX() built-in function.
And look for Z using the POS() built-in function.
See the Rexx Reference manual. |
|
Back to top |
|
|
justjpr
New User
Joined: 03 Nov 2022 Posts: 33 Location: INDIA
|
|
|
|
Thanks Pedro. It helped. I have used the translate function. |
|
Back to top |
|
|
|