Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two db2 subsystems from one cobol program

Status
Not open for further replies.

cobolNOR

Programmer
Sep 14, 2006
2
DK
I have the need to create a cobol program that compares a specified
table in two different db2 subsystems. This is to validate that the
table is identical or not (including field values) for the two
subsystems.

Of course, I could solve this by running a program in both environments
creating an output file, and then compare the two files. But if it's
possible it would be preferred that this could be done using only one
cobol program (running once).

Could anyone help me with this, or maybe direct me towards somewhere on
the internet where I can find information on how this is done?

Currently the version of DB2 is v7.
 
And the O.S.? Mainframe? And the solution? Strictly cobol or are changes to the DB2 configuration possible?
 
Sorry, I should have included this information :)

The O.S is mainframe, yes. And cobol only would be the best solutions.
 
When you start a cobol program, it runs in a specific db2 environment, and there's no command that I am aware of that you can issue from the cobol program to swap subsystems.

What I think you can do is to define a view or alias on one of the subsystems giving the fully qualified three-part name of the db2 table on the other subsystem. This would allow you to access to both tables in one subsystem.

I would have a word with your DBAs for further guidance. You may wish to drop a note in the DB2 forum.

Two other methods occur to me, if you didn't want to get DBA involved:
1. Write a QMF procedure that selects all data from one table, CONNECTs to the other system, saves the data as a temporary table and runs a compare there
2. Set up a batch job that runs two db2 unloads in separate steps, outputting the data to a file, and compares outside of db2.

Hope this helps.

Marc

 
I haven't coded anything in Cobol (or on mainframes) for many many years, but if my memory serves me right you can access more then on DB2 system in an transaction/batch process under IMS/TM.
For sure it can't be done from CICS (at least not when I last had my fingers on Cobol under CICS in 1998

/johnny
 
cobolNOR,

You can access two DB2 regions using CICS providing the CICS regions are in a sysplex.

One CICS transaction from one system can call another in another CICS system. You must provide the name of the other CICS system in the transaction call.

Alternatively if your initial program is written for BATCH you can use an External CICS Interface (aka CICS EXCI)to do a similar thing as above.

 
All,
I think CobolNOR may have left us. (s)he joined on 14/09, posted, looked again on 15/09 and hasn't been back since.

Good question though, and I liked Truus answer as I hadn't come across it before.

Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top