Data File Migration [ HP Pascal/XL Migration Guide ] MPE/iX 5.0 Documentation
HP Pascal/XL Migration Guide
Data File Migration
The following program illustrates the migration of REAL data from
Pascal/V to HP Pascal/XL. This program calls the hpFPCONVERT intrinsic
that is described in the Programmer's Skill Migration Guide.
$HP3000_16$
PROGRAM Convertfile(file1,file2);
CONST
HP3000_32bit=1;
IEEE_32=3;
RoundToZero=1;
TYPE
ARR1=ARRAY[1..10] of -32768..32767; { 20 bytes allocated }
CMrec=RECORD
f1:char;
f2:Boolean;
f3:String[40]; { 44 bytes allocated }
f4:ARR1;
f5:REAL; { MPE V floating-point representation }
{ aligned on 2-byte boundary }
END;
NMARR1=$HP3000_32$ ARRAY[1..10] of -32768..32767; {40 bytes allocated }
NMRec=$HP3000_32$ RECORD
f1:char;
f2:Boolean;
f3:String[40]; {48 bytes allocated }
f4:NMARR1;
f5:REAL; { IEEE floating point }
{ aligned on 4 byte boundary }
END;
file2type=$HP3000_32$ FILE OF NMRec;
VAR
file1:FILE OF CMrec;
file2:file2type;
V1:CMrec;
V2:NMrec;
INX:1..10;
status:INTEGER;
except:-32768..32767;
PROCEDURE hpFPCONVERT; INTRINSIC;
BEGIN (*Program Convertfile*)
RESET(file1);
REWRITE(file2);
WHILE NOT EOF(file1) DO
BEGIN (*Read and Write*)
READ(file1,V1);
WITH V1 DO
BEGIN (*Assign the component*)
V2.f1:=f1;
V2.f2:=f2;
StrConvert(f3,V2.f3);
FOR INX:=1 to 10 DO
V2.f4[INX]:=f4[INX];
hpFPCONVERT(f5,V2.f5,HP3000_32bit,
IEEE_32bit,status,except,
RoundToZero);
END; (*Assign the component*)
WRITE (file2,V2);
END; (*Read and Write*)
END. (*Program Convertfile*)
MPE/iX 5.0 Documentation