HPlogo SORT-MERGE/XL General User's Guide > Chapter 3 Using SORT/XL Interactively

Sorting and Merging Multiple Files

MPE documents

Complete PDF
Table of Contents
Index
Glossary

SORT-MERGE/XL allows you to sort and merge multiple files in a single operation. This is done by placing the names of the files to be sorted and then merged within parentheses when entering the >INPUT command. Below, the files EMPLOYEE (shown in the previous example) and NEWHIRES (shown below) are sorted by job title and then merged into the file COMPANY in a single operation. The file NEWHIRES contains the following four records:

                 1         2         3         4
        123456789012345678901234567890123456789012345

    1   CARLSON    PETER      BUYER              8043
    2   ADAMS      JERROLD    INSPECTOR          8044
    3   MATHEWS    EDDY       PLANNER            8045
    4   CLARK      STEVE      ASSEMBLER          8046

To sort, and then merge, these two files in a single operation, enter the following commands:

  :SORT
  HP32214A.01.00  SORT/3000 WED, JUN  3, 1987,  9:11 AM
  (C) HEWLETT-PACKARD CO. 1986

  >INPUT (EMPLOYEE, NEWHIRES)
  >OUTPUT COMPANY
  >KEY 23, 19
  >END
  >PURGE OLDOUTPUT FILE COMPANY.GROUP.ACCOUNT? Y

     <<The SORT Statistics Appear Here>>

  :EDITOR

  HP32201A.07.17 EDIT/3000 WED, JUN  3, 1987,  9:12 AM
  (C) HEWLETT-PACKARD CO. 1985
  /TEXT COMPANY
  FILE UNNUMBERED
  /LIST ALL
                 1         2         3         4
        123456789012345678901234567890123456789012345

    1   ANDERSON   MARY       ACCOUNTANT         6345
    2   CLARK      STEVE      ASSEMBLER          8046
    3   CARLSON    PETER      BUYER              8043
    4   SMITH      HOWARD     DESIGNER           6794
    5   LANGE      ROBERT     ENGINEER           3235 
    6   ZIMMER     ANDREW     ENGINEER           5739
    7   ADAMS      JERROLD    INSPECTOR          8044
    8   MATHEWS    EDDY       PLANNER            8045
    9   ANDERSON   CHARLES    PRESIDENT          0247
   10   JOHNSON    FRANCES    RECEPTIONIST       7943
   11   ANDERSON   CHARLES    SALES REP          3456
   12   TAYLOR     HEATHER    SECRETARY          7272
   13   FISHER     TOM        SHIPPING CLERK     7309
   14   CARLSON    ROBERTA    TREASURER          3586

The two files (EMPLOYEE and NEWHIRES) are sorted and merged in the same SORT/XL operation and the output file COMPANY is created.




Sorting Numerically


Saving Selected Key Data Only