Tivoli Service Desk 6.0 Developer's Toolkit Script Language Reference
Return to Main Page
Exits the TSD Script application immediately.
PROCEDURE Abort;
ACTIONS IF NOT FExists('F:\DATA\MYFILE.DAT') THEN WinMessageBox($Desktop,'Error',$MBOK,'I can't live without this file'); Abort; END;
Suspends the current function and activates the TSD Script Debugger.
PROCEDURE BreakPoint;
Caution: If the TSD Script Interpreter is unable to find the Debugger library file, this statement has no effect.
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.
Tivoli Service Desk 6.0 Developer's Toolkit Script Programming Guide
Calls a function or procedure whose knowledgebase name and function or procedure name are embedded in a string expression.
FUNCTION CallFunction (VAL func: STRING [, arg: ANY ...] ): INTEGER;
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 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. |
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.
CallFunction('SERVICES:DISPLAYINFO');
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. |
Sets the severity threshold for system error reporting.
FUNCTION ErrorFilter [ (VAL level: INTEGER) ] : INTEGER;
Argument Name | Description |
level | If provided, this argument becomes the new system-wide error reporting threshold. |
Caution: Fatal error messages cannot be suppressed.
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.
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 Code | Description |
ErrorFilter | Returns the previous severity level |
Sets the value of a variable to $Unknown.
FUNCTION SetUnknown (REF var: ANY): INTEGER;
Argument Name | Description |
var | A variable whose value is to be set to $Unknown. |
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.
VARIABLES r: EmployeeRecord;
ACTIONS REPEAT IF NOT DataEntryForm(r) THEN ExitLoop; END; StoreRecord(r); SetUnknown(r); UNTIL FALSE;
Return Code | Description |
1 | No error |
-1 | No such variable |
Sin
Tivoli Service Desk 6.0 Developer's Toolkit Script Language Reference