× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I agree, trying to write CSV data to DB2, then convert to stream-file is
an error prone exercise. IBM has changed the CPYTOIMPF command in every
release since V5R1, as I recall. V5R4 brought huge changes to default
behavior, and broke a lot of code....

Much better to write your CSV to a streamfile directly. Scott's
tutorial is superb, and changes to your current RPG export program are
trivial, once you get the hang of it.

JMO,
Eric DeLong

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: Monday, March 02, 2009 1:13 PM
To: Midrange Systems Technical Discussion
Subject: Re: CPYTOIMPF - extra delimiter issue

If you're already going through the steps of creating a one big field
file with the fields already delimited by commas, then why are you using
CPYTOIMPF instead of CPYTOSTMF?
I've found CPYTOIMPF to be:
- more error prone,
- slower
- less flexible
than writing your own program to move it to a stream file in the ifs via
http://www.scottklement.com/rpg/ifs.html


Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





From:
Blake.Moorcroft@xxxxxxxxxx
To:
midrange-l@xxxxxxxxxxxx
Date:
03/02/2009 01:30 PM
Subject:
CPYTOIMPF - extra delimiter issue
Sent by:
midrange-l-bounces@xxxxxxxxxxxx



Hello all...

Has anyone ever run into an issue when building a CSV file from a DB 2
table (created with SQL create statement), where an extra string
delimiter

appears in the first column of the csv file.

We are producing a csv file for automatic distribution to a client. The

data base file is populated using an RPG ILE program, with a text string

being populated to a single field in the data base file 1000 characters
long. The string is delimited with commas for fields and double quotes
(") for string fields. The file is then accessed through a CL where the

CPYTOIMPF command is run. The issue arises because a string delimited
(") is appearing at the end of the first character field. This is our
regular string delimiter as defined in the CPYTOIMPF command (listed
below).


CPYTOIMPF FROMFILE(QTEMP/HDCSVDLY) TOSTMF(&PATH) +
MBROPT(*REPLACE) STMFCODPAG(*PCASCII) +
RCDDLM(*CRLF) DTAFMT(*DLM) STRDLM('"') +
FLDDLM(',')


No amount of tweaking or variation appears to get rid of it. We've
tried
adjusting the stream code page to *STDASCII, adjusting the contents of
the

database field populating the field (a default character value of '1'
(without the quotes)).

We're now at wits end, and it's becoming a lonely place.

Have a good day.


Blake Moorcroft
Developer - Corporate
Russell A. Farrow Limited
1980 Ambassador Drive, PO Box 333, Windsor, Ontario N9C 3R4
Bus: 519-966-3003 ext. 566, Fax: 519-966-9870
blake.moorcroft@xxxxxxxxxx

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.