BEHAVIOR

Instructs OpenESQL to properly match your COBOL cursors with the database you are using, thus maximizing database cursor performance. BEHAVIOR makes use of multiple primitive directives and associates a default value for each primitive directive depending on the target DBMS. You can also override the default setting of any primitive directive.
Note:
  • If you don't specify any BEHAVIOR primitive directives, and you also accept the default primitive directive values listed in the relevant table in the Default Primitive Directives section later in this topic, the TARGETDB directive is not required; however, you must specify TARGETDB if you want to use different default values for any primitive directive.
  • Setting the BEHAVIOR directive can also affect the SQL types returned when using Dynamic SQL. See the DESCRIBE Statement topic for more information.
  • Because the JDBC API does not support prefetching, very limited support is provided for BEHAVIOR primitive directives with DBMAN=JDBC. See DBMAN Directive Settings for more information.

Syntax:

BEHAVIOR={OPTIMIZED | UNOPTIMIZED | ANSI | MAINFRAME } [primitivedirective [value]]...

Parameters:

OPTIMIZED Enables OpenESQL to optimize ambiguous cursor declarations; enhances the access speed
UNOPTIMIZED Provides backward compatibility with earlier Micro Focus products, where ambiguous cursors are both updateable and scrollable
ANSI Enables OpenESQL to work like the ANSI standard; enhances the access speed
MAINFRAME Synonym for OPTIMIZED
primitivedirective Optional directives that enable the fine-tuning of BEHAVIOR

Properties:

Default: BEHAVIOR=OPTIMIZED

Scope:

Used at compile time: Yes
Behavior at run time: N/A

See Scope - OpenESQL SQL Compiler Directive Options for more information.

Default Primitive Directives:

Table 1. Default Behavior Primitive Table for SQL Server:
BEHAVIOR = Primitive Default Values OPTIMIZED, MAINFRAME ANSI
AUTOFETCH ON OFF
DEF_CURSOR RO UPD
RO_CURSOR FORWARD or IC_FH FORWARD or IC_FH
PF_RO_CURSOR 8 1
IC_FH_ISOLATION UR UR
UPD_CURSOR DYNAMIC DYNAMIC
PF_UPD_CURSOR 8 8
UPD_CONCURRENCY LOCK LOCK
ISOLATION CR CR
Table 2. Default Behavior Primitive Table for Other DBMSs:
BEHAVIOR = Primitive Default Values OPTIMIZED, MAINFRAME ANSI
AUTOFETCH ON OFF
DEF_CURSOR RO UPD
RO_CURSOR FORWARD FORWARD
PF_RO_CURSOR 8 8
UPD_CURSOR KEYSET KEYSET
PF_UPD_CURSOR 8 8
UPD_CONCURRENCY LOCK LOCK
ISOLATION CR CR

For more information on using BEHAVIOR to migrate your COBOL cursors, see the topic COBOL Program Migration Support.

You can fine tune the BEHAVIOR directive and override these default settings by providing alternate values for primitive directives. If you do this, you must set the TARGETDB directive.

Comments:

  • You can change the default setting to either ANSI or UNOPTIMIZED using the OpenESQL Configuration Utility. However, when the BEHAVIOR directive is specified in program code, project settings, or in a compiler directive file, the specified parameter overrides the default setting.
  • Setting this directive can also affect the SQL types returned when using Dynamic SQL. See the DESCRIBE Statement topic for more information.
  • OpenESQL sets default values for primitive directives depending on the value of BEHAVIOR and your target database. See the topic Primitive Directives for more information.