BBjConfig::setOptionSetting

Description

In BBj 6.0 and higher, this method sets !OPTIONS values from STBL() functions.

Syntax

Return Value

Method

void

setOptionSetting(string optionName, boolean value)

Parameters

Variable

Description

optionName

Name of !OPTIONS value to be retrieved from STBL

value

Value to set the option to which optionName specifies

Return Value

None.

Remarks

The optionName can be any of the following:

Key

Effect on program

Default value

THROW_UNWINDS

Causes THROW to unwind the program stack in search of an error handler, even if Drop to Console is allowed in public program.

True

ERROR_UNWINDS

Causes program errors to unwind the program stack in search of an error handler, even if Drop to Console is allowed in public program

False

SESSION_PINNING

In BBj 7.0 and higher, toggles session pinning. See also BBjConfig::getOptionSetting.

True

STBL("!OPTIONS","name=true") is equivalent to BBjConfig::setOptionSetting("name",1).

STBL("!OPTIONS", "name=false") is equivalent to BBjConfig::setOptionSetting("name",0).

Example 1

BBjAPI().getConfig().setOptionSetting("SESSION_PINNING", 0)
BBjAPI().getConfig().setOptionSetting("SESSION_PINNING", 1)

Example 2 (using the ERROR_UNWINDS option in combination with SETERR)

seterr errtrap
setesc esctrap
BBjAPI().getConfig().setOptionSetting("ERROR_UNWINDS", 1)

class public foo
    method public void bar()
        #baz()
    methodend
    
    method public void baz()
        a=40
        b=0
        rem now let the next line fail:
        c=a/b
    methodend

classend

a!=new foo()
a!.bar()
errtrap:
    print "Error ",err,": ",errmes(-1)
    input "Press CR to see stack (*)",*
    sw! = new java.io.StringWriter()
    pw! = new java.io.PrintWriter(sw!)
    bbjapi().getLastBBjException().printStackTrace(pw!)
    stack$ = sw!.toString()
    print stack$
    stop
esctrap:
    print "esctrap"
stop

See Also

BBjAPI

BBjConfig

STBL Formats - BBj

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.