"Thomas_W._Taylor.WBST147"@XEROX.COM (09/11/87)
Does anyone out there know how to create a numeric DCL symbol from a program. Sometimes the string capability is just not right. The only way I have been able to do this so far is to do a $EXIT with a parameter equal to the value I want to set (ORed with %X10000000 to turn off message display). This sets $status with the value I want and I can then use this in succeeding operations. Does anyone know DEC's rationale for not providing this facility? Thomas W. Taylor Xerox Corp - 0147 Webster, NY 14580
leichter@VENUS.YCC.YALE.EDU ("Jerry Leichter") (09/11/87)
Does anyone out there know how to create a numeric DCL symbol from a program. Sometimes the string capability is just not right. The only way I have been able to do this so far is to do a $EXIT with a parameter equal to the value I want to set (ORed with %X10000000 to turn off message display). This sets $status with the value I want and I can then use this in succeeding operations. Does anyone know DEC's rationale for not providing this facility? As you surmise, there is no way to do this - the only way to set symbols from a program is with LIB$SET_SYMBOL, and it sets only strings. Providing a rationale for why something ISN'T present is kind of tricky: Any question of this form - "What's DEC's rationale for displaying numeric symbols in SHOW SYMBOL in decimal, octal, and hex - but not in binary?" - can be answered in exactly the same way: Insufficient perceived utility (value) versus excessive implementation effort (cost). Note that even a very small cost may be unjustifiable if there is a sufficiently small perceived value. You say: "Sometimes the string capability is just not right". Why? It's trivial to convert an integer into string form for the call to LIB$SET_SYMBOL, then convert it back to integer form with the F$INTEGER lexical function. Speed and space are not an issue when using DCL - except for rather unusual situations, any design tradeoffs you make are swamped by large fixed costs in DCL anyway. Your example only needs to return a single integer value, and it does so on termination. If this is all you want to do, you can use LIB$DO_COMMAND to execute an appropriate DCL assignment statement. -- Jerry ------
u3369429@murdu.OZ (Michael Bednarek) (09/15/87)
In article <8709120130.AA11423@ucbvax.Berkeley.EDU> "Jerry Leichter" <leichter@venus.ycc.yale.edu> writes: > [...] > [quoting very much out of context:] displaying numeric symbols >in SHOW SYMBOL in decimal, octal, and hex - but not in binary? And for anyone who is interested, the trivial procedure BINARY: $! BINARY.COM Translate P1 to binary $ Binary="" $ HexDigs="0123456789ABCDEF" $ BinDigs="0000.0001.0010.0011.0100.0101.0110.0111." - +"1000.1001.1010.1011.1100.1101.1110.1111" $ Hex=F$FAO("!XL",F$Integer(P1)) $ i=-1 $n: $ i=i+1 $ If i.gt.0 then Binary=Binary+"." $ Binary=Binary+F$Element(F$Locate(F$Extract(i,1,Hex),HexDigs),".",BinDigs) $ If i.lt.7 then goto n $ Write SYS$Output P1,"=",Binary