Copyright 1988-2016 by Kevin G. Barkes All rights reserved. This article may be duplicated or redistributed provided no alterations of any kind are made to this file. This edition of DCL Dialogue is sponsored by Networking Dynamics, developers and marketers of productivity software for OpenVMS systems. Contact our website www.networkingdynamics.com to download free demos of our software and see how you will save time, money and raise productivity! Be sure to mention DCL Dialogue! DCL DIALOGUE Originally published January, 1988 An Enhanced Purge By Kevin G. Barkes If your site is plagued with a plethora of identically-named files which may or may not contain useful information, this month's reader-submitted utility is for you. PURGE_COPIES.COM, by Kent Gardner of the Nuclear Medicine Division of University Hospital in Ann Arbor, MI, kills multiple versions of a file, but preserves those versions which are unique. The procedure repeatedly invokes the DIFFERENCES command to compare files, then DELETEs excess copies of identical files. "Given a file spec," Kent explains, "this command procedure will compare all versions of a file with all other versions in the same directory. Only the highest version of each unique file is retained. As an example, the command @PURGE_COPIES Dxxx:[000000...]*.TXT would purge copies of .TXT files from all directories on device Dxxx. "The file-spec to be purged is passed to the procedure in parameter P1. Since the lexical function F$SEARCH is used to return the full specifications, any valid file-spec should work (wildcards are OK). If P1 is not supplied, the default is all files in the current device and directory." Versions of VMS prior to 4.6 had a bug in the /MAXIMUM_DIFFERENCES qualifier to the DIFFERENCE command. If your site is up to VMS 4.6, you can greatly speed up the procedure by adding the qualifier. As with any command procedure which performs file deletions, you're urged to test PURGE_COPIES out on non-critical files in order to become totally familiar with its operation. Be especially careful when using logical name search lists. Once mastered, the procedure can be a useful addition to your utility tools. ***** Because of the deadlines involved in producing a column like this, I hesitate to include information about new releases of VMS; there's a good chance DEC will have released a mandatory upgrade or new version of the software by the time we get to press. However, there are major items in VMS 4.6 that persons lacking access to the release notes should know. For command procedure writers, the big news is that from 4.6 on, all commands, labels and full-line comments in .COM files must be preceded by a dollar sign ($) or the command interpreter will bomb out with a syntax error. DEC notes they've been telling users that for a long time now, but that previous versions of VMS have been somewhat forgiving in this respect. No more. If a non-data line doesn't start with a $, DCL will throw up its hands in disgust and stop executing. So now you know why all your command files are blowing up! System managers will be ecstatic to learn that Standalone BACKUP has been enhanced so that you can remove the booted disk after it has been loaded. Your system has to have at least 2MB of memory so Standalone's working set can be fully locked in. This means, of course, the system disk can now be the target of a restore operation, a real boon to small system operators. There's a new SET TIME/CLUSTER command which synchronizes the system clocks on cluster members to within a half-second. Other 4.6 fixes reported by DEC include a VT300_Series device type and DEC_CRT3 qualifier for the SET TERMINAL command; a fix for the /MAXIMUM_DIFFERENCES qualifier of the DIFFERENCE command and a new DCL command procedure which provides additional menu-driven system management assistance on MicroVaxen. DEC reports multiple fixes to the SET HOST command, and notes that SET TERMINAL/PASTHRU/PERMANENT now works properly as do the SET QUEUE, START/QUEUE and INITIALIZE/QUEUE commands. The SET HOST/DTE/DIAL command now supports DF03, DF112 and DMCL (Digital Modem Command Language) modems. TPU users fond of the EDT emulator take note... in the next major release of VMS, the EVE editor will support the EDT keypad, and DEC will no longer distribute the source or section files for EDTSECINI. If you want to keep using it, save it; it is scheduled to disappear. VMS 4.6 also contains major changes to the AUTOGEN procedure and includes new Local Area Transport (LAT) software which includes a QIO interface for LTDRIVER functions, a new LATCP user interface, and the ability to pass terminal characteristic and the break character to the host. It looks like 5.0 is going to be very interesting... ****** DCL hackers have been responding well to our call for user utilities, but we'd like to remind you of the rules: 1) Supply the procedures on magtape, if you can; 2) include an abstract so we don't have to go wading through code to figure out what it does and 3) make sure it works. The number of brain-dead procedures has increased mightily as of late, but don't give up. Fame, if not fortune, awaits those who persevere. ******* In addition to Professional Press' ARIS bulletin board system and the VAX Echo areas on FidoNet boards, a great source of DCL info is the VAX PageSwapper, which appears in the DECUS SIGs Newsletter. The October issue contained this little gem from Dale Coy and Ron Schneider, INTERACTIVEJOBS = F$CVSI(0,16,F$FAO("!AD",4,%X80002BFC)) which places in the symbol INTERACTIVEJOBS the number of interactive users on the system. Thanks to Carl Houseman for pointing this out in the VAX echo. You can get more info on DECUS' newsletter by writing to them at 219 Boston Post Road, BP02, Marlboro, MA 01752-1850. $! SEE HEADER AT BOTTOM OF FILE $! $! No spec, default to all files in current directory $ if P1 .eqs. "" then P1 := "*.*" $! No name, default to all files $ if f$parse(P1,,,"NAME",) .eqs."" then P1 := "''P1'*.*" $! Replace any version # with version 0 $ P1 = f$extract(0,f$locate(";",P1),P1) + ";0" $! Init stuff $ LST_FILE := "" $! $! Loop for all input file-specs $ GET_NXT_SPEC: $ FILE = f$search(P1,1) $! If no more files, then exit $ if FILE .eqs."" .or. FILE .eqs. LST_FILE then exit $! Save this file-spec $ LST_FILE = FILE $! Log current file-spec to sys$output $ write sys$output f$extract(0,f$locate(";",FILE),FILE) $! $! Init version counters $ NXT_VER = 1 $ TOP_VER = 1 $! Loop to compare all versions to all other versions $ TOP_FILE_LOOP: $ NXT_FILE=f$search(f$extract(0,f$locate(";",FILE),FILE) + ";-''NXT_VER'") $! If there is a lower version to test, then test it $ if NXT_FILE .nes."" then goto TEST_DIFF $! else, no more lower versions, get next top version $ FILE = f$search(f$extract(0,f$locate(";",FILE),FILE)+";-''TOP_VER'") $! If no top version left, then get next spec $ if FILE .eqs. "" then goto GET_NXT_SPEC $! else, inc counters, and continue $ NXT_VER = TOP_VER + 1 $ TOP_VER = TOP_VER + 1 $ goto TOP_FILE_LOOP $! $ TEST_DIFF: $! Inc next version counter $ NXT_VER = NXT_VER + 1 $! $! If files are different in size, then continue $ if f$file_attributes(FILE,"EOF") .ne. - f$file_attributes(NXT_FILE,"EOF") then goto TOP_FILE_LOOP $! $! Historic debug paranoia $ if FILE .EQS. NXT_FILE then goto TOP_FILE_LOOP $! $! Test files for differences $! If you're running VMS 4.6 or greater, add $! /MAXIMIMUM_DIFF=1 to the differences command $ differences/output=NL:/window=1 'FILE','NXT_FILE' $! If different, then continue $ if $SEVERITY .ne. 1 then goto TOP_FILE_LOOP $! else, delete lowest version $ delete 'NXT_FILE' $! Log deleted file-spec to sys$output $ write SYS$OUTPUT " ''NXT_FILE' deleted" $! Since file deleted, dec next version counter $ NXT_VER = NXT_VER - 1 $! Continue $ goto TOP_FILE_LOOP $!------------------------------------------------------------------------- $! $! Filename: PURGE_COPIES.COM $! $! Abstract: This command procedure will compare (i.e. "differences") $! all versions of a file with all other versions of the $! file. All files that are not different (i.e. copies) from $! some higher version will be deleted. P1 is the file-spec $! to purge. $! $! Author: Kent Gardner $! Division of Nuclear Medicine $! B1G412 University Hospital $! Ann Arbor, Michigan 48109-0028 ---------- Kevin G. Barkes is an independent consultant. He publishes the KGB Report newsletter, operates the www.kgbreport.com website, lurks on comp.os.vms, and can be reached at kgbarkes@gmail.com.