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

REXX Test under Mask???


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

New User


Joined: 07 Oct 2020
Posts: 2
Location: USA

PostPosted: Thu Dec 02, 2021 10:55 pm
Reply with quote

Does REXX have an instruction or way to conduct a Test Under Mask like assembler does? I have a one byte binary field. I need to test if the third bit is on. Only the third bit.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1306
Location: Bamberg, Germany

PostPosted: Thu Dec 02, 2021 10:59 pm
Reply with quote

Code:
 BITAND (Bit by Bit AND)                                                     
                                                                             
+----------------------------------------------------------------------------+
|                                                                            |
|>>---BITAND---(--string1---+----------------------------------+---)-----><  |
|                           +--,--+------------+---+--------+--+             |
|                                 +--string2---+   +--,pad--+                |
|                                                                            |
+----------------------------------------------------------------------------+
                                                                             
 returns a string composed of the two input strings logically ANDed           
 together, bit by bit. (The encoding of the strings are used in the logical   
 operation.) The length of the result is the length of the longer of the     
 two strings. If no pad character is provided, the AND operation stops when   
 the shorter of the two strings is exhausted, and the unprocessed portion     
 of the longer string is appended to the partial result. If pad is           
 provided, it extends the shorter of the two strings on the right before     
 carrying out the logical operation. The default for string2 is the zero     
 length (null) string.
Back to top
View user's profile Send private message
John Duffy

New User


Joined: 07 Oct 2020
Posts: 2
Location: USA

PostPosted: Fri Dec 03, 2021 12:26 am
Reply with quote

Thank You Sir! That worked brilliantly!
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 724
Location: Denmark

PostPosted: Fri Dec 03, 2021 2:54 am
Reply with quote

or use c2x+x2b and then use the substr function.
i.e.:
v = '08'x
say x2b(c2x(v)) /* -> 00001000 */
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 Reroute print output via REXX/SDSF TSO/ISPF 6
No new posts Get RECORD LENGTH, allocated space of... CLIST & REXX 7
No new posts SDSF and Rexx TSO/ISPF 4
No new posts Compare 2 alphabets in a REXX and fin... CLIST & REXX 2
No new posts Call an hlasm from REXX in batch and ... CLIST & REXX 4
Search our Forums:

Back to Top