Return Statement

Terminates the execution of a transaction or the simulation of the user executing the current transaction. In conjunction with the execution of a return statement, Silk Performer executes a commit of the transaction unless a rollback was executed before when using Silk Performer's high-level database functions (implicitly, for example, because of a deadlock or explicitly because of a rollback statement in the transaction).

Executing a return statement in a Silk Performer function has the same effect: it terminates the transaction from which the function was called and not only the function itself.

Syntax

Stat = "return" [ ( number | "(" number ")"].
  • If number is 0, the termination status of the transaction is set to OK. The current transaction is terminated.

  • If number is 1, the termination status of the transaction is set to CA (=canceled). The current transaction is terminated.

  • If number is 2, the transaction will not be considered in the result report. The current transaction is terminated and the simulation of the user will be stopped immediately (equivalent to a halt statement).

Example

dcltrans
  transaction TMain
  var
    I : number; 
    a : array [100] of number; 
    badEvent : boolean;
  begin
    ...
    if badEvent then
      rollback;
      return 1
    end;

    I := 1;
    loop
    a[i] := I;
    if I=100 then return end;
      I := I+1
    end;
  end TMain;