IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare 2 alphabets in a REXX and find the greatest one


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
justjpr

New User


Joined: 03 Nov 2022
Posts: 33
Location: INDIA

PostPosted: Sat Jun 29, 2024 12:21 am
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2594
Location: Silicon Valley

PostPosted: Sat Jun 29, 2024 3:04 am
Reply with quote

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
View user's profile Send private message
justjpr

New User


Joined: 03 Nov 2022
Posts: 33
Location: INDIA

PostPosted: Sat Jun 29, 2024 9:10 am
Reply with quote

Thanks Pedro. It helped. I have used the translate function.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
Search our Forums:

Back to Top