CSV to Flat File Filter
This filter reformats CSV file into flat records with data aligned in columns.
Note: This software is supplied with three months
warranty, with no ongoing support or charges. The filter runs with
ASCII files (characters to Hex FF) and UTF-8 data (resulting from
FormTrap's Locale filter, see HERE
for details.
At April, 2016 there is no Linux version. If a Linux version is
required, ask us to quote.
Introduction
This filter converts CSV files into FLAT (Fixed Length ASCII Text)
files, using the delimiter character to signify end-of-column.
The character used to delimit columns is a parameter which defaults
to comma.
Parameters
Parameters are these (produced from the program when run with the -?
parameter):
- Program parameters:
Generic options:
-? [ --help ] produce this help message
-d [ --default ] arg default column width (optional, defaults to 40)
-c [ --custom ] arg comma separated list of column widths, empty widths
substituted with default value, zero width ignores the
column - (optional)
-s [ --separator ] arg field separator - (optional, defaults to comma)
-q [ --qualifier ] arg field qualifier, one of three values [d,s,n] (double
quote, single quote, none).
Optional, defaults to double quote
-i [ --input ] arg input document file (optional, defaults to stdin)
-o [ --output ] arg output document file (optional, defaults to stdout)
-l [ --logfile ] arg log file (optional, defaults to stderr)
Parameters are self-explanatory.
Usage - Command Line
Command line may be used for Windows outside of the normal Server
procedure. We suggest you test parameters against the target file,
then transfer tested parameters to the FormTrap Server (next
section).
Examples (first example assumes stdin and stdout
files, with defaults):
csv2flat.exe - -
csv2flat.exe -c35,25,25,40,8,8,12,6 -s~ -qd "-ic:\files\maint.dat" "-oc:\formtrap\maint-flat.dat"
Example of Conversion of a CSV file
Below are the input and output files resulting from running the program with default parameters (fields aligned every 40 columns).
Input:
Output:
Installation within Server V7 or V8 via Setup
This is the norm for the CSV to Flat filter, where each different file conversion requires a different filter within Setup. Filters are normally invoked as External input and MUST be after the "Western" or other locale filter.
Version 7 or Version 8 Installation, SBE and Enterprise:
- Copy csv2flat.exe to the %ftinst% folder (highlighted in the screen shot).
- Define each different required CSV to Flat conversion in Setup, Filters (see the manual page via F1 and below) and invoke via Queues, Filters tab to process.
Note that input and output use the hyphen to indicate stdin
and stdout.