Source file: /~heha/j/japextra.zip/RES/ONCAT.PAS

{Zusammenfassen der ON-Lesungen}
var
 S,SBefore,sline: String;
 linebefore,line, e, i: Integer;
 f: Text;

function GetField(const S:String; Field:Integer):Integer;
{ohne Test auf Stringüberlauf!!}
 var
  I: Integer;
 begin
  I:=1;
  while Field>0 do begin
   if S[I]=#9 then Dec(Field);
   Inc(I);
  end;
  GetField:=I;
 end;

begin
 linebefore:=0;
 assign(f,ParamStr(1)); Reset(f);
 while not eof(f) do begin
  ReadLn(f,S);
  sline:=Copy(S,1,Pos(#9,S)-1);
  Delete(S,GetField(S,6),GetField(S,7)-GetField(S,6));
  Val(sline,line,e);
  if (e=0) and (line=linebefore) then begin
   Insert(','+Copy(S,GetField(S,6),GetField(S,7)-GetField(S,6)-1),
     SBefore,GetField(SBefore,7)-1);
  end else begin
   if e=0 then WriteLn(SBefore);
   linebefore:=line;
   SBefore:=S;
  end;
 end;
 WriteLn(SBefore);
 Close(f);
end.
Detected encoding: OEM (CP437)1
Wrong umlauts? - Assume file is ANSI (CP1252) encoded