IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can a COBOL program access two tables in two subsystems?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Oct 30, 2012 6:32 am
Reply with quote

I have two tables, TA and TB, in two different subsystems respectively, I want to access the two tables in one COBOL program, can I do it?
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Oct 30, 2012 10:15 am
Reply with quote

I forgot to say, the two subsystems are in the same LPAR.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Tue Oct 30, 2012 10:27 am
Reply with quote

Please check this link.

ibmmainframes.com/viewtopic.php?t=59478
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Oct 31, 2012 9:53 pm
Reply with quote

In essence, you can not have 2 (or more) active 'connects' to db2 in one thread.......

So, based on a one thread solution (such as SAS),
Connect to the 1st DB, do your SELECT and
save the results (either in memory or write it to dasd.
DECONNECT
Connect to the 2nd DB, do our SELECT and
save the results (either in memory or write it to dasd.
DECONNECT

then play with the data
and generate your output.

Now, if you are OO literate,
you could try starting two new tasks,
one would connect to the 1st DB and store the data and then signal finish.
the other would connect to the 2nd DB ......

then play with the data
and generate your output.

You will never beable to execute (what I would call) a-real-time-JOIN on tables in different z/OS db2 sub-systems.

what you would need is an 'super agent' in some db2 subsystem
supervising both of the 1st DB and 2nd DB agents.

happy Halloween!
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Oct 31, 2012 10:18 pm
Reply with quote

What we have done in our shop is to create an ALIAS for Table B in Subsystem A.

This ALIAS points to Table B is Subsystem B.

You code your program as is they are in the same subsystem, while the data for Table B is actually in the other Subsystem.

You need to make sure your executing Job has the proper authority to access the data in Subsystem B.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Oct 31, 2012 10:24 pm
Reply with quote

I imagine one could become very unpopular with thoughtless SQL.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Oct 31, 2012 10:37 pm
Reply with quote

Quote:
I imagine one could become very unpopular with thoughtless SQL


I do not understand the meaning of this....
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Oct 31, 2012 10:47 pm
Reply with quote

i only meant,
as another giggle slithers thru my soul,
one has the ability
to simultaneously bring not just one
but two
db2 subsystems to their knees with some convoluted sql.

on the other hand,
yours is a tremendous contribution,
and I am at present someone deep into a few manuals
trying to figure out why ALIAS was not more visible than it was.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top