% VAX-11 Librarian V04-00l_Tԕl`ԕ 5 TAILl`ԕ1 TAILA Tail is a utility which displays the end of a file. OptionalA parameters allow it to continually scan the file for new data and display that.  Usage: I $ TAIL [/number] [/?] [/S] [/F] [/T secs] input_file(s) [output_file]@ Note that you can use a "-" to delimit qualifiers as well as a "/". 2 PARAMETERS input_file(s)@ The file specification of the file or files to be displayed.3 This specification defaults  to SYS$DISK:[].LOG. output_fileC An optional output file specification. If it is supplied, TAILF will direct its output to that file instead of the standard output device (SYS$OUTPUT). 2 QUALIFIERS/? /?> Displays a short help screen from within the TAIL utility./n /n Where n is an integerA Indicates how many last lines or records TAIL should display.@ This number defaults to 24, or a regular full sized terminal screen./S /SB  If the /S qualifier is present, TAIL uses the "safe" method of; determining the location of the last records in a file./F /FD Monitors the input file and outputs records as they show up. It@ checks for new output every 5 seconds, although that may be & changed by using the /T qualifier./T /T nC Denotes the update rate for monitoring the input file. A /F isD automatically done if /T is supplied. /T defaults to 5 seconds. 2 EXAMPLES- 1. $ TAIL /F /T 10 sys$manager:operator.log@ This example will display the last 24 lines of the operatorB log file, and then every 10 seconds check for new information! in that file and display it. & 2. $ tail -5 sys$login:batch_job.log> This example will display the last 5 lines of a batch jobD log file. Note that it uses the alternate qualifier delimiter., 3. $ tail /10 sys$Login:output.dat /f /t 3 B This example will display the last 10 lines of an output file @ and check for new output every 3 seconds. Note that the /fC qualifier is there for esoteric reasons only; the /t makes the /f functionality automatic.2 DESIGN_NOTES3 GOAL Design goal:HMake a TAIL utility that can very quickly pickup the last n records of aJbatch log file (which tend to be tens of thousands of blocks long for some of our jobs).IHow it works (more or less): For fixed length records, TAIL just seeks toLthe desired record and dumps the file from t here. For stream record formats,Fit reads from the end of the file and counts backwards the appropriateGnumber of terminators, then seeks to that point and dumps the file fromIthere. For variable and VFC record formats, it has two modes. The defaultJmode is for it to seek to the end of the file and read backwards trying toHdetermine record boundaries based upon some reasoning. This will usuallyLwork if the records are relatively short and there are few (preferrably no)Jcontrol characters in it. TAIL trys to figure out if it is getting screwedJup, and sometimes it may, and will fall back to the "safer" mode if so. ItImay not notice, however, so you can force it to use the "safer" mode withCthe /S option. The "safer" mode is where it reads the file from theLbeginning, recording the record file address (rfa) of each record as it goesI(modulo the number of desired lines). When it reaches the end of file, itIbacks up through the rfa table the desired number of lines, seeks to thatGpoint and dumps the file from there. It always uses the "safer" mode onIinput files less than 128 blocks in size. In the "safer" mode, it doesn'tLuse RMS $GET calls for each record. Instead it reads up to 127 blocks of theIfile at a time then decodes the record structure within that 64K of data.IThis results in a substantially faster access to the end of the file thanLwould normally be available with successive $GET calls. Monitor mode startsLthe same way, however, once the record structure has been determined it doesJsuccessive $GET calls to obtain the records added to the end of the inputDfile. Due to a "feature" of RMS, the input file has to be closed andGreopened in order to gain access to data added to the end of an alreadyIopened file. Although this undoubtly adds overhead to the system (closingJand opening the file every few seconds) TAIL maintains the rfa of the lastKrecord read, so it can seek to that record to get quick access to the "new"#records at the new end of the file.3 BUGS Known Bugs:HNothing major has cropped up since the image was released in 4/90. SinceJthis release has so many new features, it has at least an equal number ofEareas of potential bugdom. Beware. Besides these new features, thereIremains the old tried an true (but yet to happen to me) small possibilityHthat it could seek to a point in a variable length file that RMS doesn'tLlike (only while it is NOT using the "safer" mode). This doesn't seem likelyEbecause I believe that RMS should like whatever record structure TAILIdecodes even if it is not the correct one. Should TAIL seek to a point inKthe file that RMS doesn't like, however, one of several things might occur.JProbably RMS will return an "invalid record format" error. There is a slimFchance that RMS might bugcheck which would not be a nice thing to haveJhappen to you and if your SYSGEN option BUGCHECKFATAL=1, your system wouldLcrash. If BUGCHECKFATAL=0, your process would be deleted. I suggest you keepJBUGCHECKFATAL=0 and use some care if TAIL'ing binary files (or chicken out#and always use /S on binary files).+Does not treat: file, only: [dir]file.HThis program is getting to damn big and I can't remember how the hell itworks.ww