Consultor Eletrônico



Kbase P70459: How to run a procedure against an 8.3E and a 9.1D databases
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/4/2004
Status: Unverified

GOAL:

How to run a procedure against an 8.3E and a 9.1D databases with the same schema?

FIX:

The following is a step by step procedure that demosntrate how to do this. It is assumed that the application code as well as the database schema trigers qualify table and field references with the logical database names:

In this example, the same code runs simultaneously against a version 9.1D database (Master) and a version 8.3E (Plant) to pull records from the plant database to the Master database if they are not already there:

1. Use the 9.1D data dictionary to create an empty 'Master' database.
2. Use the the 8.3E data dictionary to dump the .df files of the 8.3E 'Sports' database.
3. Use the 9.1D data dictionary to load these .df files into the 'Master'
4. Create a procedure to accesses both and update the 'Master'. Note in this procedure we DISABLED the triggers for the 'Master' because the schema trigger for the sports database are not database name qualified. If the schema triggers for the Master and Plant databases are database name qualified, then there will be no need to disable any triggers:

/* Procedure Name: MasterAndPlant.p */
DISABLE TRIGGERS FOR LOAD OF Master.Customer.
FOR EACH Plant.Customer:
FIND FIRST Master.Customer WHERE Plant.Customer.Cust-Num =
Master.Customer.Cust-Num NO-ERROR.
IF NOT AVAILABLE (Master.Customer) THEN DO:
CREATE Master.Customer.
BUFFER-COPY Plant.Customer TO Master.Customer.
END.
END.

5. Create a procedure to connect to both and compile the above procedure:

/* Procedure Name: ConnectToBothAndCompile.p */
CONNECT master -ld 'Master' -H 'pcyshanshi' -N 'tcp' -S 'master'.
CONNECT sports -ld 'Plant' -H 'yshanshi2000' -N 'tcp' -S 'sports83e'.
COMPILE MasterAndPlant.p SAVE.

6. Creat a procedure to connect to both and run the application:

/* Procedure Name: RunProcedureAgainstBoth.p */
CONNECT master -ld 'Master' -H 'pcyshanshi' -N 'tcp' -S 'master'.
CONNECT sports -ld 'Plant' -H 'yshanshi2000' -N 'tcp' -S 'sports83e'.
RUN MasterAndPlant.r.

7. Test the success of the code by running the following code from the procedure editor:
FOR EACH Master.Customer NO-LOCK:
DISPLAY Master.Customer.Cust-Num Master.Customer.Name.
END.