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



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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.