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: 14
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: 2569
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: 14
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 sort to find out the char which repea... Mainframe Interview Questions 10
No new posts Call an hlasm from REXX in batch and ... CLIST & REXX 4
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files and write Matched/Unm... JCL & VSAM 8
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
Search our Forums:

Back to Top