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 4 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 4 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. 4 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. 3 /INCLUDE Specification File Qualifier Specifies record selection as well as multiple record formats. Formats /INCLUDE=(CONDITION=condition-name) [,KEY=...][,DATA=...] 4 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. 4 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. 4 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. 3 /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]) 4 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. 4 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. 4 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. 3 /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) 4 Qualifier_Value CONDITION=condition-name Refers to the condition-name previously specified in a /CONDITION qualifier. 4 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. 4 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. 3 /PAD Allows you to specify a pad character to use when reformatting records or when comparing strings of unequal length. Format /PAD=single-character 4 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. 4 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. 4 Example /PAD="." This example of a /PAD qualifier specifies that records will be padded with periods. 3 /PROCESS Defines the processing method (record, tag, address, or index) for the sorting operation. Use only with the SORT command. Format /PROCESS=type 4 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. 4 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. 4 Example /PROCESS=tag This example of the /PROCESS qualifier specifies that Sort use a tag sorting process. 3 /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 4 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. 4 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. 3 /WORK_FILES Reassigns work files to different disk-structured devices to improve performance. Use only with the SORT command. Format /WORK_FILES=(device[,...]) 4 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. 4 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. 4 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.