After writing the previous tip I realised that I have not written any tips yet about browsing storage using REXX. Therefore I will now show you how to code the previous tip in REXX.
I have previously used storage browsing as an illustration of why I find PL/I much more elegant than COBOL for storage browsing. I have troubles finding out where I stand on this subject with regards to REXX so I will just show you:
It is the REXX function STORAGE which is the key to storage browsing using REXX. STORAGE returns a string of characters with the length supplied in the second parameter. The first parameter is an address in hex which denotes the starting point in storage of the returned string. The first statement fetches the four bytes from address 548 (in decimal) in storage. Please remember that addresses always start with address zero. The four bytes at address 548 is another address which I want to perform a little calculation on. To do so I have to translate the address to decimal using C2D. Then I am able to add 172 to the address. On this new address is the contens of the JBNI field. I fetch the value of the JBNI field using another STORAGE function call. In the call I have to convert the decimal address into a hex address using D2X. After the call I have to convert JBNI into a decimal value in order to determine wheter it is zero or not.
All these statement can be translated into a single expression which I have put into the example. This single expression is of course much shorter but hard to understand. I find all these conversion between decimal and hex a little annoying, but I am getting used to them. There is a third parameter to the STORAGE function which is another character string. The contens of this character string will be moved to the address indicated by the first parameter.