Invoking Actions in Response to Events

How to:

Reference:

Actions are RDBMS commands, such as COMMIT WORK, that the adapter issues in response to events in a FOCUS session. Events include the end of a MODIFY or TABLE request, interaction with the terminal, and the end of a FOCUS session.

For DB2, you can make a MODIFY transaction pseudo-conversational by issuing CLOSE and DISCONNECT automatically at all COMMIT points within the MODIFY procedure. Or, by delaying COMMITs until a group of commands is issued, you can combine FOCUS commands and native SQL commands in one Logical Unit of Work.

The SET AUTOaction command allows you to control when the adapter issues actions. Subsequent sections discuss each action.


Top of page

x
Syntax: How to Automatically Invoke Actions in Response to Events
{ENGINE|SQL} [sqlengine] SET action ON event 

where:

sqlengine

Indicates the target RDBMS. Acceptable values are DB2, SQLDBC, SQLIDMS, or SQLORA. Omit if you previously issued the SET SQLENGINE command or to set AUTOCOMMIT ON CRTFORM in a MODIFY procedure.

action

Indicates the action to be taken by the adapter. Valid values are:

AUTOCOMMIT

Issues the SQL command COMMIT WORK or the SQL/DBC command END TRANSACTION. (Teradata implicitly commits each SQL statement individually, so the COMMIT action is redundant.)

AUTOCLOSE

For DB2, is the DB2 Call Attachment Facility (CAF) CLOSE operation.

For Teradata, AUTOCLOSE sponsors a LOGOFF.

For IDMS/SQL and Oracle, AUTOCLOSE is ignored

AUTODISCONNECT

For DB2, severs the connection between the RDBMS and the user's address space.

For Oracle, sponsors a LOGOFF from the Oracle RDBMS.

For Teradata and IDMS/SQL, is ignored.

event

Is the event that triggers the action. Valid values are:

CRTFORM

Is valid only in MODIFY procedures with the AUTOCOMMIT action. Issues a COMMIT before each interaction with the user's terminal. At the end of the MODIFY, the event setting reverts to its value prior to the AUTOCOMMIT ON CRTFORM.

For Teradata, this setting is not needed and is ignored because any MODIFY that does not contain BEGIN TRANSACTION and END TRANSACTION statements implicitly commits each SQL statement individually.

Omit sqlengine from the command. Refer to Maintaining Tables With FOCUS, for more information on MODIFY.

COMMAND

Executes the specified action at the end of a MODIFY procedure, a TABLE request, a Direct SQL Passthru request, or a CALLDB2 subroutine containing embedded SQL.

Note: The adapter does not generate an end-of-MODIFY COMMIT if there is no open Logical Unit of Work.

FIN

Executes the specified action automatically only after the FOCUS session has been terminated by the FOCUS FIN command. To execute the action within the session, you must issue it explicitly. Since you cannot issue CLOSE and DISCONNECT explicitly, this applies to COMMIT only.

COMMIT

Executes the specified action whenever a COMMIT or ROLLBACK is issued either as a native SQL command or because of a current AUTOCOMMIT setting.


Top of page

x
Reference: Usage Notes for SET AUTOaction ON Event

Information Builders