I have to load the data from Fixed width flatfile to Table using NZLOAD.
Can any one can help me to get the syntax for nzload with fixed width.
NPS 4.6.5 and 4.6.6 are the only versions which currently support fixed format loading. Are you on one of these versions? TwinFin systems (NPS 5.0) do not currently support fixed width input files for nzload, so you have to load the entire line into a single column in a staging table and then use substr to pull out the individual fields.
The next release of TwinFin (I'm guessing version NPS 5.1 although I've heard rumors it may have a version other than 5.1) will support fixed format files.
A simple example of loading a fixed format file:
NZLOAD
create table foo (x integer, y varchar(20), z integer, dt date);
nzload -t foo -format 'fixed' -layout 'bytes 5, bytes 20, bytes 8, bytes 10' -df /tmp/fixed.dat
This loads 4 fields out of the file, field one is 5 bytes wide, field 2 is 20 bytes, etc
EXTERNAL TABLE
select *
from external 'c:\temp\fixed.dat'
(
x integer,
y varchar(20),
z integer,
dt date
)
using
(
remotesource 'odbc'
format 'fixed'
layout(
bytes 5,
bytes 20,
bytes 8,
bytes 10
)
);
You can do much more complex formats than just simple fixed width. nzload also handles variable width fields where the field width is in the file right before the column. For example a line might look like "0812345678" where the first 2 characters '08' tell nzload how wide the next field is (8 characters).
<snip>
