SORT-MERGE/XL Programmer's Guide (32650-90884)
24 Chapter2
Creating Core Routines That Sort and Merge
Initializing a Sort or Merge
The options are
outputoption
equals:
0 Output record format is the same as the input record format (default).
1 Each output record contains a 32-bit integer in binary format that
indicates the logical record number of the record.
The logical record number assigned to each record is the original record
order (the first record is logical record zero, the second record is logical
record one, and so on). If you use file input, the files are in the order that
they are specified in
inputfiles
. For example, if the first file has three
records, the logical record number of the fourth record in the second file is
6.
If you use file input, use the FCOPY utility to view the logical record
numbers. For example, if your output file is ALLEMP, you use the FCOPY
utility to print the value to the screen as follows:
The first two bytes of the record contain the logical record number. For
example, logical record number three (final record number seven, the last
of eight output records) is displayed as follows:
For more information about the FCOPY utility, refer to the FCOPY
Reference Manual (03000-90064) .
If you use record output, use the ASCII intrinsic to convert the logical
record number to a readable format. For details about the ASCII intrinsic,
refer to the MPE XL Intrinsics Reference Manual.
2 Each output record contains only the key fields. The primary key is the
leftmost; each succeeding key is to the right.
The following example shows the formats of the input and output records
if the primary key is last name, the secondary key is employee number.
This is the input record format:
:FCOPY FROM = ALLEMP; TO= $STDLIST; HEX
HP32212A.03.23 FILE COPIER (C) HEWLETT-PACKARD CO. 1984
ALLEMP RECORD 7 (%7, #7)
0000: 0000 0003 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
000C: SAME: TO 0028-1
EOF FOUND IN FROMFILE AFTER RECORD 7
8 RECORDS PROCESSED *** 0 ERRORS
END OF SUBSYSTEM
Jones, Eliza 000001 06/06/87