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



For a one off situation, the process I use is like this:
1. Save the worksheet as a tab delimited text file on a network share or my iSeries home directory, where it's accessible to the iSeries.
2. Delete header rows and any blank rows at the end of the file
3. Remove/normalize quotes - Excel will enclose strings containing embedded quote marks with quotes, and double the embedded quotes. I use a little awk script to fix them. I've included it at the end of this message. 3. Create a database table that matches the fields in the tab delimited file. 4. Use the CPYFRMIMPF command to copy the tab delimited file to the database, something like this:
CPYFRMIMPF FROMSTMF('/home/<me>/<myfile>')
TOFILE(ARGETLIB/TARGETFILE) MBROPT(*REPLACE) RCDDLM(*CRLF) STRDLM(*NONE) FLDDLM(*TAB) DATFMT(*USA)
          RPLNULLVAL(*FLDDFT)

Here's the awk script:
BEGIN {
   # Tab delimited file
   FS="\t";
   OFS="\t";
}
/./ {
   # For each field in the current record
   for (i=1;i<=NF;i++) {
       # Remove the first and last character from the field
       # only if both are quotes.
       if (($i ~ /^\"/) && ($i ~ /\"$/)) {
           # Remove the beginning quote
           gsub("^\"","",$i);
           # Remove the ending quote
           gsub("\"$","",$i);
       }
       # Replace multiple contiguous quotes with a single quote
       gsub("\"+","\"",$i);
   }
   print;
}


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.