DEC's SORT-MERGE program (about 2 to 4 times more efficient than CSORT).
This can be used as a stand-alone program or called from Fortran or Cobol.
To be used as a stand-alone basis, first type:
R SORT
The program will respond with a "*". It is then ready to receive
a command line. After a command is entered and completed, a "*"
will again be displayed, then another command may be entered, or
"/EXIT" or <cntl>C or <cntl>Z may be entered to exit from SORT.
The /CORE switch is usually well worth using for moderate to large
files. Savings of a factor of 2 in cost are not difficult to achieve.
Left to itself SORT will use large amounts of core without much gain
in speed. Try /CORE:20K and try more or less core to really find the
most efficient values. Unfortunately the most efficient values not
only depend on the size and nature of the file, but also on the
initial order so no general rules can be given.
General command format for SORT and MERGE:
OUT.FIL/SW,SW,...= IN.FIL/SW,SW,.../FUNCTION
Functions are:
/EXIT takes no arguments
/HELP takes no arguments
/MERGE see below
/RUN (program) file-spec
/SORT see below (default)
indirect command files may be used: @filspec
SORT and MERGE Switches are:
/RECORD:<n> n = maximum record size (does not imply /FIXED)
/KEY:<n>:<m>:<x> the first two arguments are mandatory
<n> position of first KEY character
<m> length of the KEY
<x> can be ASCENDING, or DESCENDING
Key data type switches:
/ALPHANUMERIC
/COMP1
/COMP3
/COMPUTATIONAL
/FORMAT:a<b>.<c> where a<b>.<c> is a FORTRAN format descriptor
a = D decimal floating point, double precision
E decimal floating point, single precision
F decimal fixed point
G general
<b> = KEY length
<c> = number of decimal places
/NUMERIC
/SIGNED key operational sign is to be used
/UNSIGNED key operational sign is to be ignored
/ALIGN word align all ASCII output records
/ASCII recording mode
/BINARY recording mode
/EBCDIC recording mode
/SIXBIT recording mode
/BLOCKED:<n> COBOL blocking factor
/FIXED fixed length records
/FORTRAN FORTRAN type data file
/RANDOM must also use /FORTRAN when sorting Fortran random access files
/SEQUENTIAL same as /VARIABLE
/VARIABLE variable length records
/BUFFER-PAGES<n> number of pages for IO buffers
/CHECK when merging check the sequence of the input record key
/COLLATE:<a> <a> is one of the following
ASCII collating sequence
EBCDIC collating sequence
FILE:file-spec
LITERAL:/collating-sequence/ first char after colon is delimeter
ADDRESS:<N> octal address
/CORE:<n>K or <n>P specifies low segment core to be used in K (1024 words,
default) or in pages (512 words)
/ERROR-RETURN:<n> octal address
/FATAL-ERROR-CODE:<n> octal address
/LEAVES:<n> <n> is the number of records to keep in main memory
/PHYSICAL do not use logical names
/SUPPRESS-ERROR:<a> <a> is one of the following
ALL
FATAL
INFORMATION
NONE
WARNING
/TEMPORARY-AREAS:directory-name,...
/ANSI-ASCII alias STANDARD ASCII for mag-tape
/DENSITY:<a> <a> is one of the following
200
556
800
1600
SYSTEM-DEFAULT
/INDUSTRY industry compatible (8 bit) mode for mag-tape
/LABEL:<a> <a> is one of the following
ANSI
DEC
IBM
NONSTANDARD
OMITTED
STANDARD
/PARITY:<a> <a> is one of the following
EVEN
ODD
/REWIND before use
/UNLOAD after use
Examples: (All the switches below may be abbreviated to one character.)
TEST.OUT=TEST.IN/REC:70/KEY:21:10:DESC/CORE:20K
a descending sort (default is ascending)
TEST.OUT=TEST.IN/REC:70/KEY:21:10/FORMAT:F10.4/CORE:20K
sort in numeric order on a field that has a decimal point
(which actually may be anywhere in the field)
TEST.OUT=TEST.IN/REC:70/KEY:21:10/KEY:41:5/CORE:20K
a two key sort, key given first is primary
TEST.OUT=TESTA.IN,TESTB.IN/REC:70/KEY:21:10/CORE:20K/MERG
merge two similar, pre-sorted files
TEST.OUT=TESTA.IN,TESTB.IN/REC:70/KEY:21:10/CORE:20K
merge and sort two similar files. That's right, without the "/MERG",
the output file will be merged and sorted.
For more information see DEC's SORT/MERGE User's Guide. This is
a (shock) well written manual that even includes a beginner's section.
Multi-line sets can be sorted if they are fixed length. When counting
characters, include the <CR> <LF> characters on all lines execpt the
last when giving the record length. References to positions in the set
must also take into account the <CR> <LF> characters.
Note: SORT-MERGE is smart enough to look at all the disks available
to you and use them for its temporary sorting files. But it is not
smart enough to stop using a disk when its quota is being exceeded!
So--If you sort a large file and have a disk with a small quota, you
should DISMOUNT that small-quota-disk first. The DISMOUNT would be
only a logical opperation--making the system ignore the presence of
that disk as far as your job is concerned. Example: .DISMOUNT DSKB