From: LUKE::JROLLER 13-MAR-1991 17:36:38.37 To: ARISIA::EVERHART CC: Subj: DCL Reminder Service Procedure Hi, Since I have been downloading some things from your system I thought I send something up. Here's a little VAX/VMS DCL command procedure that I created that functions like COHERENT's (a unix like OS from the Mark Williams company) "calendar" program. I hope you find it useful. ------------------ clip here ------------------------------------ $!**************************************************************! $!* *! $!* CALENDAR PROGRAM *! $!* ---------------- *! $!* *! $!* Name: calendar.com *! $!* Author: J. Roller *! $!* Date: December 10, 1990 *! $!* *! $!* Description: Calendar is a reminder service. It reads *! $!* a file named ".calendar" in the users root directory *! $!* and prints out entries corresponding to today's and *! $!* tomorrow's dates. For more information, see the help *! $!* text at the end of this file. *! $!* *! $!* Parameters: help - causes help message at the end of *! $!* this file to be displayed. *! $!* *! $!**************************************************************! $! ------------------------- ! $! ---| Make Some Definitions |--- ! $! ------------------------- ! $ putout = "write sys$output" $! $ ! month_list is a list of valid month names $ month_list = "/JAN/FEB/MAR/APR/MAY/JUN/JUL/AUG/SEP/OCT/NOV/DEC/" $! $ day_list = "" ! day_list is a variable that will hold the date strings $ ! that will be searched for in the ".calendar" file $! $! Print help screen if user typed "help" on command line $ if P1 .eqs. "HELP" then goto showhelp $! $! ------------------------------- ! $! ---| Look For Calendar Data File |--- ! $! ------------------------------- ! $! get pathname to user's ".calendar" file $! note: file must be in user's root directory $ calendar = f$trnlnm ("SYS$LOGIN")+".calendar" $! $! if ".calendar" file is not found then exit this procedure $ if f$search (calendar) .eqs. "" then exit $! $! ------------------------------ ! $! ---| Define Date Search Strings |--- ! $! ------------------------------ ! $ today = f$cvtime ("TODAY","ABSOLUTE","MONTH") + " " + - f$cvtime ("TODAY","ABSOLUTE","DAY") $ tomorrow = f$cvtime ("TOMORROW","ABSOLUTE","MONTH") + " " + - f$cvtime ("TOMORROW","ABSOLUTE","DAY") $ day_list = "/"+today+"/"+tomorrow+"/" $! $! define additional date search strings if today is Friday $ if (f$cvtime ("TODAY","ABSOLUTE","WEEKDAY") .eqs. "Friday") $ then $ sunday = f$cvtime ("TOMORROW+1-","ABSOLUTE","MONTH") + " " + - f$cvtime ("TOMORROW+1-","ABSOLUTE","DAY") $ monday = f$cvtime ("TOMORROW+2-","ABSOLUTE","MONTH") + " " + - f$cvtime ("TOMORROW+2-","ABSOLUTE","DAY") $ day_list = day_list+sunday+"/"+monday+"/" $ endif $! $! -------------------------------- ! $! ---| Process The ".calendar" File |--- ! $! -------------------------------- ! $! open the ".calendar" file and start looking for entries $! corresponding to the day_list variable - if the end_of_file is $! found, then terminate the procedure $ open/read datafile 'calendar $ read/END_OF_FILE=end_read_file datafile record $! $ mainloop: $!while (haven't found end_of_file) $!{ $ date_element = f$edit((f$element(0," ",record)),"UPCASE")+" "+ - f$element(1," ",record) $ if (f$locate ("/"+date_element+"/",day_list)) .nes. (f$len (day_list)) $ then $ putout record !display a 'found' entry $ continue = "yes" $ !* note: an entry can have multiple lines, this innerloop will catch $ !* and display those lines $ innerloop: !while (continue = "yes") $ if (continue .eqs. "yes") $ then $ read/END_OF_FILE=end_read_file datafile record $ first_element = f$edit((f$element(0," ",record)),"UPCASE") $ if f$locate ("/"+first_element+"/",month_list) .eq. - f$len (month_list) $ then $ ! first_element wasn't a month, therefore this is a $ ! continuation of the 'found' entry $ putout record $ else $ ! this entry is not a continuation of the 'found' entry $ continue = "no" $ endif $ goto innerloop $ endif $ else $ ! read next entry in ".calendar" file $ read/END_OF_FILE=end_read_file datafile record $ endif $ goto mainloop $!} end of mainloop $! $end_read_file: $ ! close ".calendar" file and terminate this procedure $ close datafile $ exit $! $! help screen strings $showhelp: $ type/page sys$input calendar Reminder service calendar [help] Calendar is a "reminder service" DCL command procedure. It reads a user's root directory and looks for a file called ".calendar". This file contains information organized by date. If calendar finds ".calendar", it reads it and checks the date of each entry; if an event is scheduled to happen today or tomorrow, it prints the entry. Thus, you can use calendar to remind you of both one-time events (such as appointments) and yearly events (such as anniversaries). Typing "help" as a parameter will cause this message to be printed. The following gives an example of a ".calendar" file. Note that calendar only understands the shown format for dates: Apr 1 April Fools Day! Sep 26 System Design Review meeting at 0900. Don't forget vugraphs! Oct 10 Mom's Birthday! Sep 27 Dentist appointment at 5 o'clock. Calendar can be run automatically when a user logs in by adding the command 'calendar' to his "login.com" file. For example add these two lines to the "login.com" file: $calendar :== @disk:[directory_path]calendar.com $calendar Line 1 creates the symbol calendar with the above definition. Thereafter, typing "calendar" will invoke the calendar procedure, as in Line 2 above. In Line 1, the user should substitute the proper directory path to his copy of the "calendar.com" file in place of the character string "disk:[directory_path]". Note that calendar understands weekends but not holidays; thus, if invoked on a Friday, it will return the events for Friday, Saturday, Sunday, and Monday. If Monday is a holiday, however, you will not receive appointments for Tuesday. Author: J. Roller Voice: (609) 338-2455 Internet: jroller@luke.dnet.ge.com $ $! $end: $exit