× 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.



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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.