README.DOC This package contains a collection of DCL command files that were presented at the Spring 1987 U.S. DECUS symposium in Nashville, in the session, "Advanced DCL Command Procedures on RSTS." All of the command files enclosed are believed to be free of errors. However, no responsibility is assumed for any errors that may appear. You are encouraged to review and modify as necessary any of the command procedures you intend to install. Following is a summary of each of the command procedures found on this tape. SYSDO.COM o SYSDO.COM is a BATCH command file which runs every day at 2:00 am o Performs once-a-day, once-a-week and once-a-month tasks for all users o SUBMITs to BATCH (queue BA1:) any DAILY.COM found on system disk o On Sunday, also SUBMITs any WEEKLY.COM found on system disk o On first day of month, also SUBMITs any MONTHLY.COM found on system disk o Automatically Re-SUBMITs itself for next day (/AFTER=TOMORROW:2:00AM) o Passes following parameters to users' DAILY, WEEKLY and MONTHLY COM files: P1 = Year index (e.g. 85) P2 = Month index (1-12) P3 = Day index (1-31) P4 = Day name (e.g., "FRIDAY") o Illustrates: - Calling local "Subroutines" - Using "recursive" COM files - Passing parameters to nested COM files DATE.COM o DATE.COM accepts standard DCL date string and displays "pretty" date: $ @DATE TODAY Tuesday, April 7th, 1987 $ @DATE -3DAYS Saturday, April 4th, 1987 $ @DATE 22-JAN-88 Friday, January 22nd, 1988 o Optional P2 argument is name of global symbol to save day-of-week name o Invoked by SYSDO.COM o Illustrates: - Defining and using arrays - Using "variable" symbol names - Executing complex expressions - Defining and using "string" arrays - Using SET NOECHO to suppress output - Using $SEVERITY to check for errors CHKERR.COM o CHKERR.COM is invoked by [1,2]DAILY.COM under SYSDO system batch job o Examines ERRDIS summary report, looking for any "overflow" conditions o Overflow condition caused by: - Error type exceeding its own error limit - Percent of blocks used exceeding defined limit o If overflow occurs, - Creates a "full" error report - Saves report in file yymmdd.ERR in defined account - Resets (zeros) the error file - Sends mail notification to defined distribution - Mail message includes summary report with all overflow lines flagged o Illustrates: - Automated system management - Automatic mail notification - Parsing an error report - Defining variable commands - Checking for undefined symbols - Executing complex expressions Sample CHKERR Mail Message From: SYSTEM "System Library" Date: 08-Apr-87 2:19 AM To: LABA Subject: Full ERRDIS report created ********************************************************* 08-Apr-87 2:18 AM A full report of the errors that occured on node SPIGOT has been created and saved in file SPIGOT::W:[1,3]870408.ERR. ********************************************************* The above report was created because one or more of the following conditions occurred: 1) The error file was more than 80% full, 2) An error type reached its limit. These conditions are indicated by an arrow prefix (-->) on the corresponding lines. ********************************************************* ERRDIS Summary Report taken on 08-Apr-87, 02:17 AM Input File: ERROR$:ERRLOG.FIL Output File: ERRDIS.SUM Reported Date/Time Range: 06-Apr-87, 01:27:26 AM through 08-Apr-87, 02:17:02 AM ERROR TOTAL UNIT NUMBERS CONTROLLER CODE-DESCRIPTION REC/LOG 0 1 2 3 4 5 ERRORS PF PowerFail/Strtup 1/1 N/A DR RM02/3/5/80 1/1 1 N/A --> MM RH11/TU16/TE16 * 157/100 112 45 N/A MU TMSCP Tapes 91/91 87 4 N/A SH MSG from SHUTUP 1/1 N/A Total of 194 Errors Logged out of 251 Received --> 95 out of 100 Blocks have been used in ERROR$:ERRLOG.FIL (95% full) ***************************************************** 17 DAILY.COM o DAILY.COM is executed by SYSDO system BATCH job o Invokes CLEAN.COM to delete old "junk" in user's directory o Invokes ORDER.COM to place most often used files at front of user's directory CLEAN.COM o CLEAN.COM purges user's mail folder every Sunday o Deletes all "junk" files that are more than two days old o Keeps slightly more important files around for seven days ORDER.COM o ORDER.COM moves files that need to be accessed quickly to front of user's directory BIGACC.COM o BIGACC.COM displays accounts using n or more blocks o Useful tool for monitoring disk space use o Analyzes SHOW ACCOUNT output to select accounts for display o Provides totals for accounts displayed o Illustrates: - Opening and reading a text file - How to create a temporary text file, using your job number - Computing totals and sub-totals in a loop - Right justifying a text line DIFF.COM o DIFF.COM is a "front-end" to the DCL DIFFERENCES command o Applies "File 1" defaults to "File 2" o If no "File 2" parameter, then DIFF uses .BAK file o Outputs differences to terminal or optional .DIF file o Used in conjunction with re-defined DIFFERENCES command: $ DIF-FERENCES = "@DIFF" o Illustrates: - How to use F$PARSE function to build file-specs - How you can "re-define" an existing DCL command - Simple loop for processing P1 - P8 parameters TRMTYP.COM o TRMTYP.COM determines your terminal type, and assigns it to the global symbol TT_Type o Since there is no DCL function to do this, TRMTYP.COM "calls" a program to return the type code o Useful for COM files that might want to take different actions based on type of terminal o Illustrates: - How a COM file and program can "cooperate" as a single utility - How a program can pass data back to a COM file - Defining and using string "arrays" - How to check if a symbol exists TIMER.COM o TIMER.COM accepts a standard DCL command and executes it every "n" seconds: $ @TIMER 10 "$ SHOW JOB 3" o Illustrates: - How INQUIRE can be used to insert delays between commands (poor man's" SLEEP command) - How you can define a simple (crude?) system monitoring tool SEARCH.COM o SEARCH.COM runs SEARCH.TEC utility, which searches files for text strings o Keeps you logged in if SEARCH.TEC detaches o Lowers your priority if you have TUNE privilege o Illustrates: - Running detached jobs in a command procedure - Using F$PRIVILEGE function SUBCMD.COM o SUBCMD.COM creates a temporary command file and SUBMITs it to BATCH o Saves you the trouble of creating small, "throw-away" command files o Allows mutliple commands separated by backslashes o Mails (via DECmail-11) BATCH log to you o "Cleans up" after itself o Illustrates: - Command line parsing - How to create command files "on the fly" - Sending messages via DECmail-11 in a command procedure