Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Format

More

Example

TRANSACTION_HANDLE

on-error

RDB/VMS Relational Database Operator ROLLBACK — VMS RDB_4.0B

 Terminates a transaction and undoes all changes that have been made
 to the database since the program's most recent START_TRANSACTION
 statement.  The ROLLBACK statement also closes all open streams and
 releases all locks.  The ROLLBACK statement affects both data
 manipulation and data definition statements.

 Example:

      RDO> START_TRANSACTION READ_WRITE
      RDO> DEFINE FIELD LOCATION_CODE DATATYPE TEXT SIZE 5.
      RDO> ! Oops, wrong size!
      RDO> ROLLBACK
      RDO> START_TRANSACTION READ_WRITE
      RDO> DEFINE FIELD LOCATION_CODE DATATYPE TEXT SIZE 7.
      RDO> COMMIT

Additional information available:

FormatMoreExample

Format

 ROLLBACK ──┬───────────────────────>──────────┬─┬────────────────┬───>
            └─> (
T

R

A

N

S

A

C

T

I

O

N

H

A

N

D

L

E
──> var) ──┘ └──> on-error ───┘

Additional information available:

TRANSACTION_HANDLE

on-error

TRANSACTION_HANDLE

 A keyword followed by a host language variable.  A transaction handle
 identifies each instance of a database attach.  If you do not declare
 the transaction handle explicitly, Rdb/VMS attaches an internal
 identifier to the transaction.

 In Callable RDO, use !VAL as a marker for host language variables.

 You can put parentheses around the host language variable name.

 Normally, you do not need to use this argument.  The ability to
 declare a transaction handle is provided for compatibility with other
 database products and future releases of Rdb/VMS.

on-error

 The ON ERROR clause, which specifies a host language statement to be
 performed if an Rdb/VMS error occurs.  For more details, request HELP
 on ON_ERROR.

More

 If you have invoked a database, you have the necessary privileges to
 use the ROLLBACK statement.

Example

 Roll back changes made during a transaction with a COBOL program:

 GET-ID-NUMBER.
       DISPLAY "Enter employee ID number:  "
          WITH NO ADVANCING.
       ACCEPT EMPLOYEE-ID.
 CHANGE-SALARY.
       DISPLAY "Enter new salary amount:  "
          WITH NO ADVANCING.
       ACCEPT SALARY-AMOUNT.

 &RDB&   START_TRANSACTION READ_WRITE
 &RDB&    FOR S IN SALARY_HISTORY WITH
 &RDB&       E.EMPLOYEE-ID = EMPLOYEE-ID
 &RDB&          MODIFY USING
 &RDB&             S.SALARY-AMOUNT = SALARY-AMOUNT
 &RDB&          END-MODIFY
 &RDB&   END-FOR

       DISPLAY EMPLOYEE-ID, SALARY-AMOUNT.
       DISPLAY "Is this figure correct? [Y or N]  "
          WITH NO ADVANCING.
       ACCEPT ANSWER.
       IF ANSWER = "Y" THEN
 &RDB&   COMMIT
       ELSE
 &RDB&   ROLLBACK
       DISPLAY "Please enter the new salary amount again."
       GO TO CHANGE-SALARY.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026