SUBSET [ FCOPY Reference Manual ] MPE/iX 5.0 Documentation
FCOPY Reference Manual
SUBSET
Lets you copy only a specific portion, or subset, of a file. You can
define the subset in one of two ways, either as all records with a
certain character string or numeric pattern beginning in a specific
column, or as a set or sets of continuous records.
Syntax
[= "characterstring"[,column] [,EXCLUDE]]
;SUBSET[= #patternlist #[,column] [,EXCLUDE] ]
[= (range[;range] [;...]) ]
Where:
characterstring Is a string of ASCII characters.
patternlist Is a string of decimal and/or octal integers, each
representing the bit pattern of one byte.
column Is an integer specifying at which character position
within each record the particular characterstring or
patternlist is expected to begin. If omitted, FCOPY
assumes the default value, which is 1 (first
character position).
EXCLUDE Specifies that the designated subset is to be
excluded from the FCOPY operation, that is, all of
the file except for the subset is to be copied.
range Can be in one of two forms: either
[starting-record-number] [,number-of-records] or
[starting-record-number] [:last-record-number]
starting-record- Is an integer record number specifying the start of
number the subset. If omitted, the default value 0 (first
record) is assumed.
number-of-records Is an integer specifying the number of the records
in the subset. If omitted, it is assumed that the
subset consists of all records through the end of
the file.
last-record-number Is an integer representing the number of the last
record in the subset. If omitted, the last record
in the file is assumed.
Operation
You can define the subset in one of two ways, either as all records that
have a certain character string or numeric pattern beginning in a
specific column, or as a continuous set of records.
Defining Subsets from Character Strings and Pattern Lists
A character string describes a set of characters. Quotation marks
delimit a character string. A character string can contain no more than
35 characters within the quotes, and it may not be continued from one
line or record to the next. If you need to match quotation marks within
the string, use two successive quotation marks, as each pair counts as
one character.
A pattern list is a set of octal or decimal numbers, each representing
one byte. A pattern list is delimited by number signs (#), and can
contain no more than 35 integers. You can continue a pattern list from
one line or record to the next, but you cannot specify the continuation
between elements of an individual pattern. Each decimal integer must be
within the range 0 through 255, and each octal integer must be within the
range 0 through 377.
If the specified character string or pattern list does not exist entirely
within a particular record in the fromfile, the record is not considered
to be part of the defined subset.
Defining Subsets from Record Ranges
You can use record ranges to specify up to 255 subsets. FCOPY
sequentially copies the subsets in the order you list them. They must be
in numerical order, and they may not overlap.
Using the SUBSET Function Alone
You can use SUBSET alone to copy a disk file to a duplicate that uses
less disk space. If you use SUBSET to copy data from a disk file that
does not fill the space allocated to it to a new disk file, the resulting
tofile is only as large as the actual contents of the fromfile. FCOPY
does not copy the unused space. For example, the command below only
copies 20 records from TEST1:
>FROM=TEST1;TO=TEST2;NEW;SUBSET
EOF FOUND IN FROMFILE AFTER RECORD 19
20 RECORDS PROCESSED * * * 0 ERRORS
If you exit FCOPY and return to MPE, you can observe the effect of the
FCOPY command by using LISTF to list the characteristics of the two files
and compare them. For example:
LISTF TEST@,2
ACCOUNT= SUBSYS GROUP= EDITOR
FILENAME CODE--------------LOGICAL RECORD----------SPACE----
SIZE TYPE EOF LIMIT R/B SECTORS #X MX
TEST1 80B FA 20 1023 1 128 1 8
TEST2 80B FA 20 20 1 21 7 7
Copying User Labels Only
Use SUBSET=0,0 to copy just the user labels from a disk file. For
example, the following command copies the user labels from the disk file
LABELD to the labeled magnetic tape *TAPE.
>FROM=LABELD;TO=*TAPE;SUBSET=0,0
Magnetic Tape Subsets
FCOPY selects magnetic tape subsets by logical record number. If you
need to use physical block subsets, you can temporarily define a logical
record length equal to the physical record length. A subset may not
extend over an EOF mark or a tape mark boundary on magnetic tape.
Using SUBSET with DEBLOCK
If you use SUBSET with DEBLOCK, FCOPY copies subsets from the deblocked
records.
Examples
The example below copies all records in the disk file AUTOS that contain
the character string "BLUE" starting in character position 17, to the
disk file COMPANY:
>FROM=AUTOS;TO=COMPANY;SUBSET="BLUE",17
The following example copies all records in the file AUTOS that do not
contain the character string "BLUE" in position 17, to the disk file
RENTAL:
>FROM=AUTOS;TO=RENTAL;SUBSET="BLUE",17,EXCLUDE
You can also use the SUBSET function to specify lowercase alphabetic
characters from a terminal that has only uppercase characters. For
example, the command below copies all records in the disk file DATA that
contain the lowercase alphabetic characters "data" (octal codes 144, 141,
164, and 141) in character positions 77 through 80 to the disk file
SUBFILE3:
>FROM=DATA;TO=SUBFILE3;SUBSET=#%144,%141,%164,%141#,77
You might use decimal codes to specify subsets containing nonprinting
characters. For example, the command below copies all records in the
disk file DATA1 that contain the nonprinting control characters CR and LF
(decimal codes 13 and 10) in character positions 71 and 72 to the disk
file SUB1:
>FROM=DATA1;TO=SUB1;SUBSET=#13,10#,71
The example below copies 500 records, beginning with record 0 (the
first), from the disk file MAIN to the disk file SUB1:
>FROM=MAIN;TO=SUB1;SUBSET=,500
The next example copies records 500 through 1499 of the disk file MAIN
into the disk file SUB2:
>FROM=MAIN;TO=SUB2;SUBSET=500:1499
The following example copies all records from 1500 through the end of the
file from the disk file MAIN to the disk file SUB3:
>FROM=MAIN;TO=SUB3;SUBSET=1500
You can copy several ranges of records as long as the ranges are
sequentially ordered and do not overlap. For example, the command below
copies records 0 through 11 and 30 through 74 from TAPEA to FILEONE:
>FROM=*TAPEA;TO=FILEONE; SUBSET=(0,12;30,45)
MPE/iX 5.0 Documentation