× 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, Jan 10, 2019 at 11:28 AM Chris Wright
<Chris.Wright@xxxxxxxxxxxxxxx> wrote:
Turns out that the cpytostmf command was actually working just fine, but the resulting file is being replaced by a program which is being called further downstream which creates a stream file of the same data using a little rpg function that the programmer wrote themselves! I'm guessing because they were having issues with the cpytostmf at some point in the past???

It is often fun and tempting to roll your own. Perhaps that "little
rpg function that the programmer wrote themselves" was motivated by
one of the reasons Rob pointed out.

I'd like to strongly encourage folks who want to roll their own CSV
code to take a good, hard look at doing so in something other than
RPG. The commands IBM provides have definitely gotten better, but
CPYTOIMPF still doesn't produce exactly what Excel would produce (and
might still have an issue with certain numeric data; I haven't checked
in a while). Meanwhile, CPYTOSTMF is both clunky and a roundabout way
to make a CSV (alluded to by the last point on Rob's list).

Python's CSV module is exemplary at working with CSVs. If you use it,
you are still rolling your own, you can still customize it the way you
want or need, but corner cases and niggling details are taken care of
for you. Python makes it super-easy to handle variable numbers of
columns or different file formats from one run to the next. Now that
Python is provided by IBM, the reasons not to try it are almost gone.

John Y.

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.