SORT-MERGE/XL Programmer's Guide (32650-90884)

46 Chapter3
Input and Output by Record
Record Output
Record Output
Record output is useful when you want to create temporary output of a set of sorted or
merged data, to create a subset of the sorted or merged information, or to alter the records
before outputting them.
To output from SORT-MERGE/XL by record, use either the HPSORTOUTPUT or
HPMERGEOUTPUTintrinsic. The syntax is:
HPSORTOUTPUT (
status
,
buffer
,
length
);
HPMERGEOUTPUT (
status
,
buffer
,
length
);
The
buffer
parameter contains the record to be input.
NOTE
The
buffer
parameter is a character (byte) array. If your record contains
other data types, you must reconstruct them from
buffer
.
The
length
parameter returns the length of the record. After the last record is reached,
length
returns a value of negative one (-1).
If you use record output, do not specify the
outputfile
parameter in HPSORTINIT or
HPMERGEINIT. Use the intrinsic ASCII if you have specified
outputoption
in HPSORTINIT
to be binary format, but you want displayable ASCII characters instead.
An example follows:
var
status : INTEGER;
buffer : packed array [1..80] of CHAR;
length : SHORTINT;
.
.
.
HPSORTOUTPUT (status, buffer, length);