home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TABUG.ZIP / TESTDATA.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1988-03-18  |  1.0 KB  |  45 lines

  1. program testdata; {generate test data}
  2.  
  3. uses
  4. dos,crt,taccess,printer;
  5.  
  6. TYPE
  7. OP_rec = record     {data file for testing TACESS}
  8.   state     : byte;
  9.   dummy     : array[1..3] of byte;
  10.   items     : longint;
  11.   crlf      : array[1..2] of char;
  12.   end;{IP_rec}
  13.  
  14. VAR
  15. OP           : file of OP_rec;
  16. Obuff        : OP_rec;
  17. total        : array[0..52] of longint;
  18. c            : byte;
  19. d            : longint;
  20. RecsPerState : integer;
  21.  
  22. {***************************
  23.          main
  24. ***************************}
  25. BEGIN
  26. assign(op,'testdata.new');
  27. rewrite(OP);
  28. fillchar(total,sizeof(total),0); {init totals}
  29. obuff.crlf[1] := #13;
  30. obuff.crlf[2] := #10;
  31. write('Enter # records per state =>');
  32. readln(RecsPerState);
  33. for c := 0 to 52 do begin
  34.   obuff.state := c;
  35.   for d := 1 to RecsPerState do begin  {bug occurs when RecsPerState is large}
  36.     obuff.items := d;
  37.     write(op,obuff);
  38.     total[c] := total[c] + d;
  39.     end;
  40.   end;
  41. close(OP);
  42. for c := 0 to 52 do
  43.   writeln(lst,'state ',c,' total is ',total[c]:7);
  44. END.
  45.