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
  *just for demo--won't make you go into an endless loop
  EXIT
REPEAT

Which on unidata prints
12\34\5
2R
Because fmt(12345,'2R')=12\34\5.
On universe, this compiles, but the equate processor doesn't replace the
READNEXT, so it would exit the loop immediately.

This innocent definition of an ascii table compiles and works on universe
but won't on unidata:
EQU NUL TO CHAR(0)
EQU SOH TO CHAR(1)
EQU STX TO CHAR(2)
...
EQU DEL TO CHAR(127)
A='1':@AM:'2'
DEL A<1>
CRT A



> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Tony Gravagno
> Sent: Friday, April 06, 2007 4:56 PM
> To: [email protected]
> Subject: RE: [U2] [UD] Dynamic variable
> 
> 
> 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.VAL"R#3"
> > 0010:     PRINT "SUM    = ":SUM(TEF.VAL)"R#3"
> > When you run this, the variable "TEF.TOTAL.VAL" always 
> "knows" the sum 
> > of the values in TEF.VAL!!
> 
> That's interesting because in other cases it could be a bug.  
> Ed, since you initiated this, could you tell us what happens 
> with the following?  I don't have UD installed here at the moment:
> 
>   EQU DELETE TO 1
>   OPEN "FOO" TO F ELSE STOP
>   DELETE F,"KEY"
>   INFO = "BLAH"
>   INFO = DELETE(INFO,1)
> 
> Does it give you an error telling you the delete lines are 
> invalid?  If so it could be converting to this:
>   1 F,"KEY"
>   INFO = 1(INFO,1)
> 
> In other MV systems we do NOT want to do something like this 
> because the code is compiled into the object, not evaluated 
> at runtime like the SUM() :
>   EQU SCREEN.HDR TO @(-1):@(20,0):"Top of Page..."
> 
> I would be careful about taking advantage of tricks like this 
> simply because it's a crap shoot as to whether the code will 
> be portable to another MV release - and even an upgrade of 
> the current environment could break this if some developer 
> decided it was a bug that needed to be fixed.
> 
> Thanks for the tip.
> T
> -------
> 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/

Reply via email to