SERAFINI%TOM@IO.ARC.NASA.GOV (11/05/87)
I came across something today by accident that I find very interesting, so I thought I'd tell everyone. At DCL level, entering a line with only a "&" on it will instantly crash your process, with some kind of signal error. Typing the & embedded in a command line seems to cause the rest of the command after the & to be ignored, like a comment. Does anybody know the explanation for this. If the answer if RTFM, just say so, because I haven't. Even if it's documented, it hardly seems like appropriate behavior. Environment: VAX 11/780, VMS 4.4, LAT service. <dbs> David Serafini Sterling Software, FedSysGrp @NASA/Ames Research Center, Applied Aerodynamics Branch ARPA: serafini%tom@ames-io.ARPA or serafini@ames-aero.ARPA
sdowdy@charon.unm.edu (Stephen Dowdy) (11/09/87)
Keywords: In article <8711081040.AA04841@ucbvax.Berkeley.EDU> SERAFINI%TOM@IO.ARC.NASA.GOV writes: >I came across something today by accident that I find very interesting, so I >thought I'd tell everyone. At DCL level, entering a line with only a "&" >on it will instantly crash your process, with some kind of signal error. I have no explanation for that as i can't duplicate it. >Typing the & embedded in a command line seems to cause the rest of the command >after the & to be ignored, like a comment. Does anybody know the explanation >for this. From the text below, you will see that this is similar to putting a single ' at the end of a line; DCL interprets it as a null symbol substitution. > >If the answer if RTFM, just say so, because I haven't. Even if it's documented, >it hardly seems like appropriate behavior. As far as i know, this operator is documented in one of the DCL user's manuals, but not very well (like in the middle of a paragraph that is of little reference). In general, it is probably best to leave it (&) alone since it isn't documented very well, and therefore could cause maintenance problems (ala "what the *#$^#*&@ is this?"). > >David Serafini The "&" symbol is used by DCL as an "indirect substitute variable" directive. It is similar in function to the "'" directive, but carries the substitution one step further. It uses the contents of a symbol to refer to a symbol that should be operated on. An example: $ a := "hello" $ b := "a" $ write sys$output " ''b'" a $ write sys$output " ''&b'" hello Unfortunately, this works only for variables that are defined using ":=", not using "=". (I personally think using "=" is generally more useful.) The following command file exhibits the use of the "&" DCL operator. In this case the "&" is used to resolve the value of a symbol that is passed by the name "P1", the first parameter to the script. ----------- Cut 'n' Snip (tm) -------------------------------------------------- $!############################################################################## $! Title: Alias.Com $! Purpose: To assign or return the value of a (or all) symbol(s) $! An "act-alike" to Unix "alias" $! Author: Stephen Dowdy (University Of New Mexico) $! Date: 6/19/86 $!############################################################################## $! Usage: $ alias [ symbol [substitution] ] $! $ alias display all symbol definitions $! $ alias symbol display value of "symbol" $! $ alias symbol value assign "value" to "symbol" $!.............................................................................. $ If (P1 .EQS. "") Then Goto Display_All $ If (P2 .EQS. "") Then Goto Display_One $!...Assign value to symbol using the rest of the command line $ P2 = P2 + " " + P3 + " " + P4 + " " - + P5 + " " + P6 + " " + P7 + " " + P8 ! concatenate $ 'P1' :== 'P2' ! Global define $ Goto Display_One ! show new definition $!... $!...Show all symbols $ Display_All: $ Write Sys$Output "[ALIAS] Current Global Symbol Definitions..." $ Show Symbol/All/Global $ Goto Exit $!... $!...Show the value of one symbol $ Display_One: $!...Here, we don't want to do F$TYPE(P1), since this is a string value, $!...containing the name of the symbol of interest. Indirect it (&P1) to see if $!...that symbol exists. $ If (F$Type(&P1) .EQS. "") Then Goto Sym_Not_Def $!...Write out the contents of the contents of P1 $ Write Sys$Output "[ALIAS] ""''P1'"" = ""''&P1'""" $ Goto Exit $ Sym_Not_Def: $ Write Sys$Output "[ALIAS.ERROR] ""''P1'"" Not Defined" $ Goto Exit $ Exit: $ Exit ----------- Cut 'n' Snip (tm) -------------------------------------------------- --stephen dowdy -- $!####################################################################### $! stephen dowdy (UNM CIRT) Albuquerque, New Mexico, 87131 (505) 277-8044 $! Usenet: {convex,ucbvax,gatech,csu-cs,anl-mcs}!unmvax!charon!sdowdy $! BITNET: sdowdy@unmb $! Internet: sdowdy@charon.UNM.EDU $! Team SPAM in '87! SPAAAAAAAAAAAAAAAAAAAAMMMMMMM! $!#######################################################################
terrell@musky2.UUCP (11/10/87)
In article <8711081040.AA04841@ucbvax.Berkeley.EDU> SERAFINI%TOM@IO.ARC.NASA.GOV writes: >At DCL level, entering a line with only a "&" >on it will instantly crash your process, with some kind of signal error. > I don't think that this is a problem in VMS because when I try it, it give the standard error message that says something about commands having to begin with alphanumeric characters... Roger -- Roger Terrell Muskingum College ...cbosgd!musky2!terrell (UUCP) New Concord, OH 43762
ted@blia.UUCP (11/11/87)
In article <1789@charon.unm.edu>, sdowdy@charon.unm.edu (Stephen Dowdy) writes: > In article <8711081040.AA04841@ucbvax.Berkeley.EDU> SERAFINI%TOM@IO.ARC.NASA.GOV writes: > > ... At DCL level, entering a line with only a "&" > >on it will instantly crash your process, with some kind of signal error. > I have no explanation for that as i can't duplicate it. You can't reproduce it (I expect) because DEC fixed this in 4.5. -- Ted Marshall ...!ucbvax!mtxinu!blia!ted <or> mtxinu!blia!ted@Berkeley.EDU Britton Lee, Inc., 14600 Winchester Blvd, Los Gatos, Ca 95030 (408)378-7000 The opinions expressed above are those of the poster and not his employer.
cray%lvvb.span@Sds.Sdsc.EDU.UUCP (11/12/87)
>>I came across something today by accident that I find very interesting, so I >>thought I'd tell everyone. At DCL level, entering a line with only a "&" >>on it will instantly crash your process, with some kind of signal error. > I have no explanation for that as i can't duplicate it. This was discussed some time ago, it was a bug in either vms 4.3 or 4.4, it has since been fixed. --robert -- cray%lvva.span@sds.sdsc.edu
u3369429@murdu.OZ (Michael Bednarek) (11/14/87)
In article <1789@charon.unm.edu> sdowdy@charon.UUCP (Stephen Dowdy) writes: >in response to <8711081040.AA04841@ucbvax.Berkeley.EDU> > SERAFINI%TOM@IO.ARC.NASA.GOV >The "&" symbol is used by DCL as an "indirect substitute variable" directive. >It is similar in function to the "'" directive, but carries the substitution >one step further. It uses the contents of a symbol to refer to a symbol >that should be operated on. > >An example: > $ a := "hello" > $ b := "a" > $ write sys$output " ''b'" > a > $ write sys$output " ''&b'" > hello Wrong. I tried it and it doesn't work. It would work, however, if: $ b:="A" Anyway, this is not a particularly well chosen example, as $ write sys$output " ",'b produces the same result. It still surprises me that your example, if uppercase A is used, works. Quoted from VAX/VMS DCL Dictionary section 6.2.2: "You cannot use ampersands to request substitution within characters strings enclosed in quotation marks." Your enclosed ALIAS procedure uses the same format: >$ Write Sys$Output "[ALIAS] ""''P1'"" = ""''&P1'""" and it works, even if DCL's uppercasing is inhibited, e.g.: $ @alias "say" ! gives: [ALIAS] "say" = "Write Sys$Output" Again, the use of `&' is not really mandatory in ALIAS, it could be re-written: $ Write Sys$Output "[ALIAS] """,P1,""" = """,'P1,"""" So, where are ampersands really necessary? In subscripted variables! F'rinstance VMS_SHAR needs a character array `File(500)*255' (Fortran syntax) to store all filenames to be packaged. It sets up a counter, say `n', and for each filename encountered, stores it in "File'n". Then to run CHECKSUM on each file: "$ Checksum &File'n" DCL will first substitute "'n", giving e.g. "1", resulting in "&File1", which will be substituted by its definition, the filename. The obvious advantage over other HLLs is the lacking necessity of declaring the size of the array beforehand. (And you thought a DCL compiler would be possible? It isn't.) >Unfortunately, this works only for variables that are defined using ":=", not >using "=". (I personally think using "=" is generally more useful.) ??? Which VMS version are you running? >$! Title: Alias.Com >$! Purpose: To assign or return the value of a (or all) symbol(s) >$! An "act-alike" to Unix "alias" What's wrong with `$ Show Symbol <symbol>' and '$ <symbol>=[=]"<definition>"'? To simulate `alias', you need at least PIPE by KENW@NOAH.ARC.CDN (Ken Wallewein). Michael Bednarek Institute of Applied Economic and Social Research (IAESR) Melbourne University, Parkville 3052, AUSTRALIA, Phone : +61 3 344 5744 Domain: u3369429@{murdu.oz.au | ucsvc.dn.mu.oz.au} or mb@munnari.oz.au "bang": ...UUNET.UU.NET!munnari!{murdu.oz | ucsvc.dn.mu.oz}!u3369429 "POST NO BILLS."