?TACL ROUTINE { TEMPLAT2 routine by Jim Hinsch. } { } { Executes an SINGLE WORD TACL command against all files described by the } { file template that followed. } #FRAME #PUSH file^template { The file template specified. } #PUSH file^list { The current list of files being worked on. } #PUSH current^file { The current file being worked on. } #PUSH last^file { The last file worked on. } #PUSH tacl^command { The TACL command to be executed. } #PUSH remainder { More stuff to be passed along. } =============================================================================== #SET #OUTFORMAT PRETTY [#DEF display^help MACRO |BODY| == The below section displays help information for using this macro #OUTPUT #OUTPUT NOTE: This is the same as the TEMPLATE routine, except the #OUTPUT filenames are passed to the TACL command without qualification. #OUTPUT #OUTPUT Executes any single-word TACL command upon all files in the passed #OUTPUT template. A file template is a file name with "*" or "?" #OUTPUT characters inserted as search characters. #OUTPUT #OUTPUT FORMAT: TEMPLAT2 tacl-command template ~[more-commands~] #OUTPUT EXAMPLE: TEMPLAT2 purge T* #OUTPUT ~_ (this would purge all files on $SYSTEM2.TEST that& { continued } begin with "T") #OUTPUT ] [#DEF do_work MACRO |BODY| {This routine is passed up to 50 file names. The routine is executed } {continuously, each time, pulling off the first file name from the list } {and placing it into the variable "current^file". While the list of } {has not been reduced to being empty, the value of the variable } {"current^file" is placed into the variable "last^file" and the contents } {of the variable "tacl^command" is executed against the value of the } {variable "current^file". } [#DEF execute^tacl^command ROUTINE |BODY| [#LOOP |DO| [#CASE [#ARGUMENT/VALUE current^file/TEMPLATE END] |1| #SETV last^file current^file [tacl^command] [#FILEINFO/FILE/[current^file]] [remainder] |2| ] |UNTIL| [#EMPTYV/BLANK/current^file] ] ] { This section will put the first 50 filenames as defined by the contents } { of the variable "file^template", into the variable "file^list". While } { the variable "file^list" is not empty, it will perform the routine } { "execute^tacl^command" against the variable, and then put the next 50 } { file names following the contents of the variable "last^file" (if any } { more exist), into the variable "file^list". } #SET file^list [#FILENAMES/MAXIMUM 50/[file^template]] [#LOOP |WHILE| NOT [#EMPTYV/BLANK/file^list] |DO| execute^tacl^command [file^list] #SET file^list [#FILENAMES/MAXIMUM 50,PREVIOUS & { continued } [last^file]/[file^template]] ] ] [#CASE [#ARGUMENT/TEXT tacl^command/WORD END] |1| SINK [#ARGUMENT/TEXT file^template/TEMPLATE] SINK [#ARGUMENT/TEXT remainder /TEXT END] do_work |2| display^help ] #UNFRAME