Switching Databases

tjk5145

New Member
I have a problem I need some help on. Here is the scenario:

A) I have multiple Progress databases (all same version). I want
to develop a calling program (prog.a) which does some processing
and builds a temp-table.

B) After the temp-table is created I want to swap to another database,
read the temp-table, do some processing (update the database), then
exit.

C) Process B) above will repeat and keep swapping to another database
until my database list (in proga.p) is complete. Then the entire
process exits (is fully completed).

I've tried this:
proga.p: 1) Build temp-table 2) call progb.p
progb.p: 1) Disconnects the current database 2) call progc.p
progc.p: 1) Connect to another database in the shared database list in
proga.p

I've worked around disconnect, connect, and create alias to no avail.

Can someone please shed some light on how this can work?

Thanks!
 
The basic rule is that you can't use a database in the connect procedure; you need to go one level down. So, write a top level procedure which does all the connects and disconnects and, when you have the one you want, run a sub-procedure to actually work on that database.

I would suggest putting the temp-table in a persistent procedure, possibly a super procedure, run from the main controller program. Then, access it from each subprogram via the methods of the PP or SP. The advantage of making it an SP is that you won't have to pass around the handle.

Naturally, the PP/SP should have no database access in it. It should interact only via its methods.
 
Back
Top