Gentle list members,
Have you ever met with the following unpleasant behavior of Pascal/V.
There was a file equation in my job:
!FILE JFILE=JFILE001;REC=-158
The corresponding file variable in my Pascal/V program was:
program(....,ifile,jfile,...);
type
j_type: record
case a: character of
'1' ...
(
acivalu: packed array [1..1] of char;
);
'2' : (
j1: packed array [1..20] of char
j2: ...)
{Total size of the longest variant was 168 characters}
end;
var
ifile: file of j;
jfile: file of j;
j: array [0..4] of j_type;
Somewhere in the program I issued
Reste(i);
Rewrite(jfile);
...
Read(ifile,j[n]);
{After checking the input}
IF bad_i THEN
Write(jfile,j[n]);
....
Close(jfile);
I expected several records in the file JFILE001 but I got 0 records.
No error messages appeared.
OOPS! I wanted to extract number from a field of the j_structure. There
was an Xlibtrap intrinsic call in my program, in order to
handle alien characters in a field of the j_type structure:
PROCEDURE lib_traps( VAR stkmrk, errornum, abortflag : egesz);
BEGIN
abortflag:=-2;
pas_error:=errornum;
END;
strmove(11,activalu,1,sactival,1);
pas_error:=0;
StrRead(sactival,1,t,certactivalu);
IF pas_error > 0 THEN BEGIN
bad_i:=TRUE;
END;
.......................
May be if I had not used the Xlibtrap intrinsic then I should have gotten
a pascal error message?
Pas_error=...?
...........................
Indeed!
FILE JFILE=J;REC=-10,,F,ASCII
:pascalgo reclener.source
PAGE 1 HEWLETT-PACKARD HP32106A.01.14 PASCAL/V (C)
HEWLETT-PAC
CO. 1985 THU, SEP 24, 1998, 8:48 AM
0 1.000 0 program reclener(jfile);
0 2.000 0 type
0 3.000 0 j_type= packed array[1..20] of char;
1 4.000 0 var
1 5.000 0 j : j_type;
2 6.000 0 jfile: file of j_type;
3 7.000 1 begin
3 8.000 1 rewrite(jfile);
4 9.000 1 j:='0123456789abcdefghij';
5 10.000 1 write(jfile,j);
6 11.000 1 close(jfile);
7 12.000 1 end.
NUMBER OF ERRORS = 0 NUMBER OF WARNINGS = 0
PROCESSOR TIME 0: 0: 1 ELAPSED TIME 0: 0: 5
NUMBER OF LINES = 12 LINES/MINUTE = 586.8
END OF COMPILE
END OF PREPARE
**** ERROR OCCURRED WHILE WRITING TO FILE (PASCERR 695)
WRITE EXCEEDS RECORD SIZE (FSERR 43)
Regards
Frank
|\ /~ ~~|~~~ Family : NAGY; first name : FERENC; title : Ph. D.
| \ | | Institute of Isotope and Surface Chemistry
| \ | -+- H-1121 BUDAPEST Konkoly-Thege M. ut 29, (1525 Bp. POB 77)
| \ | | [log in to unmask] (36-1)-395-9123 Fax: ~395-9002
| \| | http://alpha0.iki.kfki.hu/~nagyf/
`-' ' `-' Home: H-1102 BUDAPEST Holgy u. 48. I. 8. (36-1)-262-1198.
You need three virtues in the life:
1. strength - to change the things which are changeable,
2. patience - to endure the things which are unchangeable,
3. wisdom - to distinguish the above two kinds of things.
|