cpyfrmimpf
I use it often in hands free automated processing. Does it do every style
from any system or software? No, but it does a lot, and certainly improved
over time.
sample:
cpyfrmimpf fromfile(xyx_csv) tofile(xyz_native) mbropt(*replace)
rcddlm(*all) datafmt(*dlm) strdlm('"') flddlm(',') rplnullval(*flddft)
the strdlm (string delimiter) is single quote, double quote, single quote..
With monmsg I can deal with empty files, etc
Also use Scott's samples in read & write ifs files when needed.
btw - we need to stop thinking csv is an "Excel" format (not you John, but
earlier thread). It existed long before Excel, and btw it is one of many
formats Excel can output. The format pre-dates PC's! According to wikipedia,
IBM 360 supported them in 1967.
It also unfortunate it's usage has had mixed requirements, especially when
commas, quotes, double quotes exist in the data, where many feel free to
make their own rules. And then there are those who separate with pipe
symbol, etc...and watch out for various foreign interpretations, like dollar
amounts with comma as the decimal place...
Jim Franz
----- Original Message -----
From: "John Yeung" <gallium.arsenide@xxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Sent: Tuesday, November 15, 2011 10:49 PM
Subject: Re: FTP Format
On Tue, Nov 15, 2011 at 9:03 PM, CRPence <CRPbottle@xxxxxxxxx> wrote:
On 15-Nov-2011 17:05 , John Yeung wrote:
If the data is being saved from Excel as CSV or
tab-delimited, then all bets are off with CPYFRMIMPF.
For example?
If the data includes commas, quotes, or newlines (or, in the case of
tab-delimited, then commas, quotes, newlines, or tabs), Excel will
escape them by surrounding the field with quotes, and if there are
literal quotes, then also doubling them.
This is not a Unixy or SQLish way of doing things, and I have not used
a CPYFRMIMPF which handles this properly. I have also never used a
CPYFRMIMPF above V5R2, so it is possible that newer ones have learned
Excel-style escaping. But several people (not just on this list) have
expressed having even worse experiences with later versions, so that
doesn't give me much confidence. Granted, their issues may have
nothing to do with importing Excel-generated files. It still doesn't
make me feel good about the command.
John
As an Amazon Associate we earn from qualifying purchases.