This is a really nice example of the use stems can be put to once one stops thinking of them as arrays.
To my mind though it contains one potential bug -- it depends on FORMAT and MNENO remaining uninitialized. I would prefer to prefix such symbols with, eg, a 0 to make sure they couldn't be, eg 0FORMAT and 0MNEMO. Or, in programs with more complex lookups, I would often be more explicit: 0Opcode2Mnemonic and 0Opcode2Format, which helps me to remember what to put in as as well as what (should) come out: useful as my memory fades... i ------ Original Message ------ Received: Thu, 19 Mar 2009 02:51:09 AM COT From: Arthur Fichtl <arthur_fic...@afisumag.de> To: IBM-MAIN@bama.ua.edu Subject: Stems as associative memory (Was: Multi-dimensional arrays in REXX) > One sort of applying this technique of stems is to use the as > associative memory - where the content of a storage location is used as > an address. Ther rules for resolving elements of a stem variable state > that all parts after the first part of a stem are subject to be resolved. > As shown in ISDA (the small interactive disassembler in cbttape), which > is completely written in Rexx, it works as folllows: > > Consider a hexcode sequence containing the following (hex)-characters: > 0E1A > this is resolved to: > MVCL R1,R10 > > Internally it is accomplished by looking for the symbolic representation > of x'0E' : > OPCODE.0E.FORMAT = 'RR' ; OPCODE.0E.MNEMO = 'MVCL' > > the Rexx-instructions are: > Inst_Form = getInstruction_Format(hexaopcod) > . > . > . > getInstruction_Format: > arg hxo /* hexadecimal Opcode */ > oform = opcode.hxo.fomat > return oform /*returns 'RR'*/ > > . > . > . > IMnemo = opcode.hxo.mnemo /* IMenmo = 'MVCL' */ > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO > Search the archives at http://bama.ua.edu/archives/ibm-main.html > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html