SORT-MERGE/XL Programmer's Guide (32650-90884)
Chapter 3 43
Input and Output by Record
Example of Record Input
Example of Record Input
The following program sorts the personnel files shown below. They are sorted by last name.
The program marks the employee numbers of the temporary employees with an asterisk.
These two files, TERMEMP and PERMEMP, are used in the following example. (The data
descriptions in the top line, and the character positions along the bottom do not appear in
the file. They are for your convenience only.)
TEMPEMP Information file about temporary employees:
Last Name First Name Employee Number Hire Date
Gangley, Tomas 000003 06/06/87
Rields, Evelyn 000007 07/12/87
Everett, Joyce 000029 10/19/87
0 1 2 3 4 5 6 7
1234567890123456789012345678901234567890123456789012345678901234567890
PERMEMP Information file about permanent employees:
Last Name First Name Employee Number Hire Date
Jones, Eliza 000001 06/06/87
Smith, James 000005 06/06/87
Jackson, Johnathon 000006 06/06/87
Washington, Lois 000014 07/23/87
Jackson, Rosa 000022 08/15/87
0 1 2 3 4 5 6 7
1234567890123456789012345678901234567890123456789012345678901234567890
Example 3-1. SORTREC_IN Program
program SORTREC_IN (input,output);
{This program reads the files, TEMPEMP & PERMEMP, alters the TEMPEMP records, }
{passes all records to SORT/XL, and outputs to the file, ALLEMP. }
var
tempFileNum: INTEGER;
permFileNum: INTEGER;
outFileNum : INTEGER;
status : INTEGER;
procedure HPFOPEN; intrinsic;
procedure HPSORTINIT; intrinsic;
function FREAD : SHORTINT; intrinsic;
procedure HPSORTINPUT; intrinsic;
procedure HPSORTEND; intrinsic;
procedure FCLOSE; intrinsic;
procedure OPEN_FILES;