FCOPY Reference Manual (32212-90008)
Chapter 3 47
FCOPY Applications and Examples
Copying KSAM Files
For example,
>FROM=OLDKSXL;TO=(NEWKSAM,NEWKSAMKEY)
FCOPY estimates the size of the
keyfile
if you use the NEW option.
Copying from CM KSAM Files to KSAM XL Files
You can copy a CM KSAM file to a KSAM XL file on an MPE XL system using the FROM and
TO parameters as described under "Copying to Existing KSAM Files" above, with these
stipulations:
• The tofile must be specified as an existing KSAM XL file, unless you are creating a new
file. If the tofile is a new file, you must specify it as (
targetfile
). You can
backreference the
targetfile
to a KSAM XL file using a file equation.
• The fromfile must be an existing CM KSAM file.
For example,
> FROM=FILECM;TO=(FILENM)
If you open the CM KSAM file with the NOKSAM option, the deleted data records of the CM
KSAM file as well as its active data records are included as active data records in the
KSAM XL tofile (
targetfile
).
If you open the CM KSAM file with the KEY=0 option (see "Copying Key Sequences" below),
the KSAM XL tofile contains only the active data records of the CM KSAM file.
Copying Key Sequences
To copy records from a KSAM file in a particular key sequence, use the KEY function. This
option is valid for all types of KSAM files. The KEY function lets you specify the starting
character position for the key you want to use to copy the file. You can copy the file in
primary key sequence, any alternate key sequence, or physical record sequence. For
example, the FCOPY command below instructs FCOPY to copy the KSAM V/E file KSAM1 to
the KSAM V/E file KSAM2 in the sequence determined by the key beginning in position 21
of the data records of KSAM1:
>FROM=KSAM1;TO=KSAM2;KEY=21
To copy a KSAM file in physical record order, specify zero as the character location. For
example, the command below copies the file KSAM3 to the file KSAM4 in the same physical
record order:
>FROM=KSAM3;TO=KSAM4;KEY=0
To copy a file in primary key sequence (the default), omit the KEY function from your FCOPY
command. The command below copies KSAM5 to KSAM6 in primary key order:
>FROM=KSAM5;TO=KSAM6