program telepac (input,output,log1,log2,out); {Analyse the POLL ALL output from a TelePAC} {Two files are read, and the time difference between the 'readings'} TYPE stata = ARRAY [1..2, 1..14] of integer; polla = ARRAY [1..2, 1..30, 1..21] of integer; ptpolla = ^polla; string = PACKED ARRAY [1..80] of CHAR; VAR { log1, log2, out: text;} hours, mins, secs, index, i, j,q1, q2: integer; k: real; str: string; stat: stata; poll: ptpolla; fn1, fn2, out1: string; PROCEDURE readfile; VAR i, j, k: integer; c1: char; BEGIN FOR i := 1 to 14 DO BEGIN read(log1, stat[1, i]); END; readln(log1); FOR k := 1 to 30 DO BEGIN FOR i := 1 to 5 DO read(log1, poll^[1, k, i]); FOR i := 1 to 6 DO read(log1, c1); FOR i := 1 to 16 DO read(log1, poll^[1, k, i+5]); readln(log1); END; END; PROCEDURE readfile2; VAR i, j, k: integer; c1: char; BEGIN FOR i := 1 to 14 DO read(log2, stat[2, i]); readln(log2); FOR k := 1 to 30 DO BEGIN FOR i := 1 to 5 DO read(log2, poll^[2, k, i]); FOR i := 1 to 6 DO read(log2, c1); FOR i := 1 to 16 DO read(log2, poll^[2, k, i+5]); readln(log2); END END; FUNCTION max(index, pos:integer): integer; VAR i,j,k,l: integer; BEGIN k := poll^[1, index, pos]; l := poll^[2, index, pos]; IF k>l THEN max := k ELSE max := l; END; FUNCTION ps(index, pos: integer): real; VAR i, j, k, l: integer; x, y: real; BEGIN k := poll^[1, index, pos]; l := poll^[2, index, pos]; ps := (l-k)/secs; END; FUNCTION sb(index, pos: integer): integer; BEGIN sb := poll^[2, index, pos]-poll^[1, index, pos]; END; BEGIN new(poll); write('First Log File name?'); readln(fn1); write('Second Log File name?'); readln(fn2); write('Output to?'); readln(out1); pdefine(log1, fn1); reset(log1); pdefine(log2, fn2); reset(log2); pdefine(out, out1); rewrite(out); writeln; write('Time Difference, hours?'); readln(hours); write('Mins?'); readln(mins); secs := ((hours*60)+mins)*60; write('Title?'); readln(str); writeln(out, str); writeln(out); writeln(out); readfile; readfile2; writeln(out, 'Line Calls Calls/M Rx/S Tx/s RxB/s TxB/s CRC ReTX'); for i := 1 to 30 DO BEGIN write(out, i:4, max(i, 5):8); q1 := poll^[1, i, 17]+poll^[1, i, 18]; q2 := poll^[2, i, 17]+poll^[2, i, 18]; k := (q2-q1)*60/secs; write(out, k:7:1); write(out, ps(i, 13):8:1, ps(i, 14):7:1, ps(i, 11):7:1); write(out, ps(i, 12):7:1, sb(i, 1):8, sb(i, 2):8); writeln(out); END; END.