The attached program declares a direct access file whose elements are PACKED ARRAYS of a PACKED RECORD. The program fails with error #405 when a rewrite is issued for the file. Removing the PACKED from the array declaration makes the error go away. Is this correct behaviour?
program daj7(input,output);
const maxcontrol = 170; maxcomp = 200; type TCHECK1=PACKED RECORD CHECH:0..47; (*6 bits*) CHECM:0..60; (*6 bits*) CHECS:0..60; (*6 bits*) CHECT:0..999; (*10 bits*) GENERATED:BOOLEAN; QUERY:BOOLEAN; from_audit:boolean; END; TCHECK=PACKED ARRAY [0..MAXCONTROL] OF TCHECK1; (*if declared as PACKED, get error 405 on the rewrite if not declared PACKED, runs OK*)
var count:integer; f:file [0..maxcomp] of tcheck;
begin rewrite(f,'daj7.fil'); (*./daj7: could not open `daj7.fil' (error #405) here *)
for count:=0 to maxcomp do begin seekwrite(f,count); f^[0].chect:=count; put(f); end; close(f);
reset(f,'daj7.fil'); for count:=1 to maxcomp do begin seekread(f,count); writeln(count:1,' ',f^[0].chect:1); end; close(f);
end.