Problem:
Trying to connect remotely to another AIX machine where DB2 is involved with both systems and one COBOL application calls a second COBOL application caused a runtime error, SQL Connect error 722 Connection to DB is not permitted within a logical unit of work when Connect Type 1 is in use.
Main module, A, calls module B dynamically.
Module A accesses local data base. It has SQLCONNECT and BIND that are successful.
Module A requires lookup from Module B which must access a remote Data Base.
This access from Module B fails on the "connect" giving the error at the top.
Resolution:
The CONNECT(2) - db2 directive was the key element in getting successful interfacing between two modules operating on two diffent databases. The SET CONNECTION statement was required for switching the work space state from dormant to active with every change of db use.
#ServerExpress
#COBOL
#MFDS
#MainframeExpressandMFE
#Enterprise
#EnterpriseDeveloper