Fixed-length format definitions
Fixed-length format files must have a format definition. This topic includes examples of typical fixed-length format definitions for typical data types.
End-of-record
RecordDelim ''
An
end-of-record delimiter is required, even for the last record.The RecordDelim option specifies a literal sequence of up to 8 bytes, which does not translate common escape representations or support functions such as char(8).
Record length
Recordlength 72
Skipping fields
“filler char(4) bytes 4”
“filler fld_name char(4) bytes 4”
Temporal values
Data type | Value | Format clause |
---|---|---|
date | 20101231 | date1 date YMD'' bytes 8 |
time | 231559 | time1 time(6) 24hour '' bytes 6 |
timestamp | 0101231231559 | stamp1 timestamp(6) 24hour '' bytes 14 |
timestamp | 20101231231559000001 | Load as char(24) and then use insert-select
statement
|
date | 2010-12-31 | date2 date YMD'-' bytes 10 |
time | 23.15.59 | time2 time(6) 24hour '.' bytes 8 |
timestamp | 2010-12-31 23:15:59 | tms2 timestamp(6) YMD '-' 24hour ':' bytes 19 |
timestamp | 2010-12-31 23:15:59.0001 | tms3 timestamp(6)
YMD '-' 24hour ':' bytes 26 |
timetz | 12:30:45+03:00 | Tz1
TIMETZ(6) 24HOUR ':' bytes 14 |
timetz | 123045+-0300 | Load as char(11)
and then use insert-select statement
|
Numeric values
Data type | Value | Format clause |
---|---|---|
integer | 32767 | int1 int2
bytes 5 |
int8 | 9123456789123456 | int2 int8 bytes 16 |
numeric | 2315.59 | num1 numeric(6,2) bytes 7 |
numeric | 231559 | Load
as char(6) and then use insert-select statement
(col/100)::numeric(6,2) |
floating | 1.2345678 | flt1
floating bytes 9 |
floating | 12345678 | Load as char(8) and
then use insert-select
statement(substring(col1,1,1)||'.'||substring(col1,2,7))::float |
double | 1.2345678 | flt1 double bytes 9 |
double | 12345678 | Load as char(8) and then use insert-select statement
(substring(col1,1,1)||'.'||substring(col1,2,7))::double |
Logical values
Data type | Value | Format clause |
---|---|---|
boolean | Y or y, N or n | BOOL Y_N BYTES 1 |
boolean | 1, 0 | BOOL 1_0 BYTES 1 |
boolean | T or t, F or f | BOOL T_F BYTES 1 |
Null values
- The keyword nullif
- The column reference
- The test expression
- The nullif specification is as follows:
“nullif &=’99991231’”
- The entire specification is as follows:
“fld1 date YMD'' bytes 8 nullif &=’99991231’”
- All format specifications support the nullif clause.
In addition to supporting &=
, which evaluates to "string must exactly
match," the nullif clause supports &&=
, which allows substring matching.
This is useful in cases where the string might occur anywhere in a field with space padding. For
example, nullif &&=’N’
matches the different expressions
“ N “, “N “, and “ N”.
Data type | Null value | Format clause |
---|---|---|
boolean | ' ' (1 space) | BOOL Y_N
BYTES 1 NULLIF &=' '(1 space) |
date | 000000 | DATE YMD '' BYTES 6 NULLIF &='000000' |
int | ' ' (6 spaces) | INT BYTES 6 NULLIF &=' '
(6 spaces) |