![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: I frequently write scripts that do this: $ sho dev d /out=devices.tmp $ open/read infile devices.tmp $ LOOP: $ read/end=DONE x y $ . $ goto LOOP $ DONE: $ close x $ delete devices.tmp; but it would be much more elegant if I didn't have to create this temporary file. Is it possible to use a pipe command to do this? Something like: $ pipe show device d | (some code which would loop through the returned lines one by one and do whatever processing is necessary) I have tried working with this but have not been able to make the loop business work. I have tried using multiple dcl statements separated by semicolons (and obligatory spaces), but the command saying to GOTO LABEL is ignored. Maybe this just isn't possible, but I wanted to get the "final answer" before abandoning this route. Thanks. The Answer is : The DCL lexical function f$device avoids creating a temporary file. Please see the available help text ($ HELP LEXICAL F$DEVICE) and the OpenVMS User's Guide for details here, as well as books available on the topic of DCL programming, and consider the following example: $ START: $ DEVICE_NAME = F$DEVICE("*0:","DISK","RA60") $ IF DEVICE_NAME .EQS. "" THEN EXIT $ SHOW SYMBOL DEVICE_NAME $ GOTO START Direct parsing of command output is generally not recommended and is generally not considered supported -- displays can and do change.
|