MLoad of a file with delimited and quoted fields

Tools

MLoad of a file with delimited and quoted fields

Hi all, thanks in advance.
There is a way to load a file with quoted and delimited fields?
For example, a row is like this:
"1111"|"XXXX"|"GGGG"

All fields are VARCHAR and I need it to do a fixed MLoad script (some field can contains field separator, but with quoted fields this isn't a problem) for some jobs.

Thanks!
1 REPLY

Re: MLoad of a file with delimited and quoted fields

Here is example:

LOGTABLE log_table_name
.RUN FILE x:\MLoadUtil\mload.startup;

.BEGIN IMPORT MLOAD TABLES table_name
SESSIONS 10 1 ERRLIMIT 1
ERRORTABLES et1
UV1
WORKTABLES WRK1;

.FIELD FAC_ID_STORE * VARCHAR(06) ;
.FIELD ITEM_ID * VARCHAR(13);
.FIELD SALES_SHRINK_TYPE_CD * VARCHAR(03);

.DML LABEL NEW_RECORDS;
INSERT INTO table_name (
Fac_ID_Store
,Item_ID
,Sales_Shrink_Type_Cd

) VALUES (
CAST(:FAC_ID_STORE AS SMALLINT)
,CAST(:ITEM_ID AS INTEGER)
,CAST(:SALES_SHRINK_TYPE_CD AS CHAR(03))

);

.IMPORT INFILE x:\inputfile.txt FORMAT VARTEXT '|'

LAYOUT INPUT_LAYOUT
APPLY NEW_RECORDS;

.END MLOAD;

.IF &SYSRC <> 0 THEN;
.LOGOFF &SYSRC;

.ENDIF;

.QUIT;