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 closing parenthesis off of the equate line. So I need to add it here: 0005 CRT A) Is legal in jbase (and cachi) but wont compile in universe or unidata, or probably d3 (didn't check). And it looks like a silly thing to do, but c programmers are familiar with some of the odd gymnastics that can be done with defines.
Both unidata and Jbase accept this, though universe wont: 0001 DIM MYCHAR(100) 0002 MYCHAR(64)='AT-SIGN' 0003 EQU CHAR TO MYCHAR 0004 CRT CHAR(64) Unidata and jbase print AT-SIGN instead of the probably expected @. Universe is doing some extra parsing that prevent you from replacing system functions with equates, but jbase and unidata allow this. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Burwell, Ed > Sent: Friday, April 06, 2007 3:43 PM > To: [email protected] > Subject: [U2] [UD] Dynamic variable > > > Just discovered something kinda cool that I want to share: > > Here are a set of equates: > > COM.DEFS TEST.FILE > 001: DIM TEF(2) > 002: * > 003: EQU TEF.VAL TO TEF(1) > 004: EQU TEF.TOTAL.VAL TO SUM(TEF.VAL) > 005: * > > And here is a little test program: > > 0001: * > 0002: INCLUDE COM.DEFS TEST.FILE > 0003: 10 MAT TEF="" > 0004: FOR I=1 TO 5 > 0005: TEF.VAL<1,I>=RND(20) > 0006: PRINT "VALUE ":I:" = ":TEF.VAL<1,I>"R#2" > 0007: NEXT I > 0008: PRINT " ----" > 0009: PRINT "TOTAL = ":TEF.TOTAL.VAL"R#3" > 0010: PRINT "SUM = ":SUM(TEF.VAL)"R#3" > 0011: PRINT STR("-",78) > 0012: PRINT "RETURN to do it again or 'E'xit ": ; INPUT B,1 > 0013: IF UPCASE(B)="E" THEN STOP ELSE GO 10 > 0014: END > > When you run this, the variable "TEF.TOTAL.VAL" always > "knows" the sum of the values in TEF.VAL!! > > Also, if you try to do this in a program: > > TEF.TOTAL.VAL=0 > > It won't compile!! It knows!! > > Very cool (I think). > > Ed > > ______________________________________________________________________ > This e-mail has been scanned by MCI Managed Email Content > Service, using Skeptic(tm) technology powered by MessageLabs. > For more information on MCI's Managed Email Content Service, > visit http://www.mci.com. > ______________________________________________________________________ > ------- > u2-users mailing list > [email protected] > To unsubscribe please visit http://listserver.u2ug.org/ > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.446 / Virus Database: 268.18.26/748 - Release > Date: 4/5/2007 3:33 PM > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.26/748 - Release Date: 4/5/2007 3:33 PM ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
