C Copyright © Oracle Corporation 1995. All Rights Reserved. C This subroutine is called by the program SQL$DIST_TRANS.FOR. It C calls SQL module procedures to transfer an employee record from the C west database to the east database. Both the west and the east databases C are Oracle Rdb databases. SUBROUTINE transfer_east(in_tid) IMPLICIT NONE CHARACTER employee_id*5,last_name*14,first_name*10, 1 middle_initial*1,address_data_1*25,address_data_2*20, 2 city*20,state*2,postal_code*5,ascii_date*23, 3 sex*1,status_code*1,birthday*8 C Declare the distributed TID and SQLCODE. INTEGER*4 in_tid(4),sqlcode C Declare the context structure. STRUCTURE /CONTXT_STRUCT/ INTEGER*4 VERSION INTEGER*4 TYPE INTEGER*4 LENGTH INTEGER*4 tid(4) INTEGER*4 END END STRUCTURE RECORD /CONTXT_STRUCT/ context C Initialize the context structure. context.version = 1 context.type = 1 context.length = 16 context.tid(1) = in_tid(1) context.tid(2) = in_tid(2) context.tid(3) = in_tid(3) context.tid(4) = in_tid(4) context.end = 0 C Prompt the user for input and accept the input. PRINT *, ' ' TYPE 100 100 FORMAT ('$',' Please enter the ID of the employee: ') ACCEPT 120, employee_id 120 FORMAT (A) C Call the SQL module procedure START_2DB to start a distributed C transaction. CALL start_2db(sqlcode,context) IF (SQLCODE .LT. 0) CALL sql$dist_trans_error(in_tid,sqlcode) PRINT *, ' Fetching the record in 2pcwest database' C Call the SQL module procedure SELECT_WEST to select the employee record C from the west database. CALL select_west(sqlcode,employee_id,last_name,first_name, 1 sex,middle_initial,address_data_1,address_data_2, 2 city,state,postal_code,birthday,status_code,context) IF (SQLCODE .LT. 0) CALL sql$dist_trans_error(in_tid,sqlcode) IF (SQLCODE .EQ. 100) CALL sql$dist_trans_error(in_tid,sqlcode) C Call the SQL module procedure DELETE_WEST to delete the employee record C from the west database. PRINT *, ' Deleting the row in 2pcwest database' CALL delete_west(sqlcode,employee_id,context) IF (SQLCODE .LT. 0) CALL sql$dist_trans_error(in_tid,sqlcode) C Call the SQL module procedure INSERT_EAST to store the employee record C in the east database. PRINT *, ' Storing the row in 2pceast database' CALL insert_east(sqlcode,employee_id,last_name,first_name,sex, 1 middle_initial,address_data_1,address_data_2, 2 city,state,postal_code,birthday,status_code,context) IF (SQLCODE .LT. 0) CALL sql$dist_trans_error(in_tid,sqlcode) RETURN END