Midrange News for the IBM i Community


Posted by: clbirk
cpytoimpf
has no ratings.
Published: 02 Apr 2013
Revised: 04 Apr 2013 - 4033 days ago
Last viewed on: 17 Apr 2024 (6424 views) 

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.

cpytoimpf Published by: clbirk on 02 Apr 2013 view comments(1)

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.

 

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: cpytoimpf
Posted: 11 years 17 days 11 hours 11 minutes ago
Edited: Thu, 04 Apr, 2013 at 17:27:14 (4033 days ago)

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?