Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can a COBOL program access two tables in two subsystems?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Can a COBOL program access two tables in two subsystems?
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    Post subject:
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: 785
Location: Chennai, India

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

Please check this link.

http://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    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Wed Oct 31, 2012 10:18 pm    Post subject:
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    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Wed Oct 31, 2012 10:37 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts IMS DC screen Access sivasaras IMS DB/DC 3 Fri Nov 18, 2016 6:38 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us