|
On Thu, Jul 17, 2014 at 12:02 PM, Mike Cunningham
<mike.cunningham@xxxxxxx> wrote:
We just finished a project doing this.
We made a work file defined as
[...]
In RPG did this
[...]
Good so far.
In CL did this
/* Copy the temporary import work file to the IFS directory */
CPYTOIMPF FROMFILE(QTEMP/UTPIMPF) TOSTMF(&TOSTMF) +
MBROPT(*REPLACE) STMFCODPAG(*PCASCII) +
RCDDLM(*CRLF) DTAFMT(*DLM) STRDLM(*NONE) +
STRESCCHR(*NONE) RMVBLANK(*TRAILING) +
FLDDLM(*TAB)
I doubt CPYTOIMPF is the best tool here. The intent of CPYTOIMPF is
to take an externally described file with a bunch of regular fields
(typically not all text), and put the delimiters between those fields
for you. In your case, you've got a file with just one field defined,
so CPYTOIMPF is left with nothing to do but copy that one field (thus
no delimiters for it to insert) to the output.
The process flow you're describing (where you use RPG to insert
delimiters into a flat file) fits better with CPYTOSTMF. In effect,
what you've done is to provide Jeff Young's answer, except with some
code samples (which are valuable, don't get me wrong!).
Richard, if you're comfortable with RPG, I think this approach is
probably the most expedient. Your RPG code will of course be more
complex than Mike's, because you'll have to write multiple formats,
but the basic flow is there. Of course you need to use pipe instead
of tab, and I recommend using CPYTOSTMF instead of CPYTOIMPF at the
end.
John Y.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.