Qualifiers used in a Sort/Merge specification file are similar
to the DCL qualifiers used in the SORT or MERGE command line.
However, in some cases, the format of these qualifiers can be
different. For example, the /KEY qualifier at DCL level has a
different format than the /KEY qualifier in the specification
file.
If you specify DCL command qualifiers in the SORT or MERGE
command line, those qualifiers override corresponding entries
in the specification file.
High-performance Sort/Merge: The high-performance Sort/Merge
utility does not currently support the use of specification
files.
1 – Specification File Example
/FIELD=(NAME=RECORD_TYPE,POS:1,SIZ:1) ! Records type, one-byte field
/FIELD=(NAME=PRICE,POS:2,SIZ:8) ! Price field, both files
/FIELD=(NAME=TAXES,POS:10,SIZ:5) ! Taxes field, both files
/FIELD=(NAME=STYLE_A,POS:15,SIZ:10) ! Style field, format A file
/FIELD=(NAME=STYLE_B,POS:20,SIZ:10) ! Style field, format B file
/FIELD=(NAME=ZIP_A,POS:25,SIZ:5) ! Zip code field, format A file
/FIELD=(NAME=ZIP_B,POS:15,SIZ:5) ! Zip code field, format B file
/CONDITION=(NAME=FORMAT_A, ! Condition test, format A file
TEST=(RECORD_TYPE EQ "A"))
/CONDITION=(NAME=FORMAT_B, ! Condition test, format B file
TEST=(RECORD_TYPE EQ "B"))
KEY=ZIP_A,
DATA=PRICE,
DATA=TAXES,
DATA=STYLE_A,
DATA=ZIP_A)
/INCLUDE=(CONDITION=FORMAT_B, ! Output format, type B records
KEY=ZIP_B,
DATA=PRICE,
DATA=TAXES,
DATA=STYLE_B,
DATA=ZIP_B)
In this example, two input files from two different branches of
a real estate agency are sorted according to the instructions
specified in a specification file. The records in the first
file that begin with an A in the first position have this
format:
|A|PRICE|TAXES|STYLE|ZIP|
1 2 10 15 25
The records in the second file that begin with a B in the first
position and have the style and zip code fields reversed, as
follows:
|B|PRICE|TAXES|ZIP|STYLE|
1 2 10 15 20
To sort these two files on the zip code field in the format
of record A, first define the fields in both records with the
/FIELD qualifiers. Then, specify a test to distinguish between
the two types of records with the /CONDITION qualifiers.
Finally, the /INCLUDE qualifiers change the record format of
type B to record format of type A on output.
Note that, if you specify either key or data fields in an
/INCLUDE qualifier, you must explicitly specify all the key and
data fields for the sort operation in the /INCLUDE qualifier.
Also note that records that are not type A or type B are
omitted from the sort.
2 /CDD_PATH_NAME
Identifies fields and attributes defined for use with the
Common Data Dictionary (CDD/Plus). Once the fields have been
identified, they can then be used later with other specification
file qualifiers, such as /KEY, /CONDITION, /INCLUDE, or /OMIT.
You can use the /CDD_PATH_NAME qualifier only if your system has
CDD/Plus installed.
Format
/CDD_PATH_NAME="cdd-path-name"
2.1 – Qualifier Values
"cdd-path-name"
Specifies the CDD/Plus record definition within CDD/Plus.
2.2 – Full Description
/CDD_PATH_NAME can be used in place of or in conjunction with
/FIELD statements. The /CDD_PATH_NAME qualifier identifies
CDD/Plus defined fields and attributes for SORT. Identifying
these fields with this qualifier is the same as specifying them
with the /FIELD qualifier.
2.3 – Example
/CDD_PATH_NAME="customer"
The /CDD_PATH_NAME qualifier identifies the customer record,
which was previously identified in CDD/Plus.
3 /CHECK_SEQUENCE
Specifies whether or not the sequence of records in the input
files is checked when files are merged. By default the sequence
of records is not checked. Use only with the MERGE command.
Formats
/CHECK_SEQUENCE
/NOCHECK_SEQUENCE
3.1 – Full Description
By default, Merge does not check the sequence of records in
the input files. If you want to override that default, specify
/CHECK_SEQUENCE in your specification file text.
3.2 – Example
/NOCHECK_SEQUENCE
The /NOCHECK_SEQUENCE qualifier overrides Merge's default
behavior.
4 /COLLATING_SEQUENCE
Specifies the collating instructions for a sort or merge
operation. With the /COLLATING_SEQUENCE qualifier, you can
specify ASCII (the default), EBCDIC, or Multinational sequence;
you can also define your own sequence.
Formats
/COLLATING_SEQUENCE=
(SEQUENCE=sequence_type
[,MODIFICATION=(character operator character)]
[,IGNORE=character or character-range,...]
[,FOLD]
[,[NO]TIE_BREAK])
4.1 – Qualifier Values
SEQUENCE=sequence_type
ASCII
Specifies ASCII collating sequence, which is the default
sequence.
EBCDIC
Arranges characters according to EBCDIC sequence. The characters
remain in ASCII representation; only the order is changed.
MULTINATIONAL
Arranges characters according to Multinational sequence, which
collates the international character set. When you use the
Multinational sequence, characters are ordered according to the
following rules:
o All diacritical forms of a character are given the collating
value of the character (A',A",A` collate as A).
o Lowercase characters are given the collating value of their
uppercase equivalents (a collates as A, a" collates as A").
o If two strings compare as equal, tie-breaking is performed.
The strings are compared to detect differences due to
diacritical marks, ignored characters, or characters that
collate as equal although they are actually different. If the
strings still compare as equal, another comparison is done
based on the numeric codes of the characters. In this final
comparison, lowercase characters are ordered before uppercase.
Care should be taken when sorting or merging files for further
processing using the Multinational sequence. Sequence checking
procedures in most programming languages compare numeric
characters. Because Multinational is based on actual graphic
characters and not on the codes representing those characters,
normal sequence checking does not work.
user-defined-sequence
Specifies a user-defined collating sequence. Define a collating
sequence by specifying a string of single or double characters
or ranges of single characters. (A double character is any set
of two single characters collated as if they were one character.
For example, "CH" can be defined to collate as "C".) This string
should be enclosed in parentheses.
You can also represent characters by their corresponding octal,
decimal, or hexadecimal values using the radix operators: %O, %D,
%X.
You must observe the following rules when defining your collating
sequence:
o Enclose characters in quotation marks (" ").
o Separate each character and character range with a comma, and
enclose the entire list in parentheses.
o Give all the characters appearing in the character keys in
the sort or merge operation a collating value. Any character
not given a collating value will be ignored unless the FOLD or
MODIFICATION options are specified.
o Do not define a character more than once.
o Do not specify the null character by using quotation marks
(""). Instead, use a radix operator such as %X0.
o Specify quotation marks by enclosing them within another set
of quotation marks ("" "") or by using a radix operator.
MODIFICATION=(character operator character)
Specifies a change to the collating sequence specified in the
SEQUENCE option. You can modify the ASCII, EBCDIC, Multinational,
or user-defined sequence. The sequence being modified must be
specified with the SEQUENCE qualifier even if the sequence is the
default (ASCII).
character
Specifies a character in the collating sequence. You can specify
a single or double character. A double character is any set
of two single characters collated as if they were a single
character. Enclose the character in quotation marks.
operator
Specifies the operator used to compare the characters. You can
specify greater than (>), less than (<), or equal to (=).
These are the kinds of changes permitted in the MODIFICATION
option:
o A single or double character can be equated to a single
character that has already been assigned a collating value
("a"="A").
o A single or double character can collate after a single
character that has already been assigned a collating value
("CH">"C").
o A single or double character can collate before a single
character that has already been assigned a collating value
("D"<"A").
o A double character can be equated to a previously defined
double character ("CH" = "SH").
o A single character can be equated to a double character
sequence ("C" = "CH").
IGNORE
Specifies that Sort/Merge ignore a character or character range
in the collating sequence when making an initial comparison.
Note that, when tie-breaking takes place, Sort/Merge considers
the characters specified with the IGNORE qualifier. Tie-breaking
takes place when two or more strings have compared as equal and
the Multinational sequence is being used or when two or more
strings have compared as equal and the TIE_BREAK qualifier has
been specified.
FOLD
Specifies that all lowercase letters be given the collating value
of their uppercase equivalents. For ASCII, EBCDIC, and user-
defined sequences, the lowercase letters are a to z.
Because the lowercase letters in the Multinational sequence
already have the collating value of their uppercase equivalents,
using FOLD is unnecessary.
TIE_BREAK
Specifies whether or not Sort/Merge should use numeric values to
break any ties between characters that have equivalent values.
By default, tie-breaking occurs with the Multinational sequence.
Specifying NOTIE_BREAK overrides this default and ensures that no
further comparisons are made after the initial comparison.
A TIE_BREAK option must be specified for the ASCII, EBCDIC, and
user-defined sequences in order for tie-breaking to occur. TIE_
BREAK should be used when specifying FOLD or MODIFICATION for the
these sequences.
4.2 – Full Description
The MODIFICATION, IGNORE, FOLD, and [NO]TIE_BREAK options of
the /COLLATING_SEQUENCE qualifier can also be used to modify the
collating sequence. You can make more than one modification to
the collating sequence. If you intend to modify any collating
sequence, you must specify the sequence in the SEQUENCE option,
even if it is the default sequence (ASCII).
Because the FOLD, MODIFICATION, and IGNORE qualifiers are
processed in the order in which they are specified, care should
be taken when specifying the order of those qualifiers. Normally,
FOLD should be specified after all MODIFICATION and IGNORE
qualifiers to ensure that the effects of the MODIFICATION and
IGNORE qualifiers apply to uppercase and lowercase characters.
You can request that Sort/Merge ignore a character or character
range within the given collating sequence by using the IGNORE
qualifier.
By default, in the Multinational collating sequence, Sort/Merge
folds lowercase letters into their uppercase equivalents. If
you want this folding to occur in the other collating sequences,
you must specify a FOLD qualifier with the instructions for the
collating sequence.
Also, by default in the Multinational collating sequence,
Sort/Merge uses numeric comparisons to break any ties in the
collating values. Ties occur when two equal keys collate the
same. If you do not want the default when using the Multinational
collating sequence, specify the keyword NOTIE_BREAK. For tie
breaking in the other collating sequences, specify a TIE_BREAK
qualifier.
4.3 – Examples
1./COLLATING_SEQUENCE=(SEQUENCE=ASCII,IGNORE=("-"," "))
This /COLLATING_SEQUENCE qualifier with an IGNORE option
specified results in the following fields being compared as
equal before tie breaking:
252-3412
252 3412
2523412
2./COLLATING_SEQUENCE=(SEQUENCE=("A"-"L","LL","M"-"R","RR","S"-"Z"))
This /COLLATING_SEQUENCE qualifier defines a sequence in
which the double character LL collates as a single character
between L and M, and the double character RR collates as a
single character between R and S. These double characters
would otherwise appear in their usual alphabetical order. By
default, this user-defined sequence does not define any other
characters, such as lowercase a to z.
3./COLLATING_SEQUENCE=(SEQUENCE=
("AN","EB","AR","PR","AY","UN","UL",
"UG","EP","CT","OV","EC","0"-"9"),
MODIFICATION=("'"="19"),
FOLD)
This /COLLATING_SEQUENCE qualifier defines a collating
sequence. It includes a user-defined sequence that gives each
month a unique value in chronological order. For example, if
you want to order a file called SEMINAR.DAT according to the
date, the file SEMINAR.DAT would be set up as follows:
16 NOV 1983 Communication Skills
05 APR 1984 Coping with Alcoholism
11 Jan '84 How to Be Assertive
12 OCT 1983 Improving Productivity
15 MAR 1984 Living with Your Teenager
08 FEB 1984 Single Parenting
07 Dec '83 Stress --- Causes and Cures
14 SEP 1983 Time Management
The primary key is the year field; the secondary key is the
month field. Because the month field is not numeric and you
want the months ordered chronologically, you must define
your own collating sequence. You can do this by sorting on
the second two letters of each month-in their chronological
sequence-giving each month a unique key value.
The MODIFICATION option specifies that the apostrophe (') be
equated to 19, thereby allowing a comparison of '83 and 1984.
The FOLD option specifies that uppercase and lowercase letters
are treated as equal.
The output from this sort operation appears as follows:
14 SEP 1983 Time Management
12 OCT 1983 Improving Productivity
16 NOV 1983 Communication Skills
07 Dec '83 Stress --- Causes and Cures
11 Jan '84 How to Be Assertive
08 FEB 1984 Single Parenting
15 MAR 1984 Living with Your Teenager
05 APR 1984 Coping with Alcoholism
5 /CONDITION
Defines conditions for key and data handling and for record
selection.
Formats
/CONDITION= (NAME=condition-name,
TEST=(field-name operator test-condition
[logical-operator ...]))
5.1 – Qualifier Values
NAME=condition-name
Specifies the name of the condition you are testing. This
condition-name can be used in /KEY, /DATA, /OMIT, and /INCLUDE
qualifiers after it has been defined using the /CONDITION
qualifier.
TEST=(field-name operator test-condition)
Specifies the conditional test.
field-name
Specifies the name of the field you are testing. The field-name
must be defined previously by a /FIELD qualifier.
operator
Specifies the logical or relational operator used in the
conditional test. The logical operators that you can use are
AND and OR. The relational operators that you can specify are as
follows:
EQ Equal to
NE Not equal to
GT Greater than
GE Greater than or equal to
LT Less than
LE Less than or equal to
test-condition
Specifies the constant or field-name against which you are
testing. A constant is specified with the following format:
Decimal_digits (default)
%Ddecimal_digits
%Ooctal_digits
%Xhexadecimal_digits
"character"
NOTE
Normally, you do not need to specify the radix operator
(%D); however, test-condition will assume the same data type
as the field-name.
The field-name must be defined by a /FIELD qualifier.
5.2 – Full Description
A specification file can be used to change the relative order of
a record or to alter the contents of certain fields of a record.
You must first use a /CONDITION qualifier to define a conditional
test. Once you define a test using a /CONDITIONAL qualifier, you
can use that same test with a /KEY or /DATA qualifier to change
the order of record. You can also use the test with an /OMIT or
/INCLUDE qualifier to change the contents of a record.
If you want to change the order of records in the output file,
first specify a condition name with a /CONDITION qualifier and
set up a test for what meets that condition. Then, specify the
relative order with a /KEY qualifier of the form:
/KEY=(IF condition-name THEN value ELSE value)
You can use any values to specify the relative order of the
records.
The /CONDITION qualifier also permits you to change the contents
of a field in the output records. First specify a condition name,
and then set up a test for what meets the condition. Specify the
contents you want in the field in a /DATA qualifier of the form:
/DATA=(IF condition-name THEN "new-contents" ELSE "new-contents")
5.3 – Examples
1./FIELD=(NAME=AGENT,POSITION:20,SIZE:15)
/CONDITION=(NAME=AGENCY,
TEST=(AGENT EQ "Real-T Trust"
OR
AGENT EQ "Realty Trust"))
/DATA=(IF AGENCY THEN "Realty Trust" ELSE AGENT)
In this example, two real estate files are being sorted. One
file refers to an agency as Real-T Trust; the other refers
to the same agency as Realty Trust. The /CONDITION and /DATA
qualifiers instruct Sort to list the AGENT field in the sorted
output file as Realty Trust.
2./FIELD=(NAME=ZIP,POSITION:60,SIZE:6)
/CONDITION=(NAME=LOCATION,
TEST=(ZIP EQ "01863"))
/KEY=(IF LOCATION THEN 1
ELSE 2)
In this example, all the records with a zip code of 01863
will appear at the beginning of the sorted output file. The
conditional test is on the ZIP field, defined with the /FIELD
qualifier; the condition is named LOCATION. The values 1 and
2 in this /KEY qualifier signify a relative order for those
records that satisfy the condition and those that do not.
3./FIELD=(NAME=ZIP,POSITION:60,SIZE:6)
/CONDITION=(NAME=LOCATION,
TEST=(ZIP EQ "01863"))
/DATA=(IF LOCATION THEN "NORTH CHELMSFORD"
ELSE "Outside district")
In this example, the /CONDITION qualifier tests for the 01863
zip code. The /DATA qualifier specifies that the name of town
field will be added to the output record, depending on the test
results.
4./FIELD=(NAME=FFLOAT,POS:1,SIZ:0,F_FLOATING)
/CONDITION=(NAME=CFFLOAT,TEST=(FFLOAT GE 100))
/OMIT=(CONDITION=CFFLOAT)
In this example, the number 100 is considered to be an
F_FLOATING data type because field FFLOAT is defined as
F_FLOATING in the /FIELD qualifier.
6 /DATA
Specifies the fields of a record to be directed to the output
file.
Formats
/DATA= field-name
/DATA= (IF condition-name THEN "new-contents" ELSE
"new-contents")
6.1 – Qualifier Values
field-name
Specifies the name of a field in a record. The field-name must be
defined previously in a /FIELD qualifier.
condition-name
Specifies a condition-name that has been defined previously in a
/CONDITION qualifier.
new-contents
Specifies how the record is to be altered. The new-contents can
be a constant or a field-name that has been defined in a /FIELD
qualifier.
6.2 – Full Description
A /DATA qualifier must identify every field in the records you
are directing to the output file. Specify the data fields in the
order you want them to appear in the output record. By default,
the record format for an output file is the same as that for
the input file. If you want to eliminate or reorder fields from
the output record, you can use the /DATA qualifier, causing only
those fields identified by the /DATA qualifier to be directed to
the output file.
You can conditionally change the contents of a field in the
output records by first specifying a condition name and then
setting up a test for what meets the condition in a /CONDITION
qualifier. You then specify the contents you want in the field in
a /DATA qualifier of the form:
/DATA=(IF condition-name THEN "new-contents" ELSE "new-contents")
6.3 – Examples
1./FIELD=(NAME=AGENT,POSITION:1,SIZE:5)
/FIELD=(NAME=ZIP,POSITION:6,SIZE:3)
/FIELD=(NAME=STYLE,POSITION:10,SIZE:5)
/FIELD=(NAME=CONDITION,POSITION:16,SIZE:9)
/FIELD=(NAME=PRICE,POSITION:26,SIZE:5)
/FIELD=(NAME=TAXES,POSITION:32,SIZE:5)
/DATA=PRICE
/DATA=" "
/DATA=TAXES
/DATA=" "
/DATA=STYLE
/DATA=" "
/DATA=ZIP
/DATA=" "
/DATA=AGENT
The /FIELD qualifiers define the fields in the records from an
input file that has the following format:
AGENT ZIP STYLE CONDITION PRICE TAXES
The /DATA qualifiers, which use the field-names defined in
the /FIELD qualifiers, reformat the records to create output
records of the following format:
PRICE TAXES STYLE ZIP AGENT
2./FIELD=(NAME=AGENT,POSITION:20,SIZE:15)
/CONDITION=(NAME=AGENCY,
TEST=(AGENT EQ "Real-T Trust"
OR
AGENT EQ "Realty Trust"))
/DATA=(IF AGENCY THEN "Realty Trust" ELSE AGENT)
In this example, two real estate files are being sorted. One
file refers to an agency as Real-T Trust; the other refers
to the same agency as Realty Trust. The /CONDITION and /DATA
qualifiers instruct Sort to list the AGENT field in the sorted
output file as Realty Trust.
7 /FIELD
Specification File Qualifier
Defines the input record fields to be used for a sort or merge
operation or in a conditional evaluation, or whose order or
format will change in the output record. You identify each field
by specifying a name, its position and size in the record, and
its data type.
You can also use /FIELD to define a constant and assign it a
value of any valid sort/merge data-type for use in /KEY, /DATA,
and /CONDITION statements.
Formats
/FIELD=(NAME=field-name,POSITION:n,)
SIZE:n,[DIGITS:n,]data-type
/FIELD=(NAME=field-name,VALUE:n,)
SIZE:n,[DIGITS:n,]data-type
7.1 – Qualifier Values
NAME=field-name
Specifies the name of the field. The field-name cannot have any
embedded spaces, must begin with an alphabetic character, and can
be no longer than 31 characters.
POSITION:n
Specifies the position of the field in the record.
VALUE:n
Assigns a value to a constant field for use in a /KEY, /DATA,
or /CONDITION statement. If you specify VALUE:n, do not specify
/POSITION:n, because the field is a constant and not part of an
input record.
SIZE:n
Specifies the size of a field containing character or binary
data. In the specification file, SIZE implies byte lengths. The
data type determines what values are acceptable, as well as the
units in which the size is specified:
o For character data, the size must not exceed 32,767
(characters).
o For binary data, the size specified must be 1, 2, 4, 8, or 16
(bytes).
High-performance Sort/Merge: The high-performance Sort/Merge
utility currently supports only 1, 2, 4, and 8-byte binary
keys.
o For floating-point data, no size is specified.
DIGITS:n
Specifies the size of a field containing decimal data. The size
of a field containing decimal data is specified in digits. The
size must not exceed 31 digits. Note that DIGITS:n is used only
when describing a field containing decimal data.
data-type
Specifies the data type of the field. You are not required to
specify the data-type if it is character; Sort assumes character
data type by default. The following data types are recognized by
OpenVMS Sort/Merge:
CHARACTER
BINARY[,SIGNED]
BINARY,UNSIGNED
D_FLOATING
DECIMAL,LEADING_SIGN,[OVERPUNCHED_SIGN,SIGNED]
DECIMAL,LEADING_SIGN,SEPARATE_SIGN[,SIGNED]
DECIMAL[,SIGNED,TRAILING_SIGN,OVERPUNCHED_SIGN]
DECIMAL,[TRAILING_SIGN],SEPARATE_SIGN[,SIGNED]
DECIMAL,UNSIGNED
F_FLOATING
G_FLOATING
H_FLOATING
PACKED_DECIMAL
S_FLOATING, IEEE (Alpha and I64 systems only)
T_FLOATING, IEEE (Alpha and I64 systems only)
PACKED_DECIMAL
ZONED
7.2 – Full Description
Use the /FIELD qualifier to define input record fields to be used
for a sort or merge operation or in a conditional evaluation, or
whose order or format will change in the output record.
Identify each field by specifying a name in the /FIELD qualifier,
a constant value or the field position, and the size and data
type of the field. Field names must be unique; no duplicate
field names are allowed. You cannot use more than 255 key field
definitions.
Once the field-name has been specified in the /FIELD qualifier,
it can be used in the /CONDITION, /KEY, and /DATA qualifiers.
7.3 – Example
/FIELD=(NAME=SALARY,POSITION:10,DIGITS:8,DECIMAL)
This /FIELD qualifier identifies a field in a record by the
name SALARY, specifies that it starts in position 10 of the
record, is 8 digits long, and consists of decimal data.
8 /INCLUDE
Specification File Qualifier
Specifies record selection as well as multiple record formats.
Formats
/INCLUDE=(CONDITION=condition-name)
[,KEY=...][,DATA=...]
8.1 – Qualifier Values
CONDITION=condition-name
Refers to the condition-name specified in a previous /CONDITION
qualifier.
KEY=...
Defines a key field because the default record type defined in
the /KEY qualifier is not being used.
DATA=...
Defines a data field because the default record type defined in
the /DATA qualifier is not being used.
8.2 – Full Description
You can specify that records are to be conditionally included
in an output file. After defining a condition in a /CONDITION
qualifier, specify record selection in an /INCLUDE qualifier
requesting that records satisfying the condition are to be
included in the output file.
You can specify multiple /INCLUDE and /OMIT qualifiers in
a specification file. The order in which you specify them
determines the order the input records are tested for inclusion.
After the last /INCLUDE qualifier, all records that have not
already been included or explicitly omitted are omitted.
You can unconditionally include any records not previously
omitted or included by specifying /INCLUDE without a condition.
When sorting multiple record formats, one /INCLUDE qualifier
should be specified for each different record format among the
records to be sorted. If you do not specify a KEY option within
the INCLUDE qualifier, Sort assumes the default key definitions.
If the KEY is specified in the /INCLUDE qualifier, the default
key definitions are not used. The order of the KEY fields in the
/INCLUDE qualifier determines how the internal key is built for
sorting. The order of the DATA fields in the /INCLUDE qualifier
determines the way the output record is formatted. If you specify
a key or data field in an /INCLUDE qualifier, you must define all
other key or data fields in the record.
8.3 – Example
/FIELD=(NAME=ZIP,POSITION:20,SIZE:6)
/CONDITION=(NAME=LOCATION,
TEST=(ZIP EQ "01863"))
/INCLUDE=(CONDITION=LOCATION)
These /CONDITION and /INCLUDE qualifiers specify that records
with the zip code 01863 will be included in the output file.
9 /KEY
Specification File Qualifier
Identifies key field names, specifies sorting order, and changes
the order of records in the output file.
Formats
/KEY=field-name
/KEY=(field-name,order)
/KEY=([IF condition-name THEN value ELSE]...value [,order])
9.1 – Qualifier Values
field-name
Specifies the name of the key field. The field-name has been
previously specified in a /FIELD qualifier.
order
Specifies the order of the sort. The ASCENDING option specifies
ascending order for a sort or merge operation. This option is the
default. The DESCENDING option specifies descending order for a
sort or merge operation.
value
Specifies the key. The value can be a constant or a field-name
that has been defined in a /FIELD qualifier.
9.2 – Full Description
If you are sorting on the entire record using character data, you
do not need to specify your key field. Otherwise, specify a /KEY
qualifier for each of the keys, in the order of their priority.
You can sort on as many as 255 key fields.
There are three ways to use the /KEY qualifier:
o To identify the key field name.
o To identify the key field name and to specify sorting order.
In this case, enclose the field name and the order option in
parentheses.
o As a conditional qualifier, to change the order of records
in the output file. First, specify a condition name in a
/CONDITION qualifier, and set up a test for what meets
that condition. Then, specify the relative order in a /KEY
qualifier of the form:
/KEY=(IF condition-name THEN value ELSE value)
You can use any values to specify the relative order of the
records.
9.3 – Examples
1./FIELD=(NAME=SALARY,POSITION:10,DIGITS:8,DECIMAL)
/KEY=(SALARY,DESCENDING)
This /KEY qualifier specifies that the key field is SALARY and
that the sorting order is descending.
2./FIELD=(NAME=ZIP,POSITION:20,SIZE:6)
/CONDITION=(NAME=LOCATION,
TEST=(ZIP EQ "01863"))
/KEY=(IF LOCATION THEN 1
ELSE 2)
In this example, all the records with the zip code 01863 are
to appear at the beginning of the sorted output file. The
conditional test LOCATION (defined in a /CONDITION qualifier)
is on the ZIP field (named in a /FIELD clause). The values of
1 and 2 in this /KEY clause signify a relative order for those
records that satisfy the condition and those that do not.
10 /OMIT
Specifies that records are to be omitted from the output file
based on a condition defined with a /CONDITION qualifier.
Format
/OMIT=(CONDITION=condition-name)
10.1 – Qualifier Value
CONDITION=condition-name
Refers to the condition-name previously specified in a /CONDITION
qualifier.
10.2 – Full Description
You can specify that records are to be omitted from the output
file by using the /OMIT qualifier. First, you must define a
condition with the /CONDITION qualifier. Specify your record
selection with an /OMIT qualifier requesting the records
satisfying that condition be selected for omission from your
sort. By default, Sort/Merge includes all the other input records
in the output file.
You can specify multiple /OMIT and /INCLUDE qualifiers in your
specification file. The order you specify them determines the
order the input records are tested for omission. All the records
that have not already been included or omitted after the last
/OMIT qualifier are included. You can unconditionally omit any
records not previously omitted or included by specifying the
/OMIT qualifier only.
10.3 – Example
/FIELD=(NAME=ZIP,POSITION:20,SIZE:6)
/CONDITION=(NAME=LOCATION,
TEST=(ZIP EQ "01863"))
/OMIT=(CONDITION=LOCATION)
These /CONDITION and /OMIT qualifiers specify that records with
the zip code 01863 are to be omitted from your output file.
11 /PAD
Allows you to specify a pad character to use when reformatting
records or when comparing strings of unequal length.
Format
/PAD=single-character
11.1 – Qualifier Value
single-character
Specifies the character that the Sort utiltiy will use to pad a
string. Characters, decimal, octal, or hexadecimal digits can be
used. The pad character should be specified as follows:
o Use quotation marks for a character. For example, " # " would
specify the number sign.
o Use decimal radix for decimal digits. For example, %D35 would
specify the decimal number 35.
o Use octal radix for octal digits. For example, %O043 would
specify the octal number 043.
o Use hexadecimal radix for hexadecimal digits. For example,
%X23 would specify the hexadecimal number 23.
11.2 – Full Description
Use the /PAD qualifier to specify a pad character when comparing
strings of unequal length or when reformatting records. By
default, Sort uses the null character for padding, ensuring
conformity with the previous versions. Double characters that
can be defined as single characters ("ch" > "c") cannot be used
as pad characters.
11.3 – Example
/PAD="."
This example of a /PAD qualifier specifies that records will be
padded with periods.
12 /PROCESS
Defines the processing method (record, tag, address, or index)
for the sorting operation. Use only with the SORT command.
Format
/PROCESS=type
12.1 – Qualifier Values
RECORD
Specifies the record sort. This sort process is the default.
TAG
Specifies the tag sort.
ADDRESS
Specifies the address sort.
INDEX
Specifies the index sort.
12.2 – Full Description
By default, Sort uses a record sorting process. You can also
specify a tag, address, or index sorting process. If you intend
to reformat the output records, you cannot use address or index
sort. For a comparison of the four processes, see the description
of /PROCESS in the Command Qualifiers Section. Use the /PROCESS
qualifier with the SORT command only.
12.3 – Example
/PROCESS=tag
This example of the /PROCESS qualifier specifies that Sort use
a tag sorting process.
13 /STABLE
Specifies that records with equal keys are directed to the
output file in their input file order. The default condition
is /NOSTABLE.
Formats
/STABLE
/NOSTABLE
13.1 – Full Description
By default, when records are sorted with identical keys, the
order of those records in the output file may not be the same as
they appeared in the input file. Specifying the /STABLE qualifier
in a specification file arranges records with equal keys in the
output file in the order of the input files as specified in the
command line. If you use this qualifier when sorting multiple
input files, on output, records with equal keys in the first file
will precede those from the second file and so on.
13.2 – Example
/STABLE
This example of the /STABLE qualifier ensures that records with
equal keys will have the same order in the input and output
files.
14 /WORK_FILES
Reassigns work files to different disk-structured devices to
improve performance. Use only with the SORT command.
Format
/WORK_FILES=(device[,...])
14.1 – Qualifier Value
device
Specifies a logical name for the work file. Unlike the DCL
qualifier /WORK_FILES=n, the specification file qualifier /WORK_
FILES=(device[,...]) specifies work file assignments, not the
number of work files.
14.2 – Full Description
You can improve the performance of Sort by placing work files
on different disk-structured devices. Using the /WORK_FILES
qualifier in a specification file to reassign work files makes
it unnecessary to make logical assignments prior to invoking Sort
at the command or program level.
14.3 – Example
/WORK_FILES=("WRKD$:")
This example of a /WORK_FILES qualifier assigns one of Sort's
work files to the device WRKD$: because that device has the
most space available.