dd(1) MPE/iX Shell and Utilities dd(1)
______________________________________________________________________
NAME
dd -- copy and convert input blocks
SYNOPSIS
dd [bs=s] [cbs=s] [conv=conversion] [count=n] [ibs=s] [if=file]
[imsg=string] [iseek=n] [obs=s] [of=file] [omsg=string] [seek=n]
[skip=n]
DESCRIPTION
Note: The MPE/iX implementation of this utility does not function
exactly as this man page describes. For details, see the MPE/iX
NOTES section at the end of this man page.
dd reads and writes data by blocks. It is frequently used for
devices such as tapes which have discrete block sizes, or for
fast multi-sector reads from disks. dd performs conversions to
accommodate computers that require de-blocking, conversion
to/from EBCDIC, and fixed length records.
dd processes the input data as follows:
1. dd reads an input block.
2. If this input block is smaller than the specified input
block size, dd pads it to the specified size with null
bytes. When you also specify a block or unblock conversion,
dd uses spaces instead of null bytes.
3. If you specified bs=size and requested no conversion other
than sync or noerror, dd writes the padded (if necessary)
input block to the output as a single block and omits the
remaining steps.
4. If you specified the swab conversion, dd swaps each pair of
input bytes. If there is an odd number of input bytes, dd
does not attempt to swap the last byte.
5. dd performs all remaining conversions on the input data
independently of the input block boundaries. A fixed-length
input or output record may span these boundaries.
6. dd gathers the converted data into output blocks of the
specified size. When dd reaches the end of the input, it
writes the remaining output as a block (without padding if
conv=sync is not specified). As a result, the final output
block may be shorter than the output block size.
bs=size
sets both input and output block sizes to size bytes. You
can suffix this decimal number with w, b, k, or xnumber, to
multiply it by 2, 512, 1024, or number respectively. You
can also specify size as two decimal numbers (with or
1
dd(1) MPE/iX Shell and Utilities dd(1)
______________________________________________________________________
without suffixes) separated by x to indicate the product of
the two values. Processing is faster when ibs and obs are
equal, since this avoids buffer copying. The default block
size is 1b. bs=size supercedes any settings of ibs=size or
obs=size.
If you specify bs=size and you request no other conversions
than noerror, notrunc, or sync, dd writes the data from each
input block as a separate output block; if the input data is
less than a full block and you did not request sync conver-
sion, the output block is the same size as the input block.
cbs=size
sets the size of the conversion buffer used by various conv
options.
conv=conversion[, conversion, ...]
where conversion can be any of the following:
ascii converts EBCDIC input to ASCII for output. dd
copies cbs bytes at a time to the conversion buf-
fer, maps them to ASCII; then strips trailing
blanks, adds a newline, and copies this line to
the output buffer.
block converts variable-length records to fixed-length
records. dd treats the input data as a sequence of
variable-length records (each terminated by a new-
line or an EOF character) independent of the block
boundaries. dd converts each input record by
first removing any newline characters, then pad-
ding (with spaces) or truncating the record to the
size of the conversion buffer. dd reports the
number of truncated records on the standard error.
You must specify cbs=size with this conversion.
ebcdic converts ASCII input to EBCDIC for output. dd
copies a line of ASCII to the conversion buffer,
discards the newline, pads it with trailing blanks
to cbs bytes, maps it to EBCDIC and copies it to
the output buffer.
ibm converts ASCII to a variant of EBCDIC which gives
better output on many IBM printers.
lcase converts uppercase input to lowercase.
noerror ignores errors on input.
notrunc does not truncate the output file. dd preserves
blocks in the output file to which it does not
write explicitly write.
2
dd(1) MPE/iX Shell and Utilities dd(1)
______________________________________________________________________
swab swaps the order of every pair of input bytes. If
the current input record has an odd number of
bytes, this conversion does not attempt to swap
the last byte of the record.
sync pads any input block shorter than ibs to that size
with null bytes before conversion and output. If
you also specified block or unblock, dd uses
spaces instead of null bytes for padding.
ucase converts lowercase input to uppercase.
unblock converts fixed-length records to variable-length
records by reading a number of bytes equal to the
size of the conversion buffer, deleting all trail-
ing spaces, and appending a newline character.
You must specify cbs=size with this conversion.
convfile uses convfile as a translation table if it is not
one of the conversion formats listed here and it
is the name of a file of exactly 256 bytes.
You may perform multiple conversions at the same time by
separating arguments to conv with commas; however, some con-
versions are mutually exclusive (for example, ucase and
lcase).
count=n
copies only n input blocks to the output.
ibs=size
sets the input block size to size bytes. You specify it in
the same way as bs.
if=file
reads input data from file. If you don't specify this
option, dd reads data from the standard input.
imsg=string
displays string when all data has been read from the current
volume, replacing all occurrences of %d in string with the
number of the next volume to be read. dd then reads and
discards a line from the controlling terminal, giving you a
chance to change volumes (usually diskettes).
iseek=n
seeks to the nth block of the input file. The distinction
between this and skip is that iseek does not read the dis-
carded data; however there are some devices, such as tape
drives and communication lines, on which seeking is not pos-
sible, so only skip is appropriate.
3
dd(1) MPE/iX Shell and Utilities dd(1)
______________________________________________________________________
obs=size
sets the output block size to size bytes. You specify it in
the same way as the bs value. The size of the destination
should be a multiple of the value chosen for size. For
example, if you choose obs=10k, the destination's size
should be a multiple of 10k.
of=file
writes output data to file. If you don't specify this
option, dd writes data to the standard output. dd truncates
the output file before writing to it, unless you specified
the seek=n operand. If you specify seek=n, but do not spec-
ify conv=notrunc, dd preserves only those blocks in the out-
put file over which it seeks. If the size of the seek plus
the size of the input file is less than the size of the out-
put file, this can result in a shortened output file.
omsg=string
displays string when dd runs out of room while writing to
the current volume. Any occurrences of %d in string are
replaced with the number of the next volume to be written.
dd then reads and discards a line from the controlling ter-
minal, giving you a chance to change volumes (usually
diskettes).
seek=n
initially seeks to the nth block of the output file.
skip=n
reads and discards the first n blocks of input.
EXAMPLES
dd if=in of=out conv=ascii cbs=80 ibs=6400 obs=512
Converts 80-byte fixed length EBCDIC punch card images in 6400
byte input blocks to variable length ASCII lines, 512 bytes to
the output block.
DIAGNOSTICS
Possible exit status values are:
0 Successful completion.
1 Failure due to any of the following:
-- an option that should contain = does not
-- I/O errors on read/write
-- invalid command line option
Messages
Message: absolute I/O must be in num byte units
Cause: You attempted to read from, or write to, a device which
4
dd(1) MPE/iX Shell and Utilities dd(1)
______________________________________________________________________
requires block sizes to be in multiples of its sector
size (in this case, num bytes).
Action: Specify a block size that is a multiple of the device's
sector size.
Message: badly formed number "num"
Cause: You specified num as a number (for example, a block
size), but num did not have the form of a number recog-
nized by dd.
Action: Make sure that num is a valid number, and if it is fol-
lowed by a letter to indicate the block size unit,
check the DESCRIPTION section of this man page under
the bs= option for a list of valid letters.
Message: cbs=size given without ascii/ebcdic/ibm/block/ unblock
conversion
Cause: You specified the cbs=size option but did not specify a
conversion option which uses it.
Action: Provide the missing conversion option.
Message: conv=block/unblock given without cbs= option
Cause: You specified either the conv=block or conv=unblock
option without defining a block size with the cbs=size
option.
Action: Provide the missing cbs=size option.
Message: input file "filename"
Cause: See syserror(3).
Action: See syserror(3).
Message: option=value is an unknown option
Cause: You specified an option that is not valid for dd.
Action: Check the DESCRIPTION section of this man page for a
list of valid dd man pages.
Message: out of memory for buffers
Cause: dd was unable to allocate the system resources that it
needed for conversion buffers.
Action: Free up more system resources.
Message: output file "filename"
Cause: See syserror(3).
Action: See syserror(3).
Message: read error: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: seek input: system error
Cause: See syserror(3).
Action: See syserror(3).
5
dd(1) MPE/iX Shell and Utilities dd(1)
______________________________________________________________________
Message: seek output: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: The option "option" does not contain a "="
Cause: You specified option without providing the required
equals sign (=).
Action: Provide the missing equals sign.
Message: unknown conversion "conv"
Cause: You specified a conversion value following conv= that
dd did not recognize.
Action: Check the DESCRIPTION section of this man page for a
list of valid conversion values.
Message: write error: system error
Cause: See syserror(3).
Action: See syserror(3).
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems.
The conv=ascii, conv=ebcdic, conv=ibm, conv=convfile, iseek,
imsg, and omsg options plus the w suffix described in the bs=
option are all extensions to the POSIX standard.
MPE/iX NOTES
The current MPE/iX implementation of dd converts non-byte stream
files to byte steam files before processing them. File character-
istics like file code, record size, and so forth are not pre-
served by this conversion. The output of dd is written as a byte
stream file.
In addition, direct device input/output is not currently imple-
mented.
For more information on how the current MPE/iX implementation may
affect the operation of this utility, see Appendix A, MPE/iX
Implementation Considerations.
SEE ALSO
cp(1), cpio(1), mv(1), tr(1)
6