PROGRAM DCAT; {$r+} {$c+} {$U+} { ******************************************* * DCAT - Catalog Listing Of Disk Programs * * Grouped By Disk * * * * Program to make List Of all disks * * from the MAST.CAT file * * built by the MCAT program. * * * * The programs will be grouped * * by disk and in alphabetical order. * * This program differs from the XCAT * * program in that XCAT orders its * * output based on file name regardless* * of which disks the files reside on. * ******************************************* This program is placed in the public domain. It may be updated or altered but should again be placed in the public domain. 9/08/85 * Initial release of the program. It is written in V10 Turbo Pascal. * The program is hardcoded to expect that no file names (or at most one file name) is to be overlooked by the MCAT program. * The program also relies on the parameter "NumberOfDisks" which must be set large enough to cover the largest disk number. A value of 7 will cover disks 1 through 79 and a value of 9 would cover all disks up to 99. - Lew Edinburg Sunnyvale, CA } CONST Version: String[4] = '1.0'; Blank: String[78] = ' '; FormFeed =#12; PageSize: Integer = 60; NumberOfDisks: Integer = 7; {set to indicate how many disks are cataloged in MAST.CAT. Number Of Disks NumberOfDisks Cataloged -------------- ---------------- 5 59 7 79 9 99 } NumberToProces = 10; VAR CR: string[1]; CurrLine: Integer; InputData: text; TempLine: string[30]; Temp: string[14]; LineOut: string[60]; Group: Integer; I: Integer; II: Integer; III: Integer; IV: Integer; Files: ARRAY [0..450] OF STRING[20]; DiskNumber: string[10]; DiskIndex: Integer; ResultCode: Integer; FilesList: ARRAY [0..NumberToProces,1..65] OF STRING[12]; FileIndex: ARRAY [0..NumberToProces] OF Integer; LimitIndex: Integer; X: Integer; IMAX: Integer; {****************************************************************} BEGIN {Print out initial query} ClrScr; Writeln; Writeln; Writeln(' DCAT Program Version ',Version); Writeln; Writeln('The program will print out a listing of the files on all '); Writeln(' disks based on the file MAST.CAT. They will be grouped'); Writeln(' by disk. '); Writeln; WriteLn; WriteLn('Turn the printer on. ',^G); WriteLn; WriteLn('Press when the printer is ready.'); ReadLn(CR); WriteLn; CurrLine := 1; FOR Group := 0 TO NumberOfDisks DO BEGIN { Read MAST.CAT into FILES tables (indexed by disk number) } ASSIGN(InputData,'MAST.CAT'); Reset(InputData); ReadLn(InputData,TempLine); {This statement skips past the first entry in MAST.CAT, ie the assumption is that MCAT has been used to skip at most one file name when cataloging files} I := 0 ; IV := 0; While NOT Eof(InputData) DO Begin Readln(InputData,TempLine); IV := IV + 1; II := POS(',',TempLine); DiskNumber := COPY(TempLine,II+2,3); VAL (DiskNumber,DiskIndex,ResultCode); IF DiskIndex >= NumberToProces*Group THEN IF DiskIndex <= NumberToProces * (Group + 1) THEN BEGIN Files[I] := TempLine; I := I +1; End; End; Close(InputData); IMAX := I-2; FOR I:= 0 TO NumberToProces DO BEGIN FileIndex[I] := 0; End; FOR I := 0 TO IMAX DO BEGIN TempLine := Files[I]; II := POS(',',TempLine); DiskNumber := COPY(TempLine,II+2,5); VAL(DiskNumber,DiskIndex,ResultCode); LimitIndex := DiskIndex - Group * NumberToProces; FileIndex[LimitIndex] := FileIndex[LimitIndex] +1; x := FileIndex[LimitIndex]; II := II - 1; Temp := COPY(TempLine,1,II); FilesList[LimitIndex][X] := Temp; End; FOR I := 1 TO NumberToProces DO Begin II := FileIndex[LimitIndex]; If CurrLine >= (PageSize-(2+II/4)) THEN BEGIN WriteLn (Lst,FormFeed); CurrLine := 1; End; WriteLn(Lst,' Disk number: ',I + Group*NumberToProces,' has ',FileIndex[I],' files.'); CurrLine := CurrLine + 1; III := 1; LineOut := ' '; FOR II := 1 TO FileIndex[I] DO BEGIN IF III >4 THEN III := 1; IV := III * 16 - 15; INSERT (FilesList[I,II],LineOut,IV); III := III +1; IF III = 5 THEN IF II <> FileIndex[I] THEN BEGIN WriteLn(Lst,' ',LineOut); CurrLine := CurrLine + 1; End; IF II <> FileIndex[I] THEN IF III = 5 THEN LineOut := ' '; End; WriteLn(Lst,' ',LineOut); CurrLine := CurrLine +2; WriteLn(Lst,' '); END; END; END.