I am creating few sotred procedures in one of my databases. Some of them need to retrieve data from another database that is located on the same system.
In an OS/390 platform, you can use DDF (Distributed Data Facility.) This is an OS/390 address space.
This requires binding remote packages locally in the BIND PLAN PKLIST parm by specifying the remote node, collection name, package name or wildcard.
You CONNECT in you application code to the remote subsystem. (Remote can mean an LPAR on a different machine, a different LPAR on the same machine, or the same LPAR. DDF doesn't care.)
Like a toggle, you CONNECT to the remote system, DML is executed in that databases. Then RELEASE the connection. By virue of the release, you are now connected locally. Insert the rows locally or update or whatever. Connect again if more rows are needed, for singleton selects, or until the end of the cursor.
In short, Package A (a stored procedure) is compiled and bound in two different systems, to two databases. But both the local and remote Package As are bound within a local plan. It is called locally but invoked both locally and remotely, line by line, with control passing back and forth.
You can interogate the SQLCA (SQLCODE) while connected locally or remotely.
local: CONNECT
remote: OPEN CURSOR
remote: FETCH
remote: RELEASE
local: INSERT
local: CONNECT
remote: FETCH
remote: RELEASE
local: INSERT
local: CONNECT ...
continue until END OF CURSOR (+100)
If the remote packages are using cursors, then use FOR FETCH ONLY or FOR READ ONLY (synonymous terms) to use a 32K VTAM buffer transport mode. When used in conjunction with sequential prefetch, this will be the most efficient transport of data. Also, you should specify the WITH HOLD option, so the cursor doesn't close after a commit.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.