Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
I have a couple of ddl defined tables that I use cpytoimpf to create a csv or tab delimited file. The problem is that if a field is all blank, I get " " instead of "" even thought I do a remove blanks set to *both (have tried trailing and leading also).
On another forum I read from someone who said the reason for this is so that the ibmi would not get confused during an import, not knowing what to do with "" especially if you have defined the filed NOT to be *NULL. Come on, surely the bright minds can know how to handle this.
I don't know if bob's tool cpytocsv works similar or if it handles trailing and leading blanks, etc.
Or am I missing something. What i want is:
"John","Doe","123 Main Street","","Washington","DC","20015"
I am getting:
"John","Doe","123 Main Street"," ","Washington","DC","20015"
Doesn't seem like alot but on the other end they are using this for some microsoft office functions and it is a problem.
The CPYTOCSV does NOT embed an extra blank.
Maybe your company should purchase Bob's cpytocsv in COZTOOLS or call IBM support and ask them to put that capability into CPYTOIMPF.
The reason they (IBM) does this is because two consecutive "" are considered an escaped quote. So when it is read back in via CPYFRMIMPF it would get confused that "John","", means John followed by an empty field. it would treat it as John followed by a single Quote.
But they've never been more than 10 years behind the rest of the world regarding CSV support so why is it surprising that this is an issue?