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



Why don't you just process the file directly in RPG and update the file? I
have wrapper service programs but no access to a machine at the moment.
Search the archives for examples of using unix file api's. All kinds of
stuff out there.


On Mon, Feb 4, 2013 at 2:26 PM, Michael Schutte <mschutte369@xxxxxxxxx>wrote:

I have a request to process a CSV file and import the data into a file.

The first record will have column header with the name of the field that
it's suppose to update.

For example if in file ITEM_MASTER there are fields ITEM and DESCRIPTION


R ITEMMST
ITEM 20
DESCRIPTION 50


The CSV would look like this.

"ITEM","DESCRIPTION"
"1234","ITEM NUMBER 1"

The user would like to first see if there is an item that currently exists
and then update when found or write a new record.

So I got to thinking(bad idea), maybe I could somehow take the entire csv
record and put them into an array, easily... For example with a SQL
procedure or function you could


SET fields = ARRAY["ITEM", "DESCRIPTION"];
SET data = ARRAY["1234","ITEM NUMBER 1"];


Then I could loop through the array, do validation... when passed then
update item master file.

What do you think? Is there a better method when the number of columns in
the import file could differ?

If you like this idea, I'm having trouble finding examples of using SQL
Arrrays in RPGLE.


P.S. There will a ton a validation and put into a holding file prior to
updating the ITEM master.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-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.