HELP MERGE — VMS 5.0
Invokes the VAX Sort Utility to combine two through ten similarly
sorted input files and create a single output file. Note that input
files to be merged must be in sorted order. For a complete
functional description of the Sort Utility, including more
information about MERGE command and its qualifiers, see the VMS
Sort/Merge Utility Manual.
Format:
MERGE input-file-spec1,input-file-spec2[,...] output-file-spec
Additional information available:
ParametersCommand QualifiersCommand QualifiersOutput File Qualifiers
Examples
Parameters
input-file-spec1,input-file-spec2[,...] Specifies the names of the sorted files whose records are to be merged. At least one file specification, but not more than ten, must be specified and separated by commas. The keys must be the same in all files. output-file-spec Specifies the name of the merged file to be created. Only one output file specification may be specified. No wildcard characters are allowed in the file specification.
Command Qualifiers
Additional information available:
/CHECK_SEQUENCE/COLLATING_SEQUENCE/DUPLICATES
/KEY/SPECIFICATION/STABLE/STATISTICS
/CHECK_SEQUENCE
/CHECK_SEQUENCE
/NOCHECK_SEQUENCE
Examines the input files to be merged to ensure they are in order.
If a record is out of order, MERGE gives the following message at
the end of the merge operation:
%SOR-E-BAD_ORDER, Input file [n] is out of order.
/COLLATING_SEQUENCE
/COLLATING_SEQUENCE=sequence Determines which collating sequence---ASCII, EBCDIC, or MULTINATIONAL---is used when merging records. MERGE arranges characters in ASCII sequence by default. If the EBCDIC option is selected, the input files are merged as if the EBCDIC key characters were translated into ASCII key characters and then merged as an ASCII key. The records do not change. If the MULTINATIONAL option is selected, the input files are merged according to the MULTINATIONAL sequence, which is a collating sequence containing international characters.
/DUPLICATES
/DUPLICATES /NODUPLICATES By default, MERGE retains records with equal keys. The /NODUPLICATES qualifier eliminates all but one of a record with equal keys. Because the record retained is unpredictable, you must specify which duplicate record to keep by invoking MERGE at the program level and specifying an equal key routine. The /STABLE and the /NODUPLICATES qualifiers are mutually exclusive.
/KEY
/KEY=(field[,...])
Defines a merge key, including position, size, order, and data type.
If the key field starts in the first position, encompasses the
entire record, has been sorted in ascending order, and contains
character data, the /KEY qualifier need not be specified.
The key field is defined by keywords that must be separated with
commas and enclosed in parentheses.
Required Keywords
POSITION:n Specifies the position of the key within each
record, where the first character of each record
is position 1.
SIZE:n Specifies the length of the merge key in
characters, bytes, or digits, depending on the
key field data type. The valid sizes, based on
data types, are:
Data Type Values for n
character 1 through 32767 bytes
binary 1, 2, 4, 8, 16 bytes
any decimal data type 1 through 31 digits
The total of all key field sizes must be less
than 32,767 bytes.
Optional Keywords
NUMBER:n Specifies the precedence of the merge key being
defined, where 1 represents the primary merge
key, 2 represents the secondary merge key, and
so on.
If this keyword is not specified in the first
/KEY qualifier, NUMBER:1 is assumed; if it is
not specified in any subsequent /KEY qualifiers,
the default value is the number assigned to the
previous key, plus 1.
The legal values are 1 through 255.
BINARY Indicates that binary data appears in the merge
key field. If no data type is specified, MERGE
assumes that the data type is CHARACTER.
CHARACTER Indicates that character data appears in the
merge key field. If no data type is specified,
MERGE assumes that the data type is CHARACTER.
DECIMAL Indicates that decimal data appears in the merge
key field. If no data type is specified, MERGE
assumes that the data type is CHARACTER.
D_FLOATING Indicates that d_floating data appears in the
merge key field. If no data type is specified,
MERGE assumes that the data type is CHARACTER.
F_FLOATING Indicates that f_floating data appears in the
merge key field. If no data type is specified,
MERGE assumes that the data type is CHARACTER.
G_FLOATING Indicates that g_floating data appears in the
merge key field. If no data type is specified,
MERGE assumes that the data type is CHARACTER.
H_FLOATING Indicates that h_floating data appears in the
merge key field. If no data type is specified,
MERGE assumes that the data type is CHARACTER.
PACKED_DECIMAL Indicates that packed decimal data appears in
the merge key field. If no data type is
specified, MERGE assumes that the data type is
CHARACTER.
ZONED Indicates that zoned data appears in the merge
key field. If no data type is specified, MERGE
assumes that the data type is CHARACTER.
SIGNED Indicates whether the key data type is signed
binary data.
UNSIGNED Indicates whether the key data type is unsigned
binary data.
LEADING_SIGN Indicates that the sign of a decimal data type
key appears at the beginning of the key. If the
key data type is specified as DECIMAL and if
neither LEADING_SIGN nor TRAILING_SIGN is
specified, the default is TRAILING_SIGN.
TRAILING_SIGN Indicates that the sign of a decimal data type
key appears at the end of the key. If the key
data type is specified as DECIMAL and if neither
LEADING_SIGN nor TRAILING_SIGN is specified, the
default is TRAILING_SIGN.
OVERPUNCHED_SIGN Indicates whether the sign of a decimal data
type key is superimposed on the decimal value.
If the key data type is specified as DECIMAL and
if neither of OVERPUNCHED_SIGN nor SEPARATE_SIGN
is specified, the default is OVERPUNCHED_SIGN.
SEPARATE_SIGN Indicates whether the sign of a decimal data
type key is separate from the decimal value .
If the key data type is specified as DECIMAL and
if neither of OVERPUNCHED_SIGN nor SEPARATE_SIGN
is specified, the default is OVERPUNCHED_SIGN.
ASCENDING Indicates that the key is to be merged into
ascending order. The default is ASCENDING.
DESCENDING Indicates that the key is to be merged into
descending order. The default is ASCENDING.
/SPECIFICATION
/SPECIFICATION[=file-spec] Indicates that the command qualifiers, including key field definitions, are contained in a specification file. If no file specification is included, MERGE reads the specification file from SYS$INPUT. The format and contents of the specification file are described in detail in the VMS Sort/Merge Utility Manual. No wildcard characters are allowed in the file specification.
/STABLE
/STABLE /NOSTABLE Specifies the order in which MERGE places records with equal keys. The order is determined by the order of the file specifications on the command line. If the command is MERGE/STABLE X,Y and if a record from X.DAT and a record from Y.DAT have equal keys, the record from X.DAT will be written to the output file before the record from Y.DAT. If /STABLE is not specified, the order of records with equal keys is unpredictable.
/STATISTICS
/STATISTICS /NOSTATISTICS Specifies that a statistical summary is to be displayed after the MERGE operation has completed. By default, no statistical summary is displayed.
Command Qualifiers
Additional information available:
/FORMAT
/FORMAT=(file-attribute[,...])
Specifies attributes of the input file to override the existing data
that MERGE normally obtains through VAX RMS. One or both of the
following keywords can be specified.
RECORD_SIZE:n Specifies, in bytes, the length of the longest
record, overriding the record size defined in
the file header or label. Specifies a record
size for an input file when the input file is
not on disk or if the longest record size is
known to be inaccurate.
The longest record length that can be specified
is 32,767 bytes for sequential files, 16,383
bytes for relative files, and 16,362 bytes for
indexed-sequential files.
FILE_SIZE:n Defines the size of the file in blocks. Specify
a file size for a file that is not on disk. If
no file size is specified for an input file,
MERGE uses the default value of 1000 blocks.
The maximum file size that can be specified is
4,294,967,295 blocks.
Output File Qualifiers
Additional information available:
/ALLOCATION/BUCKET_SIZE/CONTIGUOUS/FORMAT
/INDEXED_SEQUENTIAL/OVERLAY/RELATIVE/SEQUENTIAL
/ALLOCATION
/ALLOCATION=n Specifies the number of 512-byte blocks to be allocated for the output file. By default, MERGE allocates blocks based on the number of records sorted. The number of blocks specified can range from 1 through 4,294,967,295.
/BUCKET_SIZE
/BUCKET_SIZE=n Specifies the number of 512-byte blocks per bucket for the output file. The maximum size that can be specified is 32 blocks. If you do not specify a bucket size, the bucket size of the output file is the same as that of the first input file.
/CONTIGUOUS
/CONTIGUOUS Controls whether the allocation of disk space for the output file is to be contiguous. If you specify /CONTIGUOUS, you must also specify /ALLOCATION to define the number of blocks to allocate for the output file. By default, MERGE output is not contiguous.
/FORMAT
/FORMAT=(record-format[,...])
Defines the output file record format. You can specify one or more
of the following keyword options:
CONTROLLED[:n] Defines the output file record format and
length, where n is the length of the longest
record in the output file. If n is not
specified, it defaults to the length of the
longest record in the input file.
FIXED[:n] Defines the output file record format and
length, where n is the length of the longest
record in the output file. If n is not
specified, it defaults to the length of the
longest record in the input file.
VARIABLE[:n] Defines the output file record format and
length, where n is the length of the longest
record in the output file. If n is not
specified, it defaults to the length of the
longest record in the input file.
The maximum record size that can be specified is 16,383 bytes (less
any control bytes).
SIZE:n Specifies the size in bytes of the fixed portion
of the controlled record when CONTROLLED is
specified. The maximum size of the fixed length
control field that can be specified is 255
bytes. If CONTROLLED is specified and no size
is specified, MERGE uses the default value of 2
bytes.
BLOCK_SIZE:n Specifies the block size in bytes when the
output file is directed to a magnetic tape. By
default, MERGE uses the block size of the input
file if the input file is a tape file. If the
input file is not a tape file, MERGE uses, by
default, the block size specified when the
output tape volume was mounted.
You can specify a block size in the range of 20
through 65,535. Note, however, that to ensure
compatible interchange with most non-DIGITAL
systems, the block size should be less than 2048
bytes.
If you do not specify /FORMAT to define the record format of the
output file, MERGE assumes a default output format based on the
process selected.
/INDEXED_SEQUENTIAL
/INDEXED_SEQUENTIAL Specifies that the output file is in indexed sequential organization. If you specify /INDEXED_SEQUENTIAL, the output file must exist, its organization must be indexed, and it must be empty. Therefore, you must also specify /OVERLAY to overlay the existing file. By default, a record or tag sort creates an output file that has the same organization as the input file. Specify INDEXED_SEQUENTIAL to create an indexed sequential output file from a sequential relative input file.
/OVERLAY
/OVERLAY Indicates that the existing file is to be overlaid with the sorted records of the input file. By default, a new output file is created and does not overlay an existing file.
/RELATIVE
/RELATIVE Specifies that the output file is in relative file organization. By default, a record or tag sort results in an output file that has the same organization as the input file. Use the /RELATIVE qualifier to create a relative output file from a sequential or indexed sequential input file.
/SEQUENTIAL
/SEQUENTIAL Specifies that the format of the output file has sequential organization. This is the default for an address or index sort process; for a record or tag sort process, the output file format defaults to the organization of the first input file. Specify /SEQUENTIAL to create an output file whose format differs from the input file format.
Examples
1. $ MERGE/KEY=(PO:1,SI:30) TRNTO:[PGM]FILE1.SRT,FILE2.SRT -
_$ MERGEFILE.DAT
This MERGE command merges two input files on the directory [PGM] at
the remote node TRNTO into the output file, MERGEFILE.DAT, at the
local node.