JCL and DB2 LOAD utility statement for data in CSV input format
You want to load a CSV file into a DB2 for z/OS table? Usually the problems are …
- the columns do not start at fix column position
- strings, dates and times are not put in (double) quotes
- special characters are included, some are used to separate columns
- numerical data may include commas as decimal point
- data coming from source system may be presented with different codepage translation
(This problem is not covered by following example. Pleae see CCSID(n,n,n) option of the LOAD statement.) - input strings may be longer than target columns
(This problem is not covered by following example. Pleae see TRUNCATEÂ option of the LOAD statement.)
This is how it works …
//************************************************************ //* ASCII : X'3B' = ; X'22' = " X'2E' = . //* EBCDIC: X'5E' = ; X'7F' = " X'4B' = . //************************************************************ //LOAD EXEC PGM=DSNUTILB,PARM='DB2A' //SYSUDUMP DD DUMMY //SYSUT1 DD SPACE=(CYL,(50,5)),UNIT=SYSDA //SORTOUT DD SPACE=(CYL,(50,5)),UNIT=SYSDA //SYSPRINT DD SYSOUT=* //UTPRINT DD SYSOUT=* //SYSIN DD * LOAD DATA INDDN SYSREC LOG YES RESUME NO REPLACE FORMAT DELIMITED COLDEL X'5E' CHARDEL X'7F' DECPT X'4B' INTO TABLE MYUSER.TEST_CSV ( C1_CHAR POSITION(*) CHAR , C2_DEC POSITION(*) DECIMAL , C3_VARCHAR POSITION(*) VARCHAR , C4_INTEGER POSITION(*) INTEGER , C5_DATE POSITION(*) ) /* //SYSREC DD * "A";75.5;"SIEBEN-FUENF";75;"1.1.2008" "B";11111175.5;".......SIEBEN-FUENF";21344475;"2.1.2008" ... /* //
Comments
Comments are closed.