Name: Scott Halet Date: April 30, 2002 at 06:30:03 Pacific Subject: F$GETDVI
Comment:
I am new to DCL. I am trying to write a script which will get the device information and then make a judgement on that information: The following is what I have:
$ disk_loop: $ p1 = f$device("*","disk") $ if p1 .eqs. "" then goto done ! EXIT ON NO DISKS $! $ if f$locate(f$getdvi(''p1',"device_type_name"),"RZ") .nes. "" $ then $ write sys$output "''p1' is a disk" $ else $ endif $ goto disk_loop $ done: $ exit
I believe the lexcial I am using is wrong. If someone has any thoughts please advise, thanks.
You're almost there. Biggest problem is in the line with f$locate. - f$locate() returns an integer of the position where it finds the specified substring, or the length of the string when the substring isn't found. - f$getdvi needs only the symbol p1, without quotes. You use the quotes only when the symbol has to be translated in a string like "''p1'" It is best to split the specified line in two lines like : $ thisdev = f$getdvi(p1,"device_type_name") $ if f$locate("RZ",thisdev) .ne. f$length(thisdev) Note that I also changed .nes. in .ne. because you do a comparison of integers, not strings.
One other remark : P1 - P8 are special symbols (input parameters). I wouldn't use them for 'normal' symbols. So I would change the line $ p1 = f$device("*","disk") in something more meaningful like $ mydisk = f$device("*","disk")
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE