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



Chuck

Just to be complete, as of 7.1, we can specify a remote DB in a 3-part naming in an INSERT or a CREATE TABLE - your replies, of course, are for those on an earlier version of the OS.

So we can do something like CREATE TABLE LOCALLIB.LOCALTABLE as (SELECT * FROM RDBENTRY.REMOTELIB.REMOTETBL) -- *SQL syntax here.

Vern

On 10/18/2014 9:09 AM, CRPence wrote:
On 17-Oct-2014 10:19 -0500, Darryl Freinkel wrote:
I need to be able to read a remote table and update a local table.

In a followup reply, v5r4 was revealed as the VRM; of course in that case, what features [e.g. three-part naming] have been made available on newer releases are probably moot.?

I have set up the remote database entries and have used connect. What
I cannot find documentation on is how to use 2 files on different
machines.

When I connect to system B, all the tables are in system B.

In a program, the data that previously had been obtained using a FETCH from the remote connection [e.g. after CONNECT TO] would be the source of data used for the INSERT performed after a SET CONNECTION to the local system. The query will have run on and the data fetched from, that remote system. The insert runs on the local system and the data is local to the program. To get all of the data [best done in multi-row fetches] and then perform the inserts [best done as multi-row inserts], the SET CONNECTION would need to switch back-and-forth between the remote [for FETCH] requests and local [for INSERT] requests, until the end of data.

Is there a way to do a
select from system B and insert into system A ?

Example:

Insert into fileA /* on system A */
( select * from FileA /* on system B */ )


Aside from writing an SQL program, the following are two more direct ways; note that the latter requires an interactive session\request:

The Start QM Query (STRQMQRY) feature supports an Output File (OUTFILE) parameter. Directing the output to the output file, functions as an effective INSERT INTO to a local file; if the output file does not exist, IIRC, the output database file as an SQL TABLE. The SELECT would be coded for the *QMQRY object, and the request to obtain the selected data from the remote database and /insert/ the data into the named TABLE, would be something like:

STRQMQRY QMQRY(theQuery) OUTPUT(*OUTFILE) OUTFILE(outLib/tableName) OUTMBR(*FIRST *ADD) RDB(theRDBname)

The Start SQL (STRSQL) feature similarly supports an Output File feature; the capability is established via the F13=Services, from which the first option is to set the output device and settings. After the CONNECT to the remote database, when the query is run, the output from that query would be directed to the named output file; in this case, the target output file, if the file did not already exist, would IIRC, be created as a non-SQL externally described database file.

Each of writing a program, the STRQMQRY, and the STRSQL, should be available on v5r4. The STRQMQRY would be available [Create QM Query (CRTQMQRY) from a source vs the interactive Start QM (STRQM) would be used to define the SELECT query] even if the 57##ST1 product is not installed, whereas the other two options would not be [directly] available without that LPP being installed.



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.