What you do is take advantage of substitution itself to use a variable name that is not all upper case:
i = 'Peter'
cb.i = 1
SAY cb.i I just wonder why then
Cb.Fred=5 SAY cb.fred
works as if there was no difference between Cb.Fred and Cb.fred This works because, when REXX loads a script, it automatically upper-cases everything except what is inbetween quotes (ie, a literal string). So your script gets loaded as:
CB.FRED = 5 SAY CB.FRED
Notice that everything not in quotes is converted to upper-case. So, the mixed case in your original script is irrelevant. The variables names match up once the script is loaded.
So tail names that you specify in the script always take on upper-case. You therefore normally don't run into problems until you do that tail assignment above, which is what Peter did:
cb.peter = 5
VAR = 'Peter'
SAY cb.var The moral of the story:
When you intend to use a variable as a tail name, make sure the variable's value is numeric (ie, defeats substitution), or is all upper-case. (Or, the variable was never assigned a value, in which case its value is the variable name upper-cased).cb.peter = 5
VAR = 'PETER'
SAY cb.var |