This document describes one scenario why CPYFRMIMPF fails to convert a .csv file to a database file.
msgCPIA083 on CPYFRMIMPF and not all records are copied
Diagnosing The Problem
CPYFRMIMPF fails to copy a .csv file to a database file.
The TOFILE physical file only gets 1 record added and the data is all invalid.
The joblog shows:
CPYFRMIMPF FROMSTMF('\pathname\myfile.csv') TOFILE(mylib/impfile) MBROPT(*REPLACE) RCDDLM(*CRLF) RPLNULLVAL(*FLDDFT)
CPC3101 Member IMPFILE file IMPFILE in MYLIB cleared.
CPIA083 Stream file copied to object with truncated records.
A .csv file that is created by an ASCII system such as a PC usually contains ASCII data (CCSID 819).
However if it is marked as EBCDIC data (CCSID 37), the System i looks for a carriage return and line feed (CRLF) has hex 0D25 (CCSID 37) and not hex /0D0A (CCSID 819).
The hex data in the .csv file shows hex 0D0A for CRLF but display attributes shows CCSID 37.
Resolving The Problem
Determine what part of the process of FTPing the data to the IBM i is setting the CCSID to 37 when it really contains data in a different CCSID
Alternatively, run CHGATR to change the CCSID of .csv file from 37 to 819.
18 December 2019