From: SMTP%"prand@paul.spu.edu" 19-MAY-1993 16:04:36.62 To: EVERHART CC: Subj: Re: Q: Files and logical names used in DCL OPEN statements Date: Wed, 19 May 1993 10:23:45 -0700 (PDT) From: Phil Rand Sender: Phil Rand Reply-To: Phil Rand Subject: Re: Q: Files and logical names used in DCL OPEN statements To: INFO-VAX In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Here's another cool trick: Use a DCL OPEN statement to open a file, assigning a logical, say FOO, then use the /OUTPUT=FOO modifier on another DCL verb to send output to the same file, maybe many times. When you finish, close the file, and you'll find the output from all the DCL verbs, nicely appended to each other in your file. Below is an example of a quick and dirty utility I wrote to produce a list of all CMS elements having one or more generations in any class matching a (probably wild-card) class specification. I know my example works with the CMS verb, and I think I tried one or two other DCL verbs, like maybe SHOW SYSTEM, or SHOW USERS, but I don't know just how general this technique is. Oh by the way, I did this under VMS 5.5-2, and CMS 3.5-5. I'd be interested in hearing about whether this is supported, and whether you would consider it good DCL programming style. --Phil // Phil Rand prand@paul.spu.edu // Computer & Information Systems (206) 281-2428 // Seattle Pacific University, 3307 3rd Ave W, Seattle, WA 98119 $!============================================================================== $! SUSPECTS.COM $! $! Procedure to automatically produce a first-cut list of Banner CMS $! elements which may have been modified at SPU. $! $! Parameter: p1 = class specification to list. Defaults to "lco*" $! to list all files which have been envolved in any local $! change order. $! $!============================================================================== $ $ class_spec = p1 $ $ if class_spec .eqs. "" $ then $ class_spec = "lco*" $ endif $ $ element_list := sys$scratch:element-list-'f$getjpi(0,"pid")'.tmp $ class_list := sys$scratch:class-list-'f$getjpi(0,"pid")'.tmp $ cms set library banner_cmslib $ open/write elist 'element_list' $ cms show class 'class_spec'/output='class_list' $ open/read clist 'class_list' $ !counter = 0 $ class_loop: $ read/end_of_file=end_class_loop clist line $ if (f$extract(0,3,line) .eqs. "LCO") !.and. (counter .lt. 3) $ then $ class_name = f$element(0," ",line) $ write sys$output "Listing contents of class ''class_name'." $ cms show class/contents 'class_name' /output=elist $ !counter = counter + 1 $ endif $ goto class_loop $ end_class_loop: $ close clist $ close elist $ $ open /read elist 'element_list' $ open /write suspects suspects.lis $ elements_loop: $ read /end_of_file=end_elements_loop elist line $ line = f$edit(line,"compress,upcase") $ !show sym line $ if line .nes. "" $ then $ if f$extract(0,10,line) .nes. "CLASSES IN" $ then $ element_name = f$element(1," ",line) $ if f$parse(element_name) .nes. "" $ then $ write suspects element_name $ endif $ endif $ endif $ goto elements_loop $ end_elements_loop: $ close elist $ close suspects $ $ sort/nodup suspects.lis suspects.lis $ write sys$output "----Suspects----" $ type suspects.lis $ write sys$output "" $ write sys$output "Saved in suspects.lis" $ write sys$output "" $ $ wrapup: $ delete/nolog 'element_list';* $ delete/nolog 'class_list';* $ exit