MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Accessing tables in different DB2 sub-systems

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
abhayasahoo
Beginner


Joined: 04 Dec 2002
Posts: 8
Topics: 6

PostPosted: Wed Dec 04, 2002 12:17 am    Post subject: Accessing tables in different DB2 sub-systems Reply with quote

Is it possible for one DB2 program to access tables from two different sub-systems ?
Back to top
View user's profile Send private message
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Wed Dec 04, 2002 4:03 am    Post subject: Reply with quote

I really don't think you can do so. Whenever we execute any COBOL-DB2 program, we specify the subsystem in SYSTSIN of IKJEFT01.
I would really be interested to know if there is any way of really accessing two tables from two different subsystems.

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12359
Topics: 75
Location: San Jose

PostPosted: Wed Dec 04, 2002 4:22 am    Post subject: Reply with quote

abhayasahoo,


Your shop must be setup to access tables between subsystems.The DBA enables it by via DB2's Distributed Request Data Access architecture.There are settings in the DB2 Catalog which allow this feature. SYSIBM.LOCATIONS table will have information for every accessible remote server.

You can try this sql.


Code:


SELECT *
       FROM
       LOCATION.DATABASE.TABLENAME
       ;


Ask your DBA if your shop is indeed setup for accessing tables between subsystems

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
raj051076
Beginner


Joined: 05 Dec 2002
Posts: 64
Topics: 21

PostPosted: Fri Dec 06, 2002 10:09 pm    Post subject: Reply with quote

I think it can be done if DDF is operational and you have an alias defined for your remote table.
_________________
Rajib
Back to top
View user's profile Send private message
Rajeev_jha
Beginner


Joined: 20 Dec 2002
Posts: 5
Topics: 0

PostPosted: Fri Dec 20, 2002 4:52 am    Post subject: Reply with quote

Yes you can do this. You need to know the location names for the tables. Suppose TABLE A exits is the location TISDB2P and TABLEB exists in TISDB2N then you can refer to the tables as

TISDB2P.ownername.TABLEA

and

TISDB2N.ownername.TABLEB
Back to top
View user's profile Send private message
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Fri Dec 20, 2002 5:57 am    Post subject: Reply with quote

Hi Kolusu and Rajiv,

I have a small doubt in this context. Let us suppose that we have an application program that has both local and remote queries. While running the program, we give the local DB2 subsystem name. Now, we give a location name alongwith the owner and table name while referencing the remote DB2 subsystem. The location has to be present in SYSIBM.LOCATIONS table and corresponding entries also in SYSIBM.LUNAMES and SYSIBM.IPNAMES tables.(Thanks to Kolusu for the link). That all is quite understandable.
My question is where will the query actually run?. I mean in which DB2 subsystem's address space, will the query run?. It cannot be totally on the local DB2 subsystem as the table exists on the remote subsystem and it cannot be totally on the remote subsystem as the query has to be resolved locally to know that it is accessing a remote system and the exact location of the remote system has to be retrieved from the catalog tables(LOCATION,LUNAMES AND IPNAMES). So, will there be a partial running of the query at both the local as well as remote subsystems?

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12359
Topics: 75
Location: San Jose

PostPosted: Fri Dec 20, 2002 6:20 am    Post subject: Reply with quote

Manas Biswal,

Check the following link which will answer your queries.

Introduction to accessing distributed data

You can read this to get an overall view about accessing distributed data

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Fri Dec 20, 2002 7:00 am    Post subject: Reply with quote

Thanks a lot Kolusu. Now, it seems quite logical. Basically, the IBM manual whose link you had provided says that you have to bind your program at both the local and remote subsystems. That is what I was hinting at. Basically, you need to have the SQL executable at both the local and remote subsystems. The rest of it is quite logical.

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
raj051076
Beginner


Joined: 05 Dec 2002
Posts: 64
Topics: 21

PostPosted: Fri Dec 20, 2002 12:44 pm    Post subject: Reply with quote

Manas

In our shop we have lot of remote databases. To access those databases what we do is we make sure DDF is installed and running. If DDF is stopped we start it with the command START DDF. Also while bringing up DB2 ,DDF automatically starts and one more thing we consider is whether TCPIP is started before or after DB2 starts. TCPIP should come up first and then DB2.

We access the remote tables by creating aliases as follows:
CREATE ALIAS <ALAISNAME> FOR LOCATION.DATABASE.TABLE

I am not 100% sure of the syntax. I will have to check.

Thanks
_________________
Rajib
Back to top
View user's profile Send private message
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Sun Dec 22, 2002 2:25 am    Post subject: Reply with quote

Hi Rajib,

Thats all fine. But what I was asking was not how to access the table(Through an alias - as you explained). What I was worried about was the query. How and Where will it actually run and where is it present(In the local or remote system). Kolusu's links provided the answer - We have to basically bind the SQLs in both the local and remote systems. You can go through Kolusu's links for more details.

Regards,
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Nila
Beginner


Joined: 26 Dec 2002
Posts: 20
Topics: 8
Location: Chennai, India

PostPosted: Fri Dec 27, 2002 6:52 am    Post subject: Reply with quote

Hi
The points given are really worthful. I want to add more and elaborate.

Assume we have an existing plan in which we have to include the package list in which the Remote location DBRM is bound.

the steps followed are:
1.Choose a name for collection to contain all packages in the plan, say PACK1.
2.At remote location we have to execute
Code:
GRANT CREATE IN COLLECTION PACK1 TO <user-id>
GRANT BINDADD TO <user-id>

3.Bind each DBRM as Package at remote location say NEWYORK.
Code:
 BIND PACKAGE(NEWYORK.PACK1)
MEMBER(PGM1)

4.Then include the remote package in package list of local plan, say PLAN1.
Code:
BIND PLAN(PLAN1)
PKLIST(NEWYORK.PACK1.PGM1)

5.Before runtime the package owner must have all access privilages needed at remote locatin.
6.Finally bind at our local DB2 with following options
Code:
PKLIST(NEWYORK.PACK1.*)
CURRENTSERVER(NEWYORK)


When about to run package, DB2 searches for the collection PACK1 at remote location. Any update in applicaiton programs will affect the remote tables.

Hope I am clear Idea
_________________
Cheers Nila..
Back to top
View user's profile Send private message
anjanaachan
Beginner


Joined: 26 Dec 2002
Posts: 3
Topics: 0

PostPosted: Sat Dec 28, 2002 8:30 am    Post subject: Reply with quote

8)
Just one more point in this context.
Whatever was mentioned above was in the context of programs and binds.
Regarding Manas's initial query, it is possible to access remote DB2 subsystems froma local system if u have the reqd access.
For this u need to get more access than the regular select access(as this is a part of DDF). For this , u need ur DBA to GRANT u access AT ALL LOCATIONS.

Then u need not logon to every production site separately if you have tables all over the place in a network that supports DDF.
Back to top
View user's profile Send private message
Manas Biswal
Intermediate


Joined: 29 Nov 2002
Posts: 382
Topics: 27
Location: Chennai, India

PostPosted: Mon Dec 30, 2002 2:51 pm    Post subject: Reply with quote

Hi Nila,

You have basically segregated your packages into local and remote packages. What if a single application program contains queries for both the local and remote system. In such a case, what do we do?. I suppose, we basically have to bind the DBRM both at the local and remote subsystems. I did not have the time to go through Kolusu's links in detail but that is what they basically say - we do have to bind the DBRM at both the local as well as remote DB2 subsystem.

Regards.
Manas
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group