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



IMHO this is overkill... If I understand what Duane is really asking for, we do this all day long.

If the file is text-delimited (tab, comma, etc.) I often use CPYFRMIMPF.
1. Save the text file on IFS (usually brought to our system via FTP
2. CPYFRMIMPF to a database file

We use this so much that I've written a program that I can call and pass the file extension, path, database file, delimiter, etc. It reads the entire folder and copies each text file with the given extension using CPYFRMIMPF, then (when successful) moves the file to a "history" folder.

The other method I use is a service pgm from Scott Klement called CSVR4. This helps you read the delimited file from the IFS directly in RPG - field by field, row by row (even though it's one long string). This is helpful when each "row" may not be the same.

The CPYFRMIMPF is usually my preferred method. I would be glad to share my code.

Greg



-----Original Message-----
From: WDSCI-L [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Tuesday, August 30, 2016 12:14 PM
To: Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries <wdsci-l@xxxxxxxxxxxx>
Subject: Re: [WDSCI-L] Making the most, or over-thinking it - SQL for uploads

LOL

Duane - it's not due to any lack on your part - as Buck is sayin, text files are unstructured things.

Now if you have SQL Server, or MySQL, it is probably possible to have a link or some such that can pull stuff out of the text fiel - assuming it is either delimited or fixed-length data.

This just doesn't feel "convenient"! Have the text file saved or otherwise delivered to an IFS directory and have a regular job that imports it to a holding file, then run SQL on the i that does does the WHERE stuff for you.

Easy? Yep! At least IMHO

Vern

On 8/30/2016 11:03 AM, Duane Scott wrote:
Thanks for the responses.

Vern - Not necessarily a one-time task as importing data from PC to DB2 is done constantly, and there are many ways to do so. However, using SQL is my FIRST thought over most of the tools that we have access to, simply because of its convenience. At least perceived convenience. As to the method that I used to get the data this time, I used Access Client Solutions Data Transfer. But doing so forced me to load the entire record to a DB2 data file from which I used interactive SQL from an IBM i ACS emulation session to INSERT my selected fields. Note: my first transfer using ACS was not exactly easy until I figured out how different it was from the old Client Access. But I endured and achieved the success I needed to "get 'er done".

Buck - I figured as much since I couldn't find much in the way of assistance through Google or WDSCI-L. But I wasn't sure I had used the correct terminology in my search. I am fairly certain that I have access to MySQL or SQL server, because I've toyed with it on non-IBM i projects. Very briefly. And the files I used were already structured for use with the access. But I'm not familiar with setting up the PC to interact. Thus the request for a primer, which was basically a shot in the dark. I think I understand what you are saying about it being a part of a MySQL schema already set up, which it is not.

I really just figured that I could access text files similar to accessing them as done on IBM i. I also figured that it was my own lack of experience and knowledge of setting up the PC that caused the inability to just find the file and open it up.

duane

-----Original Message-----
From: WDSCI-L [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Buck
Calabro
Sent: Tuesday, August 30, 2016 11:40 AM
To: wdsci-l@xxxxxxxxxxxx
Subject: Re: [WDSCI-L] Making the most, or over-thinking it - SQL for
uploads

On 8/30/2016 11:15 AM, Duane Scott wrote:

I can access my DB2 files on the IBM I and display data, but haven't figured out the set up to access text files on a PC (using SQL).
Generally speaking, you can't.
Think of SQL as a client-server relationship.
There's a client, which accepts SQL statements like SELECT COLUMN FROM TABLE, and there's a server which the client connects to, and acts upon that statement.

On a typical Windows PC, there's no server to handle the SQL statement.
So if you're talking about a regular .txt file which you can edit with Notepad, you aren't going to use SQL to do anything with it.

On the other hand, if you have DB2 or MySQL or SQL Server loaded and running on that PC, and the file is part of a schema inside the database, you can connect to it if you have the appropriate JDBC driver.

What's the setup on the PC?

--
--buck

Visit wiki.midrange.com and register for an account. Edit a page that helps you, and because it's public, you'll help someone else, too!

--
This is the Rational Developer for IBM i / Websphere Development
Studio Client for System i & iSeries (WDSCI-L) mailing list To post a
message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/wdsci-l.

________________________________
________________________________
CONFIDENTIALITY NOTICE: This electronic message transmission is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you have received this transmission, but are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this e-mail in error, please contact NALC Health Benefit Plan at 703-729-4677 and delete and destroy the original message and all copies.





--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-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.