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

Defining Your Own Collating Sequence

MPE documents

Complete PDF
Table of Contents
Index
Glossary

You can define a customized collating sequence unique to your application. For example, in the section "Collating Sequences" in Chapter 2, an example was used where an accountant wanted the special character $ to follow the D in the collating sequence. This makes it possible to have $ INVENTORY follow DOLLAR INVENTORY but come before other entries, such as EXPENSES.

To alter the standard sequence so $ INVENTORY follows DOLLAR INVENTORY, but comes before EXPENSES, enter the following commands:

  :SORT

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

  >DATA IS ASCII, SEQUENCE IS ASCII
  >ALTSEQ MERGE "D" = "$"
  >SHOW SEQUENCE

  nul soh stx etx eot enq ack bel  bs  ht  lf  vt  ff  cr  so  si
  del dc1 dc2 dc3 dc4 nak syn etb can  em sub esc  fs  gs  rs  us
   sp   !   "   #   %   &   '   (   )   *   +   ,   -   .   /   0
    1   2   3   4   5   6   7   8   9   :   ;   <   =   >   ?   @
    A   B   C   D   $   E   F   G   H   I   J   K   L   M   N   O
    P   Q   R   S   T   U   V   W   X   Y   Z   [   \   ]   ^   _
    `   a   b   c   d   e   f   g   h   i   j   k   l   m   n   o
    p   q   r   s   t   u   v   w   x   y   z   {   |   }   ~ del

The following example shows the results of the sort with and without altering the collating sequence for the entries $ INVENTORY, DOLLAR INVENTORY, and EXPENSES:

  SORT WITH ALTERED            SORT WITH STANDARD
      SEQUENCE                      SEQUENCE

  DOLLAR INVENTORY             DOLLAR INVENTORY
  $ INVENTORY                  EXPENSES
  EXPENSES                     $ INVENTORY

A commonly used alteration to the standard ASCII collating sequence is merging upper case and lower case alphabetic characters. In the standard collating sequence, all upper case characters precede all lower case characters. The standard ASCII collating sequence is shown in the section, "Using >SHOW to Display the Collating Sequence". To order alternating upper case and lower case characters, enter the following commands:

  :SORT

  HP32214A.01.00  SORT/3000 WED, JUN  3, 1987,  9:45 AM
  (C) HEWLETT-PACKARD CO. 1986
  
  >DATA IS ASCII, SEQUENCE IS ASCII
  >ALTSEQ MERGE "A-Z" with "a-z"
  >SHOW SEQUENCE
  
  nul soh stx etx eot enq ack bel  bs  ht  lf  vt  ff  cr  so  si
  del dc1 dc2 dc3 dc4 nak syn etb can  em sub esc  fs  gs  rs  us
   sp   !   "   #   $   %   &   '   (   )   *   +   ,   -   .   /
    0   1   2   3   4   5   6   7   8   9   :   ;   <   +   >   ?
    @   A   a   B   b   C   c   D   d   E   e   F   f   G   g   H
    h   I   i   J   j   K   k   L   l   M   m   N   n   O   o   P
    p   Q   q   R   r   S   s   T   t   U   u   V   v   W   w   X
    x   Y   y   Z   z   [   \   ]   ^   _   `   {   |   }   ~ del

For additional information on altering collating sequences, refer to the >ALTSEQ command in Chapter 6.




Using >SHOW to Display the Translation Table


Using the Terminal as the Output File