NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
C-121
Considerations—COPY
the table. The TRUNC option determines whether values are truncated. See INSERT
Statement on page I-14 for more information.
Any column except a system-defined primary key can be a source or target item.
Using COPY with tapes
Rules for using CLASS TAPE DEFINEs or labelled tapes are described in the
discussion of the FUP COPY command in the File Utility Program (FUP)
Reference Manual.
You cannot copy a multireel set of tapes created by a COBOL85 program, because
COBOL85 does not mark the end of a multireel set in the same way that COPY
does. You must use a COBOL85 program to copy such tapes. See the COBOL85
Reference Manual for more information.
Using COPY with non-SQL files
°
If the source is an EDIT file, COPY treats it like a structured file: each text line
is treated as a logical record with a read count attribute. (This differs from the
usual treatment of unstructured files in which each physical read, except
possibly the last read of a file, returns exactly in-record-length bytes.) If
an EDIT file record ends in the middle of a field, SQL adds blanks to the target
file for the remainder of the field.
°
Although you can specify a block size up to 32,767 bytes for the BLOCKIN and
BLOCKOUT parameters, some peripheral devices have smaller maximum
block sizes that must not be exceeded when using the COPY command.
°
Be careful when you use PAD and TRIM options. If your data contains trim-
character or pad-character, data might be added or lost. Use a pad
character or trim character that is not contained in your data. For example,
assume you pad each record of a file with zeros to a standard size in bytes and
then store the records in another file. If you later trim the trailing zeros when
you COPY the stored records, zeros at the end of the original data are trimmed.
Rules for enscribe files with variable-length records
Copying Into SQL Tables
°
The target file must have default values defined for columns that do not have
source fields mapped to them and for all fields missing from the source record.
A column must be defined with the DEFAULT clause of the CREATE TABLE
or ALTER TABLE command. A DDL data item must be defined with the
VALUE IS clause.
°
If a record from a non-SQL source is not long enough to supply data to all fields
mapped to target columns, each target column whose source field is missing
must have a default value defined for it.
°
In general, if a source record from a non-SQL source does not end exactly at a
field boundary, an error occurs. The following exceptions apply:
°
If the record ends in the middle of a VARCHAR field, the end of the record
defines the end of the VARCHAR data.