SORT-MERGE/XL Programmer's Guide (32650-90884)
Chapter 3 45
Input and Output by Record
Example of Record Input
recLength,, numKeys, keys, altseq,,,,,);
length := 72; {read 72 characters}
repeat {read temporary employee file by record}
Lngth := FREAD (TempFileNum, Buffer, Length);
Buffer[40] := '*'; {Mark the record}
if Lngth <> 0 then
HPSORTINPUT (Status, Buffer, Length);
until Lngth = 0;
repeat {read permanent employee file by record}
lngth := FREAD (permfilenum, buffer, length);
if lngth <> 0 then
HPSORTINPUT (status, buffer, length)
until lngth = 0;
HPSORTEND (status, );
end;
procedure CLOSE_FILES;
var
disposition : SHORTINT;
securityCode : SHORTINT;
begin
disposition := 0;
securityCode := 0;
FCLOSE (tempFileNum, disposition, securityCode);
FCLOSE (permFileNum, disposition, securityCode);
disposition := 1;
FCLOSE (outFileNum, disposition, securityCode);
end;
begin {main}
OPEN_FILES;
DO_SORT;
CLOSE_FILES;
end.
When this program is executed, the output is written to ALLEMP. To view ALLEMP:
:print allemp
Everett, Joyce *000029 10/19/87
Gangley, Tomas *000003 06/06/87
Jackson, Jonathan 000006 06/06/87
Jackson, Rosa 000022 08/15/87
Jones, Eliza 000001 06/06/87
Rields, Evelyn *000007 07/12/87
Smith, James 000005 06/06/87
Washington, Lois 000014 07/23/87