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



Adam,
You are correct, writing a programs to read and write stream files is not
difficult at all. Writing programs to properly parse a delimited file is a
bit harder.

You have to read the stream file, strip out leading and trailing quotes
making sure to keep quotes within a string in tact. You also have to make
sure you don't get a comma in the middle of a string and assume that to be
delimiter. There are other things you have to watch for and IMHO writing
something that's already there is not worth all the troubles that can come
up.

I have attempted to write my own CSV parser in the past and it really didn't
work out so well.

Just my opinion though.

James R. Perkins


On Tue, Oct 14, 2008 at 12:05 PM, Adam Glauser <adamglauser@xxxxxxxxxxxx>wrote:

I'd have to disagree with the other poster James. Writing a programs to
read and write stream files is really not very difficult, and it can
provide significant benefits over CPY*IMPF and iSeries Access File
transfer.

Jeff Young wrote:
I am comfortable using the System API's to create files on the IFS, but
have not had to read them.

You can use the read() API to read a stream file. See
http://www.scottklement.com/rpg/ifs_ebook/basics.html#OPENCLOSE.

Start with that, and come back if you have more questions. Generally
speaking, I'd say:

1. Figure out how to read data from a string file in chunks of n bytes
(reading one byte at a time is inefficient).

2. Now forget that the data came from a file and process it byte by byte
the same as you would process multi-field data from any other source.

Scott's ebook should give you all you need, but feel free to ask more
questions here. Many questions will already be answered in the archives
of this list.

HTH,
Adam
--
This is the RPG programming on the AS400 / 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 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.