DK:DATIM.TXT   DATE: 7-OCT-81   TIME: 23:53:44			Page 1

The header on this file was generated by a TECO macro DATIM.TEC. DATIM
uses registers A and B, and restores their original content on exit. DATIM
uses the name of the currently open main output file to make the header.
If no output file is open, DATIM prints a warning instead of the file name.
The macro can be stored in any TECO register except A and B, and can be then
be invoked from inside the screen macro with a red-key command.

DATIM recognizes file extensions .MAC, .FOR, .BAS, .RNO, and .S86, and
will place the appropriate comment flag in the margin when the main output
file has one of these extensions. If the extension is not known to DATIM,
the header will be placed in the margin.

The DATIM macro can also be run from a disk file with the command sequence
	^C				dismiss screen macro first
	EIdev:DATIM$$MI$$		(EI uses .TEC as default extension)
Please note the double escape behind the EI command. The indirect file will
not be executed until TECO encounters a double $$. On completion of the
indirect command string TECO will write CRLF * to the screen, after which
any keystrokes entered after the first $$ will be echoed.

If the DATIM macro will only be used at the start of an edit session, that
could best be achieved by insertion of DATIM as part of the start-up
sequence. DATIM would have to be loaded before the edit filespec is set up.
After use, DATIM may be removed to free up space, or it could be kept in
one of the Q registers for later use by manual commands.

Below is a printable version of the macro, with ESC replaced by $. There
are no other control characters in the macro, all ^ are separate characters.
Comments are added in lower-case, but without the normal !...!
[A[B				save registers
EW$ .UA				main output to filespec buffer, mark pointer
G*$				insert file name into text space
.-QA "EI?-W-no output file open?$'	insert warning if no file open
I   DATE: $				insert date preface
^BUA				get encoded date word
QA&31+72UB			extract year digits into B
QA/32UA				day in bits 0-4, month in bits 5-9 of A reg.
QA&31\$				insert day
I-JAN-FEB-MAR-APR-MAY-JUN-JUL-AUG-SEP-OCT-NOV-DEC-
49R				make month list, and reset pointer
QA/32-1UA			make index into month array (inserted above)
QA*4UA				table entries are 4 characters each
QAD 5C				discard front end and skip past desired month
44-QAD				discard late months
QB\$				insert year digit
I   TIME: $			insert TIME header
^HUA				get time word, units of 2 seconds under RT11
QA/1800UB QA-(1800*QB)UA	strip hours into B
2*QAUA				double remainder in A to make seconds
QB-10"LI0$' QB\$I:$		print hours, leading 0 as needed
QA/60UB QA-(60*QB)UA		extract minutes into B, seconds in A
QB-10"LI0$' QB\$I:$		print minutes, leading 0 as needed
QA-10"LI0$' QA\$I		seconds, leading 0 as needed, and 2 CRLFs

$
DK:DATIM.TXT   DATE: 7-OCT-81   TIME: 23:53:44			Page 2

				now dream up comment flag from .ext:

0UA -2L				zero A reg, pointer to front of header
:.,.+11FB.$"F OZ$'		limited search for . ; exit on failure
::SMAC$"S OX$' %A$		compare file type against known extensions
::SFOR$"S OX$' %A$			and count failed comparisons
::SBAS$"S OX$' %A$
::SS86$"S OX$' %A$
::SRNO$"S OX$' 2L OZ$		if unknown extension, advance and exit
!X! 0L .UB ZJ			else write in list of comment flags
I;--	
C--	
REM	
;--	
.;-	
$
^SC				back pointer up to front of list
QAK L .,ZK -2D 0L XA .,ZK	extract the proper one, then discard list
QBJ				reset pointer to header line
GA 2L				insert comment flag, then step 2 lines
!Z! ]B]A EI$$			restore regs and return to keyboard stream
                                                                                                                                                                                                                                                                                                                                                                                                                          