SORT-MERGE/XL Programmer's Guide (32650-90884)
42 Chapter3
Input and Output by Record
Record Input
example, if your program accepts input from a terminal). Record input is only available for
SORT/XL.
Choose the output by record option when you want to sort or merge information during a
program's execution without directly storing the information. For example, use it if you
want to display a sorted list to a user's terminal, or if you want a chance to modify the
output before storing in a file.
Record Input
Record input is useful for sorting information that is entered interactively or produced
internally by a program. To input records to SORT/XL you use the HPSORTINPUT intrinsic.
MERGE/XL does not allow record input. The syntax of HPSORTINPUT is:
HPSORTINPUT (
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 build
buffer
byte by byte.
The
length
parameter contains the length of the record.
NOTE
This value must not be greater than the value of the
reclength
parameter in
the HPSORTINIT intrinsic.
An example of using HPSORTINPUT follows:
var
status : INTEGER;
buffer : packed array [1..80] of CHAR;
length : INTEGER;
.
.
.
HPSORTINPUT (status, buffer, length);
To use record input:
• The
reclength
parameter in HPSORTINIT must be specified.
• The
inputfiles
parameter in HPSORTINIT must not be specified.