RE: [U2] [UD] Dynamic variable. Kids, Don't try this at home!!!

2007-04-07 Thread Boydell, Stuart
They actually did use reserved words in their EQUATES, where Universe did not do this sort of replacement, and the target environment behaves like Unidata, causing some code (not an awful amount) to fail compilation. Another lesson here - don't use words that even look like they should be

Re: [U2] [UD] Dynamic variable. Kids, Don't try this at home!!!

2007-04-07 Thread MAJ Programming
@listserver.u2ug.org Sent: Friday, April 06, 2007 6:57 PM Subject: RE: [U2] [UD] Dynamic variable. Kids, Don't try this at home!!! You can come up with some bizzare and totally unportable code in unidata using equates: EQU READNEXT TO 12345 ID='2R' LOOP WHILE READNEXT ID DO CRT READNEXT ID CRT ID

Re: [U2] [UD] Dynamic variable. Kids, Don't try this at home!!!

2007-04-07 Thread MAJ Programming
, Stuart [EMAIL PROTECTED] To: u2-users@listserver.u2ug.org Sent: Saturday, April 07, 2007 9:37 AM Subject: RE: [U2] [UD] Dynamic variable. Kids, Don't try this at home!!! They actually did use reserved words in their EQUATES, where Universe did not do this sort of replacement, and the target

RE: [U2] [UD] Dynamic variable

2007-04-06 Thread Tony Gravagno
Ed wrote: Just discovered something kinda cool that I want to share: Here are a set of equates: 004:EQU TEF.TOTAL.VAL TO SUM(TEF.VAL) 0009: PRINT TOTAL = :TEF.TOTAL.VALR#3 0010: PRINT SUM= :SUM(TEF.VAL)R#3 When you run this, the variable TEF.TOTAL.VAL always knows the

RE: [U2] [UD] Dynamic variable

2007-04-06 Thread u2
TEF.TOTAL.VAL isn't a variable. For the most part, equates are just replacements. Everywhere you have TEF.TOTAL.VAL in your code gets replaced with SUM(TEF.VAL) so TEF.TOTAL.VAL=0 Becomes SUM(TEF.VAL)=0 Which of course is illegal and won't compile. You can see the replacements at work with vlist.

RE: [U2] [UD] Dynamic variable

2007-04-06 Thread u2
Sorry, I mentioned vlist in my previous response. That's a universe thing. I don't know if there's an equivalent in unidata. Universe/unidata differ in what they will accept in an equate. I know jbase differs. Something like this: 0001 C=0 0002 EQU A TO CHAR(C 0003 C=1 0004 *note I left the

RE: [U2] [UD] Dynamic variable. Kids, Don't try this at home!!!

2007-04-06 Thread Tony Gravagno
Thanks for the code, Ed and Ed. Indeed, don't try this at home. They're doing basic macro expansion, which we do with pre-processors all the time, but it's just not portable in app code. The issue is that some compilers will evaluate the expression of an EQUATE, then embed the result into the