Tivoli Service Desk 6.0 Developer's Toolkit Script Language Reference

Tivoli Service Desk Developer's Toolkit Internals

Return to Main Page


Abort

Description

Exits the TSD Script application immediately.

Syntax

PROCEDURE Abort;

Example

ACTIONS
IF NOT FExists('F:\DATA\MYFILE.DAT') THEN
 WinMessageBox($Desktop,'Error',$MBOK,'I can't live without
               this file');
 Abort;
END;

BreakPoint

Description

Suspends the current function and activates the TSD Script Debugger.

Syntax

PROCEDURE BreakPoint;

Caution: If the TSD Script Interpreter is unable to find the Debugger library file, this statement has no effect.

Notes

The BreakPoint procedure is provided primarily to aid TSD Script programmers in debugging applications. Using the TSD Script Debugger, the programmer may inspect the current state of the application and monitor its progress a statement at a time.

See Also

Tivoli Service Desk 6.0 Developer's Toolkit Script Programming Guide


CallFunction

Description

Calls a function or procedure whose knowledgebase name and function or procedure name are embedded in a string expression.

Syntax

FUNCTION CallFunction (VAL func: STRING [, arg: ANY ...] ): INTEGER;

Cautions

No type checking occurs on the additional arguments to CallFunction. An argument with an inappropriate type may cause unexpected behavior, including premature termination of the application.

CallFunction returns only a success or failure code. Any value returned by the called routine is discarded.

When specifying arguments to be passed to the target function, those arguments must be variables, not values. Otherwise, the TSD Script Parser displays an error message. For example, the following is not valid:

CallFunction ('mykb:myfunc', 1, 'foo');

Instead the user should declare temporary variables to store the values that should be passed to the function :

i:=1;
s:='foo';
CallFunction ('mykb:myfunc', i,s);

The knowledgebase containing the called function must be loaded for CallFunction to work. Typically the knowledgebase is loaded during the normal program startup because it is mentioned in the USES section of one or more knowledgebases. It can also be loaded by passing it on the command line to the TSD Script Interpreter with the /F argument. For example:

KML /F=EA.KBC /F=CUSTOM.KBC

In this example, two knowledgebases were passed to the TSD Script Interpreter in one command. This command line technique can be used to customize an application without altering the original source code.

Argument Notes

Argument Name Description
func A string expression that contains a knowledgebase name and a procedure or function name separated by a colon in the format:kbase.func
arg Zero or more arguments of any type. See the Cautions section for more information about this argument.

Notes

This function is useful for creating special features such as customizable icon bars. For example, you could create a database table of icons and actions. When the user clicks on an icon, the action associated with it is performed. Because the action must be stored in the table as a string, you a method to invoke a TSD Script routine. CallFunction provides this functionality.

CallFunction takes an arbitrary number of arguments that it passes to the called routine.

Example

CallFunction('SERVICES:DISPLAYINFO');

Return Codes

Return Code Description
1 Successful completion.
-1 First argument is unknown. The call aborted without activating the routine because one or more formal parameters could not be bound to the corresponding argument. This usually results from an index-out-of-bounds error in one of the parameters.
-2 The run-time system was unable to find the specified routine.
-3 Insufficient memory.

ErrorFilter

Description

Sets the severity threshold for system error reporting.

Syntax

FUNCTION ErrorFilter [ (VAL level: INTEGER) ] : INTEGER;

Argument Notes

Argument Name Description
level If provided, this argument becomes the new system-wide error reporting threshold.

Caution: Fatal error messages cannot be suppressed.

Notes

In general, TSD Script displays error boxes whenever an error occurs. Each error is assigned one of the predefined error levels:

Return Code Description
0 Fatal error
1 Error
2 Warning
3 Message

The default value of ErrorLevel displays all error levels.

ErrorFilter allows you to set a threshold error level so that errors (other than fatal ones) with levels greater than this threshold are not displayed.

Example

VARIABLES
oldLevel, err: INTEGER;
employee: EmployeeRecord;
ACTIONS
oldLevel := ErrorFilter(2); -- Suppress all warnings.
err := SQLSelectInto('SELECT * FROM EMPLOYEES WHERE SALARY > '
                     & limit, employee);
ErrorFilter(oldLevel);
IF err > 0 THEN ...

Return Codes

Return Code Description
ErrorFilter Returns the previous severity level

SetUnknown

Description

Sets the value of a variable to $Unknown.

Syntax

FUNCTION SetUnknown (REF var: ANY): INTEGER;

Argument Notes

Argument Name Description
var A variable whose value is to be set to $Unknown.

Notes

SetUnknown discards values associated with the indicated variable. Variables with types other than RECORD, as well as members of RECORDs, are set to $Unknown. Lists and arrays are set to zero.

Example

VARIABLES
 r: EmployeeRecord;
ACTIONS
 REPEAT
 IF NOT DataEntryForm(r) THEN
 ExitLoop;
 END;
 StoreRecord(r);
 SetUnknown(r);
 UNTIL FALSE;

Return Codes

Return Code Description
1 No error
-1 No such variable

See Also

Sin


Tivoli Service Desk 6.0 Developer's Toolkit Script Language Reference

Return to Main Page

Copyright