fdcp

Date:

10-20-2011

NAME

fdcp - Copies data while preserving record blocking

SYNOPSIS

fdcp [-a] [-c] [-F nfiles] [-f nmax] [-R n] [-r nmax]
[-s] [-v] input output

IMPLEMENTATION

Cray Linux Environment (CLE)

DESCRIPTION

The fdcp utility copies data and record structure from input to output. It is typically used to manipulate files that have record blocking and/or multifile structure. The blocking structure of the file can be declared using the assign(1) command.

fdcp handles both byte stream and nonbyte stream files.

If the structure of a file has not been declared using assign, it is assumed to be a simple byte stream and is handled accordingly. This produces the same data in the copied file as if the cp(1) had been used.

When a file structure is declared by using the assign -F command, fdcp translates as much of the file structure of the input file(s) in the output file(s) as the declared file structure allows.

Transformation is not performed on the data. For example, ASCII to EBCDIC conversion is not performed.

Options

The fdcp utility accepts the following options:

-a

Data is appended to output. output must be a single file name.

-c

Concatenate output. Omit all end-of-file (EOF) records in the output file. If the output file is a format which requires a termination EOF record, then allow this one EOF record at the end.

-Fnfiles

Number of files (EOFs) to skip before starting the copy operation.

-f nmax

Maximum number of files to copy once copying has started. If -r is not specified, the default value for nmax is everything up to end-of-data (EOD). If -r is specified, the default value for nmax is 1.

-R n

Number of records to skip before starting the copy operation.

-r nmax

Maximum number of records to copy after copying has started

-s

Summary output. This option is similar to the -v option but produces less output.

-v

Verbose output. This reports details of activity for records copied and skipped. An example of this output is shown below:

$ fdcp -v file1 file2
r=    1, l= 5 bytes     (copied)
r=    2, l= 8 bytes     (copied)
r=    3, l= 2 bytes     (copied)
r=    4, l= 7 bytes     (copied)
r=    5, l= 17 bytes    (copied)
r=    6, l= 23 bytes    (copied)
r=    7, l= 2 bytes     (copied)
EOD encountered
0 records, 0 files skipped
7 records, 0 files copied
input output

input and output are lists of one or more file names, but input and output cannot both be lists. The files in the list can be either whitespace or comma separated. If whitespace is used as a delimiter, the list must be quoted.

  • Typically, input and output consist of one file name denoting the input and output files for a simple copy operation, which copies the logical structure of file input to file output.

  • If output is a list of file names, fdcp splits input into its multifile parts, writing each portion of input up to an EOF to each file in the output list.

  • If input is a list of file names, fdcp combines the listed files into one output file. An EOF record is added between each input file if the last record of the file was not an EOF record.

The -F option is honored before the -f, -R, or -r options. The -R option is honored after the -F option but before the -f or -r options. The -f or -r options act as absolute limits on the amount of data to be transferred

Exit Status

Returns 0 on success and 1 on failure. This command fails if parameters are inconsistent or if essential blocking structures cannot be reproduced faithfully. It is assumed that a request failed if a copy is requested, and the skip count forces no copy to be performed.

EXAMPLES

The following examples show various ways to use the fdcp command.

Example 1:

The simplest use of fdcp is to copy a file. This example assumes that the files have not been declared with assign. The following command line produces an output file file2 that is a bit-identical copy of input file file1.

$ fdcp file1 file2

Example 2:

In some cases it is necessary to convert the Fortran (f77) blocking on the Cray system to that of another machine before transferring the data to that machine. This example shows how to reblock a Fortran unformatted data file in f77 file format for writing to a COS-blocked file for transfer to another system. It is assumed that any conversion on the data in the records has already been performed through use of the assign -N command. fdcp does not convert data.

$ assign -F f77 sourcefile
$ assign -F cos targetfile
$ fdcp sourcefile targetfile

Example 3:

If only a subset of files is needed, the -F and -f options can be used as shown in this example, where the third and fourth sub-files are copied from the file myfile and put in files c and d.

$ fdcp -F 2 -f 2 myfile c,d

Example 4:

If input is a list of file names and output is a single file, fdcp performs the inverse of the previous example. To put five files into a single multifile COS-blocked dataset, execute the following command, which writes five files to a dataset with an EOF separating each file from the next.

$ assign -F cos myfile
$ fdcp a,b,c,d,e myfile

The above fdcp command line illustrates a comma-separated list. It could also be entered as a quoted, whitespace-separated list, as shown below:

$ fdcp "a b c d e" myfile

Example 5:

The -a option lets you append data to a file. For example, to put files a, b, and c into a single COS-blocked file, then append files d and e onto the end of the file, execute the following commands:

$ assign -F cos myfile
$ fdcp a,b,c myfile
$ fdcp -a d,e myfile

Example 6:

The method shown in the previous example also works for individual files. Executing the following commands will produce a COS-blocked dataset containing five files:

$ assign -F cos myfile
$ fdcp a myfile
$ fdcp -a b myfile
$ fdcp -a c myfile
$ fdcp -a d myfile
$ fdcp -a e myfile

This example can be simplified to the following command lines:

$ assign -F cos myfile
$ fdcp a,b,c,d,e myfile

SEE ALSO

assign(1), cp(1)