You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Aion Development System<br />
<strong>Language</strong> <strong>Reference</strong><br />
PLATINUM technology, inc.<br />
555 Twin Dolphin Drive, Suite 400<br />
Redwood City, CA 94065<br />
DC0429 (415) 591-8200
.................................................................................................................................<br />
Title and publication number<br />
<strong>Language</strong> <strong>Reference</strong><br />
DC0429<br />
.................................................................................................................................<br />
Product version<br />
This manual accompanies the 7.0 Release of <strong>AionDS</strong>.<br />
.................................................................................................................................<br />
Copyright information<br />
© 1991-1996 by PLATINUM technology, inc. All rights reserved.<br />
.................................................................................................................................<br />
Notices<br />
No part of this document may be reproduced in any form or by any means, electronic,<br />
mechanical, photocopying, recording, or otherwise, without the express permission of<br />
PLATINUM technology, inc.<br />
RESTRICTED RIGHTS LEGEND. Use, duplication, or disclosure by the U.S.<br />
Government is subject to restrictions as set forth in a contract with PLATINUM technology,<br />
inc. (formerly Trinzic Corporation, formerly Aion Corporation/AICorp, Inc.) and, if<br />
applicable, subpar. (c) (1) (ii) of the Rights in Technical Data and Computer Software clause<br />
at DFARS 252.227-7013 or subpars. (c)(1) and (2) of the Commercial Computer Software -<br />
Restricted Rights clause at 48 CFR 52.227-19, as applicable. The contractor/manufacturer is<br />
PLATINUM technology, inc., 555 Twin Dolphin Drive, Suite 400, Redwood City, CA<br />
94065.<br />
Additional copies of this document can be ordered from PLATINUM technology, inc.<br />
Contact PLATINUM technology, inc. for prices on bulk orders and fees for reproduction<br />
licenses.<br />
.................................................................................................................................<br />
Trademarks<br />
AION, Forest & Trees, and KBMS are registered trademarks, and InfoHub,<br />
InfoPump, and INTELLECT are trademarks of PLATINUM technology, inc.<br />
All other products or other names referenced are the trademarks, registered trademarks, or<br />
products of the respective manufacturers.
Preface How To Use This Manual<br />
Table of Contents<br />
Chapter 1 Type Definition <strong>Language</strong><br />
<strong>AionDS</strong> data types....................................................................................................... 1-2<br />
Basic data types ............................................................................................. 1-3<br />
Structured data types...................................................................................... 1-4<br />
Lists and sets ..................................................................................... 1-4<br />
Records.............................................................................................. 1-6<br />
Files ................................................................................................... 1-7<br />
Constrained data types ................................................................................... 1-8<br />
User-input attributes .................................................................................................. 1-10<br />
Checklength attribute .................................................................................... 1-12<br />
Noempty attribute.......................................................................................... 1-13<br />
Nomenu attribute .......................................................................................... 1-14<br />
Notrim attribute .............................................................................................1-15<br />
Nounknown attribute ..................................................................................... 1-16<br />
Text attribute................................................................................................. 1-17<br />
Uppercase attribute....................................................................................... 1-18<br />
Masks........................................................................................................... 1-19<br />
Date masks ...................................................................................... 1-21<br />
Integer masks................................................................................... 1-23<br />
Real masks ...................................................................................... 1-24<br />
String masks .................................................................................... 1-25<br />
Time masks...................................................................................... 1-26<br />
User-input attribute examples........................................................................ 1-28<br />
Output argument attribute.......................................................................................... 1-30<br />
File attributes............................................................................................................. 1-31<br />
Access method ............................................................................................. 1-32<br />
Textual and non-textual files.......................................................................... 1-34<br />
Variable length records ................................................................................. 1-35<br />
Certainty information..................................................................................... 1-36<br />
Table of Contents iii
iv Table of Contents<br />
Textual file structures ................................................................................................ 1-37<br />
Field and record sizes ................................................................................... 1-38<br />
Booleans .......................................................................................... 1-39<br />
Dates ............................................................................................... 1-40<br />
Integers............................................................................................ 1-40<br />
Lists and sets ................................................................................... 1-41<br />
Real numbers................................................................................... 1-41<br />
Strings.............................................................................................. 1-42<br />
Times ............................................................................................... 1-42<br />
Textual file example ...................................................................................... 1-44<br />
Non-textual file structures .......................................................................................... 1-45<br />
Field and record sizes ................................................................................... 1-46<br />
Booleans .......................................................................................... 1-48<br />
Dates ............................................................................................... 1-48<br />
Integers............................................................................................ 1-48<br />
Lists and sets ................................................................................... 1-49<br />
Real numbers................................................................................... 1-49<br />
Strings.............................................................................................. 1-49<br />
Times ............................................................................................... 1-50<br />
Numeric field attributes .................................................................................1-51<br />
Fixed attribute .................................................................................. 1-51<br />
Packed attribute ............................................................................... 1-52<br />
Textual attribute................................................................................ 1-52<br />
Unsigned attribute ............................................................................ 1-52<br />
Zoned attribute ................................................................................. 1-53<br />
No certainty information attribute...................................................................1-54<br />
Non-textual file example................................................................................ 1-57
Chapter 2 TDL Syntax<br />
Type Definition <strong>Language</strong> syntax................................................................................. 2-2<br />
Boolean .......................................................................................................... 2-3<br />
Date................................................................................................................ 2-5<br />
File ................................................................................................................. 2-7<br />
Integer .......................................................................................................... 2-10<br />
Instance........................................................................................................ 2-13<br />
List................................................................................................................ 2-14<br />
Object_Pointer ..............................................................................................2-17<br />
Pointer .......................................................................................................... 2-20<br />
Real.............................................................................................................. 2-21<br />
Record.......................................................................................................... 2-25<br />
Set................................................................................................................ 2-27<br />
String............................................................................................................ 2-30<br />
Time ............................................................................................................. 2-33<br />
Constraints in TDL..................................................................................................... 2-35<br />
Numeric constraints ...................................................................................... 2-36<br />
String constraints .......................................................................................... 2-37<br />
TDL summary............................................................................................................ 2-38<br />
Table of Contents v
Chapter 3 Knowledge Definition <strong>Language</strong><br />
Expressions and operators .......................................................................................... 3-2<br />
Expressions .................................................................................................... 3-3<br />
Boolean expressions .......................................................................... 3-3<br />
Numeric expressions .......................................................................... 3-4<br />
String expressions.............................................................................. 3-4<br />
List and set expressions ..................................................................... 3-5<br />
Record expressions............................................................................ 3-6<br />
Pointer expressions............................................................................ 3-6<br />
Relational operators........................................................................................ 3-7<br />
Real number comparisons................................................................ 3-10<br />
Arithmetic operators...................................................................................... 3-12<br />
Logical operators .......................................................................................... 3-13<br />
Selection operators ....................................................................................... 3-14<br />
List and set operators ....................................................................... 3-14<br />
File, record, and field operators ........................................................3-15<br />
Class references .............................................................................. 3-16<br />
Instance references.......................................................................... 3-17<br />
Slot references ................................................................................. 3-19<br />
Premise evaluation........................................................................... 3-21<br />
Flow control............................................................................................................... 3-22<br />
Inference rules...........................................................................................................3-23<br />
Message passing....................................................................................................... 3-26<br />
Agenda statements.................................................................................................... 3-28<br />
Sourcing options for agenda statements........................................................ 3-30<br />
Processing options for agenda statements ....................................................3-32<br />
Combining sourcing and processing options.................................................. 3-34<br />
Using agenda statements in rules and functions............................................ 3-36<br />
Sourcing options for functions and independent states......................3-36<br />
KDL in Facts and Default properties .......................................................................... 3-39<br />
Constraints ...................................................................................................3-40<br />
Assignments ................................................................................................. 3-42<br />
vi Table of Contents
Chapter 4 KDL Statement Syntax<br />
KDL statement syntax ................................................................................................. 4-9<br />
& (Concatenate) ........................................................................................................ 4-16<br />
* (Multiply) ................................................................................................................. 4-17<br />
** (Exponent)............................................................................................................. 4-18<br />
+ (Add)...................................................................................................................... 4-19<br />
- (Subtract) ................................................................................................................ 4-20<br />
/ (Divide).................................................................................................................... 4-21<br />
/* */ (Comment) ......................................................................................................... 4-22<br />
ABS........................................................................................................................... 4-23<br />
Add ........................................................................................................................... 4-24<br />
AES........................................................................................................................... 4-25<br />
AES Abort ................................................................................................................. 4-26<br />
AES Break ................................................................................................................ 4-27<br />
AES Chain................................................................................................................. 4-28<br />
AES Error.................................................................................................................. 4-30<br />
AES Exitcode ............................................................................................................ 4-31<br />
AES Profile................................................................................................................ 4-32<br />
AES Title................................................................................................................... 4-33<br />
AES Tracelevel.......................................................................................................... 4-34<br />
AES Writelog............................................................................................................. 4-36<br />
AES Writetrace.......................................................................................................... 4-37<br />
AES_CF.................................................................................................................... 4-38<br />
And ........................................................................................................................... 4-39<br />
Append...................................................................................................................... 4-41<br />
ArcTan ...................................................................................................................... 4-42<br />
Ask............................................................................................................................ 4-43<br />
ASort......................................................................................................................... 4-47<br />
BestValue.................................................................................................................. 4-50<br />
Bin............................................................................................................................. 4-51<br />
Break ........................................................................................................................ 4-52<br />
BreakIf ...................................................................................................................... 4-53<br />
ByName .................................................................................................................... 4-54<br />
Certainty.................................................................................................................... 4-56<br />
CF............................................................................................................................. 4-57<br />
Clear ......................................................................................................................... 4-58<br />
CM ............................................................................................................................ 4-60<br />
CM Add..................................................................................................................... 4-65<br />
CM Beep ................................................................................................................... 4-68<br />
CM Delete ................................................................................................................. 4-69<br />
CM Error ................................................................................................................... 4-71<br />
CM GetCoordinates................................................................................................... 4-73<br />
Table of Contents vii
viii Table of Contents<br />
CM GetCursor ........................................................................................................... 4-74<br />
CM GetDimensions ................................................................................................... 4-75<br />
CM GetInfo................................................................................................................ 4-76<br />
CM GetObjectInfo...................................................................................................... 4-78<br />
CM GetOutlineColor .................................................................................................. 4-79<br />
CM GetPosition ......................................................................................................... 4-81<br />
CM GetStatus............................................................................................................ 4-82<br />
CM GetText............................................................................................................... 4-84<br />
CM GetTextColor ...................................................................................................... 4-85<br />
CM GetTitleColor.......................................................................................................4-87<br />
CM GetTitlePosition................................................................................................... 4-89<br />
CM GetWindow ......................................................................................................... 4-90<br />
CM GetWindowList.................................................................................................... 4-93<br />
CM GetWord ............................................................................................................. 4-94<br />
CM PopUp................................................................................................................. 4-95<br />
CM SetCursor ........................................................................................................... 4-97<br />
CM SetDimensions.................................................................................................... 4-98<br />
CM SetOutlineColor................................................................................................... 4-99<br />
CM SetPosition........................................................................................................ 4-101<br />
CM SetTextColor..................................................................................................... 4-102<br />
CM SetTitleColor ..................................................................................................... 4-104<br />
CM SetTitlePosition................................................................................................. 4-106<br />
CM System ............................................................................................................. 4-107<br />
COS........................................................................................................................ 4-111<br />
Create ..................................................................................................................... 4-112<br />
CSort....................................................................................................................... 4-115<br />
CurrentDate............................................................................................................. 4-116<br />
CurrentTime ............................................................................................................ 4-117<br />
CurrentValue ........................................................................................................... 4-118<br />
Date ........................................................................................................................ 4-119<br />
Date (Integer) .......................................................................................................... 4-120<br />
Date (Months) ......................................................................................................... 4-121<br />
Date (Record).......................................................................................................... 4-122<br />
Date (String)............................................................................................................ 4-123<br />
Date (Weekday) ...................................................................................................... 4-124<br />
Date (Yearday)........................................................................................................ 4-125<br />
Date (Years)............................................................................................................ 4-126<br />
DBMS ..................................................................................................................... 4-127<br />
Delete (from list or set) ............................................................................................ 4-131<br />
Delete (instance) ..................................................................................................... 4-133<br />
Difference................................................................................................................ 4-135<br />
DIV.......................................................................................................................... 4-136
DSort....................................................................................................................... 4-137<br />
Exists ...................................................................................................................... 4-140<br />
ExitState.................................................................................................................. 4-142<br />
EXP......................................................................................................................... 4-144<br />
FinalValue ............................................................................................................... 4-145<br />
First......................................................................................................................... 4-146<br />
For (class iteration).................................................................................................. 4-147<br />
For (direct iteration) ................................................................................................. 4-149<br />
For (explicit iteration) ............................................................................................... 4-151<br />
For (implicit iteration) ............................................................................................... 4-153<br />
ForwardChain.......................................................................................................... 4-155<br />
Function .................................................................................................................. 4-157<br />
Graph...................................................................................................................... 4-159<br />
Group...................................................................................................................... 4-161<br />
HEX ........................................................................................................................ 4-163<br />
If.............................................................................................................................. 4-164<br />
Ifmatch .................................................................................................................... 4-168<br />
Includes................................................................................................................... 4-174<br />
Index ....................................................................................................................... 4-175<br />
Intersection.............................................................................................................. 4-176<br />
Last......................................................................................................................... 4-177<br />
Length..................................................................................................................... 4-178<br />
LN ........................................................................................................................... 4-179<br />
Loop........................................................................................................................ 4-180<br />
Max......................................................................................................................... 4-181<br />
Message ................................................................................................................. 4-182<br />
Min.......................................................................................................................... 4-183<br />
MOD ....................................................................................................................... 4-184<br />
NameOf................................................................................................................... 4-185<br />
Not .......................................................................................................................... 4-187<br />
Num ........................................................................................................................ 4-188<br />
Or............................................................................................................................ 4-189<br />
Parameter ............................................................................................................... 4-191<br />
Process................................................................................................................... 4-193<br />
ReadStr................................................................................................................... 4-194<br />
Report ..................................................................................................................... 4-199<br />
Return ..................................................................................................................... 4-200<br />
Round ..................................................................................................................... 4-202<br />
Rule ........................................................................................................................ 4-203<br />
SelectAll .................................................................................................................. 4-204<br />
SelectOne ............................................................................................................... 4-205<br />
Send (to class) ........................................................................................................ 4-207<br />
Table of Contents ix
x Table of Contents<br />
Send (to instance) ................................................................................................... 4-209<br />
Send Up .................................................................................................................. 4-212<br />
Set .......................................................................................................................... 4-214<br />
SIN.......................................................................................................................... 4-215<br />
Size......................................................................................................................... 4-216<br />
Slot..........................................................................................................................4-217<br />
SourceValue............................................................................................................ 4-219<br />
SQR........................................................................................................................ 4-220<br />
SQRT...................................................................................................................... 4-221<br />
State ....................................................................................................................... 4-222<br />
Str (from Booleans) ................................................................................................. 4-224<br />
Str (from dates and times) ....................................................................................... 4-226<br />
Str (from integers) ................................................................................................... 4-229<br />
Str (from real numbers) ........................................................................................... 4-231<br />
Str (with strings) ...................................................................................................... 4-234<br />
Substring................................................................................................................. 4-236<br />
Time........................................................................................................................ 4-237<br />
Trunc....................................................................................................................... 4-238<br />
Union....................................................................................................................... 4-239<br />
Unknown ................................................................................................................. 4-240<br />
With.........................................................................................................................4-242<br />
WriteStr................................................................................................................... 4-243<br />
XOR........................................................................................................................ 4-246<br />
KDL syntax summary by data type .......................................................................... 4-247<br />
Numeric, string, Boolean, date, and time data types.................................... 4-248<br />
Integers and reals ....................................................................................... 4-249<br />
Strings ........................................................................................................ 4-251<br />
Booleans..................................................................................................... 4-252<br />
Dates and times.......................................................................................... 4-253<br />
Lists............................................................................................................ 4-254<br />
Sets ............................................................................................................ 4-255<br />
Certainty sets.............................................................................................. 4-256<br />
Summary of additional KDL statement syntax.......................................................... 4-257<br />
Control statements...................................................................................... 4-258<br />
Agenda statements ..................................................................................... 4-259<br />
Object processing statements ..................................................................... 4-260<br />
Consultation monitor statements ................................................................. 4-261<br />
AES statements.......................................................................................... 4-263<br />
Other statements ........................................................................................ 4-264
Chapter 5 Type Substitution <strong>Language</strong><br />
Properties that accept TSL .......................................................................................... 5-2<br />
Displaying plain text..................................................................................................... 5-4<br />
Displaying simple parameter and slot values................................................................ 5-5<br />
Associating text with parameters and slots...................................................... 5-7<br />
String values................................................................................................... 5-9<br />
Integer values ...............................................................................................5-11<br />
Displaying numbers in hexadecimal and binary................................. 5-13<br />
Real values................................................................................................... 5-15<br />
Date values................................................................................................... 5-19<br />
Time values .................................................................................................. 5-23<br />
Boolean values ............................................................................................. 5-26<br />
Associating Text With Booleans........................................................5-27<br />
Displaying slot values ................................................................................................ 5-29<br />
Displaying values from multiple instances.................................................................. 5-31<br />
Using Boolean criteria to display instances.................................................... 5-33<br />
Displaying pointer values........................................................................................... 5-34<br />
Displaying slot values using pointers............................................................. 5-35<br />
Displaying lists or sets of pointers .................................................................5-36<br />
Displaying instances from multiple classes.................................................... 5-38<br />
Displaying unknown pointers......................................................................... 5-39<br />
Displaying lists and sets ............................................................................................ 5-40<br />
Displaying entire lists and sets in default format ............................................ 5-41<br />
Individual elements of lists and sets ..............................................................5-43<br />
Multiple elements of lists and sets................................................................. 5-45<br />
Lists or sets of lists, sets, and records........................................................... 5-47<br />
Displaying records..................................................................................................... 5-49<br />
Using a record field to index into a list or set ................................................. 5-51<br />
Using functions in TSL............................................................................................... 5-52<br />
Sending messages to classes and instances from TSL.............................................. 5-55<br />
Setting up uniform defaults and headers.................................................................... 5-60<br />
Summary of TSL substitution..................................................................................... 5-62<br />
Simple parameter values............................................................................... 5-63<br />
Slot values .................................................................................................... 5-64<br />
Values from more than one instance ............................................................. 5-65<br />
Pointer values............................................................................................... 5-66<br />
Instances from multiple classes..................................................................... 5-67<br />
Lists and sets................................................................................................ 5-68<br />
Records ........................................................................................................ 5-69<br />
Using functions ............................................................................................. 5-70<br />
Sending messages........................................................................................ 5-71<br />
Table of Contents xi
Chapter 6 TSL Commands<br />
TSL command syntax.................................................................................................. 6-5<br />
% (percent substitution operator) ................................................................................. 6-9<br />
%AES_PAGENUM (current page number) ................................................................ 6-10<br />
%CURRENT (current instance) ................................................................................. 6-11<br />
%CURRENTCLASS (current class)........................................................................... 6-12<br />
%CURRENTDATE (current date) ..............................................................................6-14<br />
%CURRENTTIME (current time) ............................................................................... 6-15<br />
%INDEX (element number in a list or set).................................................................. 6-16<br />
Side-by-side display of list or set elements........................................ 6-17<br />
%IS (substitution operator) ........................................................................................6-20<br />
%NAMEOF (name of an instance)............................................................................. 6-22<br />
%UP (method in parent class) ................................................................................... 6-24<br />
&% (display percent sign) ..........................................................................................6-26<br />
&& (display ampersand) ............................................................................................ 6-27<br />
&( (display opening parenthesis)............................................................................... 6-28<br />
&) (display closing parenthesis) ................................................................................ 6-29<br />
&*/ (close comment) .................................................................................................. 6-30<br />
&. (display period)...................................................................................................... 6-31<br />
&/* (begin comment).................................................................................................. 6-32<br />
&: (display colon)....................................................................................................... 6-33<br />
&< (display opening angle bracket)............................................................................6-34<br />
&> (display closing angle bracket) ............................................................................. 6-35<br />
& BLK (mark a block of text)...................................................................................... 6-36<br />
&BM (bottom margin) ................................................................................................6-37<br />
&BR (line break) ........................................................................................................ 6-39<br />
&C (center line) ......................................................................................................... 6-40<br />
&DDF (date default format)........................................................................................ 6-41<br />
&EMP (empty lists, sets, or classes).......................................................................... 6-44<br />
&EMPTBL (empty table)............................................................................................ 6-45<br />
&ESC (send escape sequence)................................................................................. 6-46<br />
&FI (fill mode)............................................................................................................ 6-47<br />
&FOOTER (set footer)............................................................................................... 6-49<br />
&IDF (integer default format) ..................................................................................... 6-51<br />
&INCLUDE (insert text from a file) ............................................................................. 6-54<br />
&J (justify mode)........................................................................................................6-56<br />
&LI (left indent).......................................................................................................... 6-58<br />
&LM (left margin).......................................................................................................6-60<br />
&LN (line numbers).................................................................................................... 6-61<br />
< (text in the left margin) ....................................................................................... 6-63<br />
&MSG (substitute a message)................................................................................... 6-65<br />
&N (number pages) ................................................................................................... 6-66<br />
xii Table of Contents
&PG (eject page).......................................................................................................6-67<br />
&RDF (real default format)......................................................................................... 6-68<br />
&RI (right indent) .......................................................................................................6-73<br />
&RM (right margin) .................................................................................................... 6-74<br />
&RT (text in right margin)........................................................................................... 6-75<br />
&SEND (send a message to an object)...................................................................... 6-77<br />
&SK (skip lines).........................................................................................................6-81<br />
&SPC (insert spaces) ................................................................................................ 6-82<br />
&SSPC (set spaces in fill, justify, and table modes) ...................................................6-83<br />
&STAB (set tabs) ...................................................................................................... 6-84<br />
&TAB (Move to next tab) ........................................................................................... 6-85<br />
&TB (table mode) ......................................................................................................6-86<br />
&TBL (table).............................................................................................................. 6-88<br />
&TDF (time default format) ........................................................................................ 6-96<br />
&TITLE (set title) ....................................................................................................... 6-99<br />
&TM (top margin) .................................................................................................... 6-101<br />
&UND (unknown values).......................................................................................... 6-103<br />
&UNDPTR (unknown pointer).................................................................................. 6-105<br />
Summary of TSL commands ................................................................................... 6-106<br />
Predefined functions ................................................................................... 6-107<br />
Special characters ...................................................................................... 6-108<br />
Text modes................................................................................................. 6-109<br />
White space................................................................................................ 6-110<br />
Margins....................................................................................................... 6-111<br />
Formatting tables ........................................................................................ 6-112<br />
Developer-definable strings......................................................................... 6-113<br />
Embedded text............................................................................................ 6-114<br />
Message passing........................................................................................ 6-115<br />
Default formats and masks.......................................................................... 6-116<br />
Comments .................................................................................................. 6-117<br />
Report commands....................................................................................... 6-118<br />
Table of Contents xiii
Appendix A Certainty<br />
xiv Table of Contents<br />
Introducing certainty ....................................................................................................A-2<br />
Certainty sets ..............................................................................................................A-4<br />
Certainty factors ..........................................................................................................A-6<br />
Certainty function............................................................................................A-8<br />
CF function .....................................................................................................A-9<br />
Certainty set operations.............................................................................................A-10<br />
Testing a premise .........................................................................................A-11<br />
Changing the system threshold .....................................................................A-14<br />
Adding an element ........................................................................................A-16<br />
Combining certainty factors...........................................................................A-18<br />
Comparing certainty sets...............................................................................A-19<br />
Comparing certainty set elements to Unknown..............................................A-21<br />
Sorting certainty sets ....................................................................................A-22<br />
Other set operations .....................................................................................A-23<br />
TSL statements .........................................................................................................A-25<br />
Setting TSL formatting criteria.......................................................................A-26<br />
Setting TSL substitution criteria.....................................................................A-27<br />
Unformatted substitution of certainty sets......................................................A-28<br />
Formatted substitution of certainty sets .........................................................A-29<br />
Displaying certainty sets in tables ..............................................................................A-31<br />
Specifying certainty during consultations....................................................................A-32<br />
Appendix B Reserved Words<br />
Index
How to Use This Manual<br />
.........................................................................................................................................................................................................˝..........................................<br />
What this manual is<br />
about<br />
The Aion Development System <strong>Language</strong> <strong>Reference</strong> manual describes the<br />
Type Definition <strong>Language</strong>, Knowledge Definition <strong>Language</strong>, and Text<br />
Substitution <strong>Language</strong> within the Aion Development System (<strong>AionDS</strong>).<br />
.........................................................................................................................................................................................................˝..........................................<br />
Who should read this<br />
manual<br />
You should be familiar with <strong>AionDS</strong> concepts.<br />
.........................................................................................................................................................................................................˝..........................................<br />
How to find<br />
information<br />
This manual is organized as follows:<br />
Chapter Contents<br />
1 Describes the Type Definition <strong>Language</strong> (TDL) that you use<br />
to define data structures.<br />
2 Describes the TDL syntax.<br />
3 Explains the Knowledge Definition <strong>Language</strong> (KDL) that you<br />
use to define knowledge base objects.<br />
4 Describes the KDL syntax.<br />
5 Describes the Text Substitution <strong>Language</strong> (TSL) for<br />
formatting messages, reports, graphs, and other displays.<br />
6 Describes the syntax of TSL commands.<br />
A Describes the use of certainty, which allows you to define the<br />
strength of belief about values in a knowledge base.<br />
B Shows the list of reserved words.<br />
How to Use This Manual xv
.........................................................................................................................................................................................................˝..........................................<br />
For more<br />
information<br />
xvi <strong>Language</strong> <strong>Reference</strong><br />
To build knowledge bases, you should have the following <strong>AionDS</strong> manuals:<br />
General <strong>Reference</strong><br />
<strong>Language</strong> <strong>Reference</strong><br />
I/O <strong>Reference</strong><br />
Messages and Codes<br />
User’s <strong>Guide</strong> (Character-Based)<br />
Installation and Operation <strong>Guide</strong> for your platform<br />
Application Programming Interface <strong>Guide</strong> for your platform<br />
If you are building a knowledge base with a graphical user interface, you<br />
should also have the following <strong>AionDS</strong> manuals:<br />
Building GUI Applications: <strong>Reference</strong><br />
Building GUI Applications: Tutorial<br />
User’s <strong>Guide</strong><br />
.........................................................................................................................................................................................................˝..........................................<br />
Aion® product<br />
abbreviations<br />
The <strong>AionDS</strong> documentation set uses the following abbreviations for Aion®<br />
products:<br />
Aion® product Abbreviation<br />
Aion® Development System <strong>AionDS</strong><br />
Aion® Execution System AionES<br />
Component Aion® Execution System CAES<br />
Multitasking Aion® Execution System MAES<br />
Aion® Development System Application<br />
Programming Interface<br />
ADSAPI<br />
Aion® High Performance Option HPO<br />
Aion® Cooperative Processing Option CPO<br />
continued
continued<br />
Aion® product Abbreviation<br />
Callable Aion® Building System CABS<br />
Aion® Code Integration Option CIO<br />
.........................................................................................................................................................................................................˝..........................................<br />
Conventions<br />
The <strong>AionDS</strong> documentation set uses the following conventions.<br />
.............................................................................................................................................................................<br />
Typeface<br />
The <strong>AionDS</strong> documentation set uses these typeface conventions:<br />
Style of type What it represents<br />
Boldface new term and its definition<br />
Italic ■ manual titles<br />
■ syntax variables<br />
■ emphasis<br />
■ foreign language phrases<br />
Monospace ■ code examples<br />
■ prompts and messages<br />
■ examples of user input (in procedures, for example)<br />
How to Use This Manual xvii
xviii <strong>Language</strong> <strong>Reference</strong><br />
.............................................................................................................................................................................<br />
Icons<br />
The <strong>AionDS</strong> documentation set uses these icons:<br />
Symbol Meaning<br />
Alternative: identifies an alternative to the previous procedure<br />
(choice is usually a matter of personal preference;<br />
neither offers a distinct advantage)<br />
Caution: helps you avoid mistakes that can produce<br />
unexpected or undesirable results (runtime errors<br />
and losing work, for example)<br />
Exception: indicates an exception to common functionality<br />
or behavior<br />
For more information: identifies additional sources of information on a<br />
particular topic<br />
Important: stresses a point that can help you achieve greater<br />
success with the <strong>AionDS</strong> product<br />
Reminder: reminds you in passing of an important aspect<br />
that was discussed previously<br />
Tip: suggests a technique that can result in more<br />
efficient use of the system<br />
identifies a one-step procedure
.............................................................................................................................................................................<br />
Syntax<br />
The following conventions are used to define the <strong>AionDS</strong> syntax and<br />
command formats in this manual.<br />
■ You must type letters that are capitalized. You do not have to capitalize<br />
these letters. Lowercase letters are optional. If a command or syntax<br />
statement contains both capitalized and lowercase letters, you can type<br />
only the capitalized letters:<br />
RUn<br />
For the above command, you can type the following letters:<br />
ru<br />
run<br />
You cannot type the following letter:<br />
r<br />
Important: For <strong>AionDS</strong> running on UNIX platforms, <strong>AionDS</strong><br />
commands are not case sensitive. However, file names that exist in<br />
UNIX (for example, knowledge base names) must be typed in uppercase<br />
and lowercase exactly as displayed in UNIX.<br />
■ Italics indicate a response that you must specify:<br />
RUn kb_name<br />
The expected response for an italicized word is indicated below the<br />
command or syntax statement.<br />
■ Brackets indicate an option:<br />
ASORT (expr [ON key])<br />
The ON key phrase is optional.<br />
■ A bar indicates a choice:<br />
List-objects [State st_name | Vocabulary vocab_nm]<br />
In this case, you can type either the State choice or the Vocabulary<br />
choice.<br />
■ Braces indicate a required choice:<br />
List-objects {State st_name | Vocabulary vocab_nm}<br />
You must type a State choice or a Vocabulary choice.<br />
How to Use This Manual xix
xx <strong>Language</strong> <strong>Reference</strong><br />
■ You must use other characters, such as parentheses and angle brackets,<br />
exactly as specified:<br />
EOF (fparam)<br />
The parentheses are required.<br />
■ An ellipsis (...) indicates that you can repeat a choice:<br />
param IS FROM (stexpr, stexpr, [, stexpr ...])<br />
You can repeat “, stexpr” as many times as you want.
Chapter 1<br />
Type Definition <strong>Language</strong><br />
.........................................................................................................................................................................................................˝..........................................<br />
Introduction<br />
This chapter discusses the Type Definition <strong>Language</strong> (TDL), which you use<br />
to describe data structures in <strong>AionDS</strong>. These data structures define the<br />
format of parameters and slots. You also can use TDL to describe the data<br />
structure of a type object, which is a template that you create for parameters<br />
and slots that share the same data structure.<br />
.........................................................................................................................................................................................................˝..........................................<br />
In this chapter<br />
Topic Page<br />
<strong>AionDS</strong> data types 1-2<br />
User-input attributes 1-10<br />
Output argument attribute 1-30<br />
File attributes 1-31<br />
Textual file structures 1-37<br />
Non-textual file structures 1-45<br />
Type Definition <strong>Language</strong> 1-1
<strong>AionDS</strong> data types<br />
<strong>AionDS</strong> data types<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
1-2 <strong>Language</strong> <strong>Reference</strong><br />
A data type defines the internal format of a parameter or slot. You must<br />
specify a data type for each parameter or slot that you use. The Base Type<br />
property defines the data type for a parameter or slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Basic and structured<br />
data types<br />
Data types are classified in one of two ways, as follows:<br />
Data type Description<br />
Basic data types are atomic. In other words, you cannot divide a<br />
basic data type into sub-parts.<br />
Structured data types are built from the basic data types.<br />
An INTEGER data type is an example of a basic data type. If the Base Type<br />
property of a slot contains INTEGER, the slot can contain only whole<br />
numbers. A list of integers is an example of a structured data type. It is built<br />
from the INTEGER basic data type. If the Base Type property of a slot<br />
contains INTEGER_LIST, the slot can contain any number of integers.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Explicit and implicit<br />
data types<br />
You can define data types explicitly or implicitly. For example, you can<br />
specify INTEGER explicitly in the Base Type property of a parameter. You<br />
implicitly specify an data type when you specify a constraint, as in the<br />
following Base Type a slot:<br />
>0<br />
The slot is constrained to positive integers, therefore, the implicit basic data<br />
type is integer.<br />
The following sections describe <strong>AionDS</strong> data types.
Basic data types<br />
<strong>AionDS</strong> data types<br />
.........................................................................................................................................................................................................˝..........................................<br />
Base types<br />
The following table shows the basic data types that you can use with a<br />
parameter or slot.<br />
Data type Description<br />
Boolean A value representing true, false, or unknown<br />
Date Any date after December 31, 1899<br />
Integer A whole number between -2,147,483,648 and<br />
2,147,483,647<br />
Real A floating-point number between ±1.0E±306 on the PC<br />
and between -5.3E-79 and 7.2E+75 on the mainframe<br />
String A group of up to 65,512 characters, inclusive<br />
Time Any time, to the nearest one hundredth second<br />
.........................................................................................................................................................................................................˝..........................................<br />
Boolean values<br />
You can use BOOLEAN to represent the values TRUE and FALSE or YES and<br />
NO. Boolean parameters are useful to hold information that can be answered<br />
in as “yes” or “no,” such as “Is the company incorporated in Delaware?”<br />
.........................................................................................................................................................................................................˝..........................................<br />
Numeric values<br />
Numbers are either REAL or INTEGER. You can use the DATE and TIME data<br />
types to hold dates and times, respectively. The STRING data type holds<br />
characters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Using base types<br />
When you create a parameter or slot, you choose a Base Type that<br />
corresponds to the type of data that the parameter or slot must hold.<br />
For example, if the parameter holds a monetary unit, you should define its<br />
Base Type property as REAL, unless you want to ignore the fractional part of<br />
the monetary unit. If the parameter does not hold fractional units, you can<br />
define it as an INTEGER.<br />
Type Definition <strong>Language</strong> 1-3
<strong>AionDS</strong> data types<br />
Structured data types<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
Lists and sets<br />
1-4 <strong>Language</strong> <strong>Reference</strong><br />
You can create structured data types from basic data types. The following<br />
table shows the structured data types.<br />
Data type Description<br />
List An ordered collection of items<br />
Set An unordered collection of items, in which each item is<br />
unique<br />
Certainty Set A set in which each item contains value and a certainty factor<br />
Record A collection of data types to hold logically related values<br />
File A collection of records in an external file<br />
When you create a structured data type, you define it as a structure of a basic<br />
data type or a structure of another structured data type. The following<br />
sections describe structured data types.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can create a parameter or slot that holds more than one value by defining<br />
the parameter or slot as a LIST or SET. When you specify a LIST or SET, you<br />
must specify its base type. For example, if you have a parameter that is a list<br />
of answers to a “true/false” multiple choice test, the basic data type of the list<br />
is BOOLEAN. You specify the Base Type property of the parameter as follows:<br />
list of boolean<br />
In this example, the LIST data type is a structure of BOOLEAN values.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Certainty sets<br />
A certainty set is a set that associates each element in a set with a relative<br />
confidence that the element actually belongs in the set.
<strong>AionDS</strong> data types<br />
For more information: See Appendix A, “Certainty,” for a discussion of<br />
certainty sets.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Predefined lists and<br />
sets<br />
<strong>AionDS</strong> provides predefined structured data types for common kinds of lists<br />
and sets. The basic data type of a predefined structured data type is implied<br />
by the definition of the structured data type. The following table shows these<br />
types.<br />
Data type Description<br />
INTEGER_LIST A list of integers<br />
INTEGER_SET A set of integers<br />
REAL_LIST A list of real numbers<br />
REAL_SET A set of real numbers<br />
STRING_LIST A list of strings<br />
STRING_SET A set of strings<br />
.........................................................................................................................................................................................................˝..........................................<br />
Lists versus sets<br />
Lists and sets are similar because both hold more than one value. They are<br />
different, however, in the following ways:<br />
■ <strong>AionDS</strong> maintains the order of elements used in a list. Sets are<br />
unordered.<br />
KDL provides functions that make use of the order of the elements in a<br />
list, such as finding the first or last elements in a list.<br />
■ The elements of a set must be unique. Duplicate elements are allowed in<br />
lists.<br />
If you add an element to a set and the element is already present in the<br />
set, <strong>AionDS</strong> ignores the assignment. You can add the same element to a<br />
list, however, as often as you want.<br />
For example, a parameter with a Base Type of INTEGER_LIST can hold the<br />
following elements at one time:<br />
2, 3, 3, 45, 7905, 8999, 8999, ...<br />
Type Definition <strong>Language</strong> 1-5
<strong>AionDS</strong> data types<br />
Records<br />
1-6 <strong>Language</strong> <strong>Reference</strong><br />
A parameter with Base Type of INTEGER_SET, however, cannot hold these<br />
elements because the elements are not unique. Two elements contain the<br />
same value, 8999.<br />
For another example, the parameter SPECIAL_CUST with a Base Type<br />
property of STRING_SET, can hold the following elements at one time:<br />
'PLATINUM technology','IBM','Lotus Development<br />
Corp.','Microsoft'<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can use records to group together a logical collection of items or data<br />
elements. Within a record, each item is called a field. For example, you<br />
might want to create a customer record containing the following information:<br />
■ Customer number<br />
■ Customer name<br />
■ Payment history<br />
■ Credit limit<br />
■ Date of last update<br />
A record starts with the keyword RECORD and ends with the keyword END.<br />
You must specify a data type for each field in the record.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following example shows the definition of the CUST_REC record in a<br />
type object.<br />
record<br />
cust_no is integer<br />
cust_name is string<br />
payment_hist is string<br />
credit_limit is real<br />
last_update is date<br />
end
<strong>AionDS</strong> data types<br />
.........................................................................................................................................................................................................˝..........................................<br />
Nested records<br />
Files<br />
You can create record structures that contain other record structures. The<br />
following example shows CUST_DATA, which is defined as a CUST_REC<br />
record, nested in the record CUST_ADDR.<br />
record<br />
cust_data is cust_rec<br />
addr_1 is string<br />
addr_2 is string<br />
city is string<br />
area code is integer<br />
tel_no is string<br />
end<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
If you want to define a record structure that is also used externally to<br />
<strong>AionDS</strong>, you must define a FILE data structure. For example, the following<br />
Base Type property specifies a record that is used to transfer data between<br />
<strong>AionDS</strong> and an external file:<br />
file of record<br />
cust_name is string(20)<br />
cust_no is integer(4)<br />
cust_addr is string(40)<br />
cust_state is string(2)<br />
cust_zip is string(5)<br />
end<br />
This is also an example of creating a structured data type, FILE, from another<br />
structured data type, RECORD.<br />
The size, in bytes, is specified for each of the fields in the record. You must<br />
specify the size and other information about the record because the format of<br />
the record must match the external data structure.<br />
For more information: See the “File attributes” section on page 1-31,<br />
“Textual file structures” section on page 1-37, and “Non-textual file<br />
structures” section on page 1-45.<br />
Type Definition <strong>Language</strong> 1-7
<strong>AionDS</strong> data types<br />
Constrained data types<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
1-8 <strong>Language</strong> <strong>Reference</strong><br />
When you define a constraint, the constraint determines the data type for the<br />
parameter or slot. In TDL, constraints are restricted to constants. You<br />
cannot use a parameter or slot in the constraint. The following table shows<br />
sample constraints and resulting data types.<br />
Constraint Implied data type<br />
>0 INTEGER<br />
>0.0 REAL<br />
IS FROM ('1','2') STRING<br />
LIST OF >0 INTEGER_LIST<br />
SET OF >0.0 REAL_SET<br />
LIST OF FROM ('1','2') STRING_LIST<br />
> DATE('1-JAN-90') DATE<br />
> TIME('8:00', < TIME('18:00') TIME<br />
For more information: See Chapter 2, “TDL Syntax,” for the syntax of<br />
type object constraints.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Constraints in type<br />
objects<br />
Type objects are useful because you can create a single type object and use it<br />
as the base type for several parameters. If you change the structure or<br />
constraint for a group of similar parameters or slots, you only need to change<br />
one type object. You do not have to change the characteristics of each<br />
parameter or slot.<br />
Consider the following example. Your application involves moving inventory<br />
from one location to another. You have several parameters, such as<br />
DEPART_AIRPORT and DEST_AIRPORT. You can constrain each parameter<br />
to hold all airport codes, or you can define one type object to hold them.
<strong>AionDS</strong> data types<br />
The following example shows the Type Definition property for the AIRPORT<br />
type object. AIRPORT contains the allowable airports.<br />
is from<br />
('sfo','lax','jfk','hkg','mci','stl','bos','dfw',<br />
'sea','por','cdg','zur','mex')<br />
You define the Base Type property as AIRPORT for DEPART_AIRPORT,<br />
DEST_AIRPORT, and other parameters that need the constraint. If you want<br />
to change the constraint by adding an airport or removing one, you do not<br />
need to change each parameter. You only need to change the AIRPORT type<br />
object.<br />
Type Definition <strong>Language</strong> 1-9
User-input attributes<br />
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
1-10 <strong>Language</strong> <strong>Reference</strong><br />
You can specify attributes to control the following aspects of user input:<br />
■ How <strong>AionDS</strong> asks for a value at run time<br />
■ The values that <strong>AionDS</strong> allows the user to enter<br />
■ The data manipulation that occurs after input<br />
■ The format in which data must be entered<br />
You can specify user-input attributes in the Base Type property of a<br />
parameter or slot or in the Type Definition property of a type object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of attributes<br />
The following table shows the user-input attributes:<br />
User-input attributes Description<br />
CHECKLENGTH Check the length of user input. This attribute must be<br />
used with a numeric constant that specifies the length.<br />
NOEMPTY Force the user to enter a string or an element of a list or<br />
set.<br />
NOMENU Allow the user to answer a question involving choices<br />
without using a menu.<br />
NOTRIM Do not trim leading or trailing blanks from input.<br />
NOUNKNOWN Prevent the user from answering UNKNOWN to a<br />
question.<br />
TEXT Allow the user to enter multiple lines of text on the PC.<br />
UPPERCASE Convert input to uppercase.<br />
MASKS Allow user responses only in the specified format.
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
How to specify<br />
attributes<br />
The following entry in the Base Type property of a parameter shows the<br />
input attribute NOUNKNOWN specified after the data type specification<br />
INTEGER:<br />
integer (nounknown)<br />
You can specify any number of user-input attributes. Each user-input<br />
attribute must be separated by a comma. For example, the following entry in<br />
the Type Definition property of a type object shows the attributes NOMENU<br />
and UPPERCASE specified after the CUST_NAME string:<br />
record<br />
cust_name is string (nomenu, uppercase)<br />
age is integer<br />
end<br />
The following sections describe user-input attributes.<br />
Type Definition <strong>Language</strong> 1-11
User-input attributes<br />
Checklength attribute<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-12 <strong>Language</strong> <strong>Reference</strong><br />
The CHECKLENGTH attribute restricts the user response to the specified<br />
length for STRING, STRING_LIST, and STRING_SET data types.<br />
It is never necessary to define a size unless you want to check the size of a data<br />
type, the quantity of input, or write the data to an external file. Internally,<br />
<strong>AionDS</strong> data types can be any size. The CHECKLENGTH option is<br />
particularly useful, however, when you want to check that the input data<br />
matches the data definition for an external file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
For example, the following entry in the Type Definition property of a type<br />
object restricts the number of characters that a user can enter to ten<br />
characters:<br />
string (10, checklength)<br />
The following entry restricts the elements of a set that the user can choose to<br />
five strings:<br />
string_set (5, checklength)<br />
The following entry restricts the number of string lists that the user can enter<br />
to 5 and the string size of each string to ten characters:<br />
list (5, checklength) of string (10, checklength)
Noempty attribute<br />
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
The NOEMPTY attribute constrains an answer during user sourcing in the<br />
following ways:<br />
■ The user cannot enter a null string; the user must enter at least one nonblank<br />
character.<br />
■ The user must enter at least one element of a list or set.<br />
The NOEMPTY attribute allows the user to enter a value if the value is known,<br />
or enter UNKNOWN.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
For example, you can specify the following line in the Base Type property of<br />
the parameter NAME_PA:<br />
string (noempty)<br />
The user must enter a string for the parameter. <strong>AionDS</strong> does not accept<br />
blanks or a null string. <strong>AionDS</strong> accepts the value UNKNOWN since the<br />
NOUNKNOWN attribute is not specified.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Noempty and<br />
Nounknown<br />
You can use NOEMPTY and NOUNKNOWN together to require the user to<br />
enter a value as in the following example:<br />
string (nounknown, noempty)<br />
For more information: See the “Nounknown attribute” section on page<br />
1-16.<br />
Type Definition <strong>Language</strong> 1-13
User-input attributes<br />
Nomenu attribute<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-14 <strong>Language</strong> <strong>Reference</strong><br />
The NOMENU attribute suppresses the choice menu that normally appears for<br />
Boolean, constrained string, and string set parameters or slots. The input is<br />
still constrained to the available choices, however, the menu does not appear.<br />
The user must type in the response during the consultation.<br />
Important: NOMENU is ignored in a graphical knowledge base.<br />
The NOMENU attribute is useful in the following cases:<br />
■ The number of choices is larger than the answer window and you do not<br />
want to require the user to scroll to a choice<br />
■ The choices are easy to remember or are displayed in the prompt<br />
■ You want to conserve the space on the screen, for example, you want to<br />
display a form<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following example shows the first line of a form, in which a BOOLEAN<br />
parameter is sourced.<br />
Because the Answer window is a single line, the user must scroll to choose<br />
NO. The example below shows the effect of using the NOMENU attribute.<br />
The menu is suppressed. Scrolling is no longer required. The user still must<br />
answer YES, NO, or UNKNOWN.
Notrim attribute<br />
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
By default, <strong>AionDS</strong> terminates input strings at the first NULL value<br />
encountered. When the NOTRIM attribute is used, the string is not truncated<br />
at any NULL value. Also, all leading and trailing blanks are preserved.<br />
Because all leading and trailing blanks are preserved, you might need to<br />
increase the buffer size to accommodate the resulting string.<br />
Caution: Specify the NOTRIM attribute when the string contains NULL<br />
values before other valid values; otherwise the string is truncated incorrectly.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following Base Type property of a slot:<br />
string (notrim)<br />
In this example, when <strong>AionDS</strong> sources the slot, the string is not truncated at<br />
any NULL value, and leading and trailing blanks are preserved.<br />
Type Definition <strong>Language</strong> 1-15
User-input attributes<br />
Nounknown attribute<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-16 <strong>Language</strong> <strong>Reference</strong><br />
The NOUNKNOWN attribute prevents the user from answering UNKNOWN<br />
for a parameter or slot.<br />
If the NOUNKNOWN attribute is not specified, the user can press F5 or PF5 to<br />
specify UNKNOWN when asked for the parameter value in a character-based<br />
consultation. The user can select Unknown from the system menu in a<br />
graphical consultation.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
For example, you can specify the following line in the Base Type property of<br />
the parameter NAME_PA:<br />
string (nounknown)<br />
The user must enter a string value. <strong>AionDS</strong> does not accept the value<br />
UNKNOWN.
Text attribute<br />
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
The TEXT attribute allows you to emulate mainframe input of parameters and<br />
slots on the PC. On the mainframe, you can enter multiple lines of text by<br />
pressing RETURN after each line. When you press ENTER, the entire answer<br />
is transmitted to the mainframe.<br />
A separate RETURN key does not exist on the PC. The ENTER key is used for<br />
both purposes. Input is processed as soon as you press ENTER, unless you<br />
specify the TEXT attribute to the parameter or slot.<br />
When you specify the TEXT attribute, the ENTER key moves the cursor to a<br />
new line, which emulates the action of the RETURN key on the mainframe.<br />
On the PC, <strong>AionDS</strong> responds to the input when you press F8, which<br />
corresponds to pressing ENTER on the mainframe.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
You can use the following Base Type property to allow input of multiple lines<br />
of text:<br />
string (text)<br />
Type Definition <strong>Language</strong> 1-17
User-input attributes<br />
Uppercase attribute<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-18 <strong>Language</strong> <strong>Reference</strong><br />
The UPPERCASE attribute converts lowercase or mixed-case user responses to<br />
all uppercase characters. The UPPERCASE attribute is only valid for data types<br />
that resolve to strings.<br />
Use the UPPERCASE attribute when your application requires a standard<br />
presentation of user responses for internal processing. For example, if you<br />
know that the input is all uppercase, comparisons and other data<br />
manipulation might be easier when you do not need to handle case<br />
sensitivity.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following entry in the Type Definition property of a type object causes<br />
all input to any parameter or slot that uses the type object to be converted to<br />
uppercase characters:<br />
string_set (uppercase)
Masks<br />
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
A TDL mask specifies the format in which the user must enter data during a<br />
consultation. You also can use masks in TSL to specify the format of the data<br />
on output. Masks, however, do not determine the format of data transferred<br />
between <strong>AionDS</strong> and an external file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following entry in the Type Definition property of a type object<br />
for a record:<br />
record<br />
name is string<br />
age is integer<br />
phone is string ('(999) 999-9999')<br />
birthdate is date ('M2/DD/Y2')<br />
end<br />
Masks are associated with the PHONE and BIRTHDATE fields. If the user<br />
enters data into a parameter with this type definition, they can enter the<br />
following line in the PHONE field:<br />
(415) 328-9595<br />
The user must enter the data exactly as specified in the mask. Each of the<br />
following attempted inputs for the PHONE field is invalid:<br />
415 328-9595<br />
328-9595<br />
4153289595<br />
The first entry lacks the specified parentheses. The second entry lacks the<br />
parentheses and a number for the area code. The third entry lacks the<br />
parentheses, a space between the area code and the number, and the dash.<br />
The following entries are valid entries for the BIRTHDATE field of a parameter<br />
that uses this type definition:<br />
1/20/89<br />
01/02/89<br />
Type Definition <strong>Language</strong> 1-19
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Types of masks<br />
1-20 <strong>Language</strong> <strong>Reference</strong><br />
You can create masks for the following data types:<br />
■ Date<br />
■ Integer<br />
■ Real<br />
■ String<br />
■ Time<br />
The following sections describe these masks.
Date masks<br />
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
You can use the following symbols to define a date mask:<br />
Dn specifies a one-digit or two-digit day of month on input.<br />
DDn specifies a two-digit day of month on input.<br />
Xn specifies ordinal representation of the day of month on<br />
input.<br />
Mn specifies a one-digit or two-digit month of year on input.<br />
MMn specifies a two-digit month of year on input.<br />
Nn specifies a three-character representation of the month on<br />
input.<br />
NNn specifies the complete name of the month on input.<br />
Y2 specifies a two-digit year on input.<br />
YYn specifies a two-digit year on input.<br />
Z specifies a four-digit year on both input and output.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You can use at most one of each of the day, month, or year masks. On<br />
input, you must use one of each kind of mask. You do not need to use<br />
each kind of mask on output.<br />
■ If you want to specify a mask symbol as a non-mask character, you must<br />
precede it with an ampersand (&) character.<br />
■ All two-digit year masks assume dates since 1900, inclusive.<br />
Type Definition <strong>Language</strong> 1-21
User-input attributes<br />
1-22 <strong>Language</strong> <strong>Reference</strong><br />
■ The n following the input mask specifies the use of the mask on output.<br />
For D, DD, M, MM, Y, and YY, n specifies the following formats:<br />
n Description<br />
1 Display two digits or a leading blank and one digit<br />
2 Display two digits<br />
If n is not specified, leading zeros are suppressed.<br />
For N and NN, and n specifies the following formats:<br />
n Description<br />
1 Uppercase first character only<br />
2 Lowercase all characters<br />
If n is not specified, all characters are uppercase.<br />
For X, n specifies the following formats:<br />
n Description<br />
1 Lowercase ordinal<br />
2 Lowercase ordinal<br />
If n is not specified, the ordinal is uppercase.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Mask Valid values Invalid values<br />
date('D2/N/YY2') 01/JUN/88<br />
1/JUN/88<br />
date('M-D, Z') 6-1, 1988<br />
06-01, 1988<br />
date('M1-D2-YY2') 06-21-88<br />
6-21-88<br />
01/06/88<br />
01/JUN/1988<br />
6/1,1988<br />
06-21-1988<br />
date('NN DX1, Z') June 1st, 1988 Jun 1,1988
Integer masks<br />
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
You can use the following symbols to define an integer mask:<br />
9 specifies a digit between 0 and 9.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You must enter the exact number of digits as specified by the mask.<br />
■ You can enter a plus sign ( + ) or a minus sign ( - ) immediately before<br />
the number to indicate the sign of the number. The sign is not part of<br />
the mask and does not replace a digit.<br />
■ If you do not enter a sign, the number is positive.<br />
■ On output, a positive number is displayed without a sign. A negative<br />
number is preceded by a minus sign.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following mask:<br />
integer ('99999')<br />
The following values are valid:<br />
10000<br />
+10000<br />
-10000<br />
00001<br />
+00001<br />
-00001<br />
The following values are invalid:<br />
1000<br />
100000<br />
10,000<br />
+1000<br />
-1000<br />
Type Definition <strong>Language</strong> 1-23
User-input attributes<br />
Real masks<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
1-24 <strong>Language</strong> <strong>Reference</strong><br />
You can use the following symbols to define a real mask:<br />
9 specifies a digit between 0 and 9.<br />
. specifies a decimal point.<br />
* specifies any number of consecutive digits.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You must enter the exact number of digits as specified by the mask.<br />
■ You can enter a plus sign ( + ) or a minus sign ( - ) immediately before<br />
the number to indicate the sign of the number. The sign is not part of<br />
the mask and does not replace a digit.<br />
■ If you do not enter a sign, the number is positive.<br />
■ On output, a positive number is displayed without a sign. A negative<br />
number is preceded by a minus sign.<br />
■ You can specify at most one decimal point.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following mask:<br />
real ('999.99')<br />
The following values are valid:<br />
100.00<br />
+100.00<br />
-100.00<br />
000.01<br />
+000.01<br />
-000.01<br />
The following values are invalid:<br />
1000.0<br />
10000<br />
1,00.00<br />
+100,00
String masks<br />
User-input attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
You can use the following symbols to define a string mask:<br />
A specifies an alphabetic character.<br />
9 specifies a digit between 0 and 9.<br />
N specifies an alphabetic character or a digit.<br />
X specifies any character, including punctuation and special symbols.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Any character that is not a mask symbol, including spaces, must be<br />
entered exactly as specified. For example, hyphens are required after the<br />
third and fifth digits in the following mask:<br />
string('999-99-9999')<br />
■ If you want to specify a mask symbol as a non-mask character, you must<br />
precede it with an ampersand (&) character.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following mask:<br />
string('A99&9NX')<br />
The following values are valid:<br />
x1293.<br />
b2293q<br />
The following values are invalid:<br />
1239y.<br />
x128y.<br />
b229.q<br />
Type Definition <strong>Language</strong> 1-25
User-input attributes<br />
Time masks<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
1-26 <strong>Language</strong> <strong>Reference</strong><br />
You can use the following symbols to define a time mask:<br />
Hn specifies a one-digit or two-digit hour on input.<br />
HHn specifies a two-digit hour on input.<br />
Jn specifies a 24-hour representation with a one-digit or two-digit<br />
hour on input.<br />
JJn specifies a 24-hour representation with a two-digit hour on<br />
input.<br />
Mn specifies a one-digit or two-digit minute on input.<br />
MMn specifies a two-digit minute on input.<br />
Sn specifies a one-digit or two-digit second on input.<br />
SSn specifies a two-digit second on input.<br />
Fn specifies a one-digit or two-digit one-hundredth second on input.<br />
FFn specifies a two-digit one-hundredth second on input.<br />
Xn specifies either AM or PM on input.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You can use at most one of each of the hour, minute, second, or onehundredth<br />
second masks. You do not need to use each kind of mask.<br />
■ On input masks, you must separate each mask with a non-mask<br />
character.<br />
■ If you want to specify a mask symbol as a non-mask character, you must<br />
precede it with an ampersand (&) character.
User-input attributes<br />
■ The n following the input mask specifies the use of the mask on output.<br />
For all masks except X, n specifies the following formats:<br />
n Description<br />
1 Display two digits or a leading blank and one digit.<br />
2 Display two digits<br />
If n is not specified, leading zeros are suppressed.<br />
For X, n specifies the following formats:<br />
n Description<br />
1 Lowercase AM or PM<br />
2 Lowercase AM or PM<br />
If n is not specified, AM or PM is uppercase.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following table shows sample masks with valid and invalid data:<br />
Mask Valid values Invalid values<br />
time('H:M2:S2') 04:30:01<br />
4:30:01<br />
04:30<br />
16:30:01<br />
time('J2 M2') 16 30 1630<br />
16:30<br />
1630:00<br />
time('H:M2 X') 4:30 pm 4:30<br />
4:30pm<br />
Type Definition <strong>Language</strong> 1-27
User-input attributes<br />
User-input attribute examples<br />
.........................................................................................................................................................................................................˝..........................................<br />
Combining attributes<br />
1-28 <strong>Language</strong> <strong>Reference</strong><br />
User-input attributes can be used together in many combinations. The userinput<br />
attributes follow the data type specification. The attributes are enclosed<br />
in parentheses and each attribute is separated by a comma.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following example shows the Base Type property of a slot in which the<br />
user input is used by an external file.<br />
string(10,checklength,uppercase,noempty,nounknown)<br />
The data type is STRING. Its length cannot exceed ten characters. The user<br />
must enter a value and the value cannot be UNKNOWN. On input, the string<br />
is converted to all uppercase characters.<br />
The following example shows a record parameter. Each field contains userinput<br />
attributes.<br />
record<br />
trans_date is date ('d/n/yy')<br />
trans_time is time ('j:m:s')<br />
acct_no is integer ('99999')<br />
acct_code is string ('xa9999',uppercase)<br />
amount is real ('*.99')<br />
end<br />
The TRANS_DATE field is a date. The mask specifies that one or two digits<br />
can be entered for the day and month. Two or four digits can be entered for<br />
the year. Slashes ( / ) separate the month, day, and year.<br />
The TRANS_TIME field is a time. The mask specifies that one or two digits<br />
can be entered for the hour, minutes, and seconds. Colons ( : ) separate the<br />
digits.<br />
The ACCT_NO field is an integer. The mask specifies that five digits must be<br />
entered, including leading zeros if necessary.
User-input attributes<br />
The ACCT_CODE field is a string. The mask specifies that the first character<br />
can be any character. The second digit must be an alphabetic character. The<br />
next four characters must be digits. Any lowercase characters are converted to<br />
uppercase.<br />
The AMOUNT field is a real number. The mask specifies that any number of<br />
consecutive digits can precede the decimal point. The decimal point and two<br />
digits following the decimal point must be entered.<br />
Type Definition <strong>Language</strong> 1-29
Output argument attribute<br />
Output argument attribute<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
1-30 <strong>Language</strong> <strong>Reference</strong><br />
To specify a function argument as an output argument, you must use the<br />
output attribute. If you do not specify the output attribute, the function<br />
argument is an input argument.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Output arguments identify the values returned by the function. You can<br />
specify the output attribute in the Function Arguments property in a<br />
function or the Type Definition property of a type that is specified in the<br />
Function Arguments property. If you specify the output attribute in any<br />
other object, the output attribute is ignored.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following example shows the name output argument in the Function<br />
Arguments property.<br />
name is string (output)
File attributes<br />
File attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
When you specify a data structure for a file, you can specify four attributes, as<br />
follows:<br />
■ The access method<br />
■ Whether the file is completely textual<br />
■ Whether the records are variable length<br />
■ Whether the records contain certainty information<br />
The following sections discuss these attributes.<br />
Type Definition <strong>Language</strong> 1-31
File attributes<br />
Access method<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-32 <strong>Language</strong> <strong>Reference</strong><br />
An access method is the operating system software that performs record<br />
access. You can specify the access method as an attribute of the file.<br />
You can choose one of the following access methods for a file:<br />
DBASE is the access method for databases that use DBASE.<br />
DLI is an access method for DL/I databases.<br />
QSAM is the Queued Sequential Access Method that allows<br />
sequential access to records in a file.<br />
SQL is an access method for relational databases that use SQL.<br />
VSAM is the Virtual Storage Access Method that supports<br />
sequential and direct access using key fields, relative<br />
record numbers, or absolute addresses.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Options for each<br />
environment<br />
You must choose the access method that corresponds to the data management<br />
system in which the data is stored. <strong>AionDS</strong> environments support the<br />
following access methods:<br />
Environment Access methods<br />
<strong>AionDS</strong>/PC QSAM, SQL, DBASE<br />
<strong>AionDS</strong>/Win QSAM, VSAM, SQL, DBASE<br />
<strong>AionDS</strong>/2 QSAM, VSAM, SQL, DBASE<br />
<strong>AionDS</strong>/AIX QSAM, VSAM, SQL<br />
<strong>AionDS</strong>/HP-UX QSAM, VSAM, SQL<br />
<strong>AionDS</strong>/Solaris QSAM, VSAM, SQL<br />
<strong>AionDS</strong>/MVS QSAM, VSAM, SQL<br />
<strong>AionDS</strong>/IMS QSAM, VSAM, SQL, DLI<br />
<strong>AionDS</strong>/CICS QSAM, VSAM, SQL, DLI
File attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Defaults<br />
QSAM is the default access method for all <strong>AionDS</strong>-supported platforms. In<br />
<strong>AionDS</strong>/PC, <strong>AionDS</strong>/Windows, <strong>AionDS</strong>/2, <strong>AionDS</strong>/HP-UX,<br />
<strong>AionDS</strong>/Solaris, <strong>AionDS</strong>/AIX, you can use a custom access method, PCAM<br />
(PC access method), to sequentially or directly access records in PC and<br />
UNIX files. To use PCAM, specify the QSAM access method.<br />
For more information: See the <strong>AionDS</strong> I/O <strong>Reference</strong> manual on external<br />
data access methods.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following Base Type property specifies VSAM for a file of CUST_REC<br />
records:<br />
file (vsam) of cust_rec<br />
.........................................................................................................................................................................................................˝..........................................<br />
PC access method<br />
<strong>AionDS</strong> provides a custom access method that allows both sequential access<br />
and direct access to records in MS-DOS or OS/2 files on the PC or to records<br />
on UNIX workstations. This is called the PC access method.<br />
For compatibility with other <strong>AionDS</strong> environments, <strong>AionDS</strong> recognizes all<br />
access method keywords. For example, you can create a knowledge base in<br />
<strong>AionDS</strong>/PC or <strong>AionDS</strong>/2 that uses the VSAM access method and port it to<br />
<strong>AionDS</strong>/MVS for execution.<br />
If you specify an access method that is not available on the PC, however, the<br />
PC access method controls input and output operations. A consultation error<br />
occurs when you attempt an I/O operation that is not supported by the PC<br />
access method.<br />
Type Definition <strong>Language</strong> 1-33
File attributes<br />
Textual and non-textual files<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-34 <strong>Language</strong> <strong>Reference</strong><br />
You can specify whether the data in the file is completely textual. Textual<br />
data is character data, which can be displayed without conversion. On the<br />
PC, textual data is in ASCII characters. On the mainframe, textual data is in<br />
EBCDIC characters. One advantage of textual files is that you can move<br />
them between the PC and mainframe easily.<br />
If any part of the data is non-textual, such as binary or packed decimal<br />
numbers, you should not specify TEXTUAL. If a non-textual file contains<br />
records with textual fields, you can specify TEXTUAL for the individual fields.<br />
For more information: See the “Non-textual file structures” section on<br />
page 1-45.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
If the file is completely textual, you specify the TEXTUAL file attribute, as<br />
follows:<br />
file (textual) of cust_rec<br />
The default file format is non-textual. An example of a non-textual file<br />
definition is as follows:<br />
file of cust_rec
Variable length records<br />
File attributes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
You can specify whether the records in a file are variable length. Variable<br />
length records are supported only for QSAM, VSAM, and DL/I files on the<br />
mainframe.<br />
If you use variable length records, the last field specified in the Type<br />
Definition property must be a STRING that contains the variable length<br />
portion of the record. The size of the string must be larger than the longest<br />
variable portion of any record in the file. You can use the READSTR and<br />
WRITESTR KDL statements to interpret the contents of the string field.<br />
For more information: See Chapter 4, “KDL Statement Syntax,” about<br />
READSTR and WRITESTR.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following Base Type property of a parameter:<br />
file (vsam,noattr,variable) of record<br />
emp_no is integer(4)<br />
name is string(20)<br />
rec_type is integer(2)<br />
var_fields is string(74)<br />
end<br />
The parameter defines a VSAM file. The file does not contain certainty<br />
information. (See the next section.) The VARIABLE attribute defines the file<br />
as a variable length file.<br />
The first three fields in the record define the fixed portion of the record. The<br />
last field, VAR_FIELDS, specifies the variable portion of the record. The<br />
maximum record length is 100 bytes, which is the sum of all the fields. The<br />
minimum record length is 26 bytes, which is the sum of the fixed portion of<br />
the record.<br />
The REC_TYPE field defines the kind of record, which allows you to interpret<br />
the contents of the variable portion of the record, VAR_FIELDS. You can use<br />
the READSTR and WRITESTR KDL statements to transfer a parts of the<br />
VAR_FIELDS string into parameters or slots with the appropriate data type,<br />
based upon the contents of REC_TYPE.<br />
Type Definition <strong>Language</strong> 1-35
File attributes<br />
Certainty information<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-36 <strong>Language</strong> <strong>Reference</strong><br />
You can specify whether the data contains certainty information. If you<br />
maintain certainty information about parameters or slots, <strong>AionDS</strong> writes<br />
attribute bytes to the file that contain certainty information. If you do not<br />
need to keep certainty information, you can specify the NOATTR attribute,<br />
which eliminates reading and writing of certainty information to the file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
For example, the following Base Type property specifies a file of CUST_REC<br />
in which certainty information is not maintained:<br />
file (noattr) of cust_rec<br />
If you maintain certainty information, the file is non-textual since the<br />
attribute bytes are binary. Typically, only files created by <strong>AionDS</strong> contain<br />
attribute bytes.<br />
If you want to maintain certainty information for some fields but not for<br />
others, you can specify NOATTR for the individual fields.<br />
For more information: See the “Non-textual file structures” section on<br />
page 1-45.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Defaults<br />
The default non-textual file format contains certainty information. The<br />
default textual file format does not contain certainty information.
Textual file structures<br />
Textual file structures<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
Textual files are files in character format. They are particularly useful for<br />
moving data from one environment to another environment because<br />
conversion of fixed-length records in character format is generally<br />
straightforward.<br />
Textual files contain the keyword TEXTUAL as a file attribute. For example,<br />
the following entry in the Type Definition property of a type object specifies<br />
that the file is a textual file:<br />
file (textual) of record<br />
.<br />
.<br />
.<br />
end<br />
Type Definition <strong>Language</strong> 1-37
Textual file structures<br />
Field and record sizes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-38 <strong>Language</strong> <strong>Reference</strong><br />
Size information is defined for each field. The size is the number of<br />
characters or bytes allowed for the field. Because the file is textual, each digit<br />
of a number is one byte, including a decimal point and sign if present.<br />
The sizes are defined after the data type, such as integer, string, or real, or a<br />
data type of a constraint.<br />
On the mainframe, the record size is the total size of all the separate fields.<br />
On the PC, the record size is the total size of all the separate fields plus two<br />
bytes. On the PC, the following two characters are appended to the end of<br />
each textual record:<br />
■ A carriage return (decimal 13)<br />
■ A line feed (decimal 10)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following example:<br />
file (textual) of record<br />
int_field is integer (8)<br />
str_field is string (20)<br />
real_field is real (10:2)<br />
end<br />
The INT_FIELD field is eight bytes. The STR_FIELD field is 20 bytes. The<br />
REAL_FIELD field is ten bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Defaults<br />
For textual files, you should always explicitly specify each field size. If you do<br />
not explicitly specify the size, <strong>AionDS</strong> uses the following defaults:<br />
Data type Default (bytes)<br />
Integer 4<br />
Real 8<br />
continued
Booleans<br />
continued<br />
Data type Default (bytes)<br />
Time 4<br />
Date 4<br />
Boolean 1<br />
String 255<br />
List 0<br />
Set 0<br />
Textual file structures<br />
By default, lists and sets are not transferred between <strong>AionDS</strong> and an external<br />
source.<br />
The following sections describe the storage of data in textual files.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Profile options<br />
You can specify any size for a Boolean. The FILE-YES-STRING and FILE-NO-<br />
STRING profile options control the translation of Boolean values that are<br />
transferred between <strong>AionDS</strong> and external textual files.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Defaults<br />
If you do not specify values for the profile options, by default <strong>AionDS</strong> expects<br />
the first byte to be one of the following characters:<br />
Character Value<br />
T True or Yes<br />
F False or No<br />
blank Unknown<br />
The remaining positions in the field must be blank.<br />
Type Definition <strong>Language</strong> 1-39
Textual file structures<br />
Dates<br />
.........................................................................................................................................................................................................˝..........................................<br />
Profile option<br />
1-40 <strong>Language</strong> <strong>Reference</strong><br />
The FILE-DATE-MASK profile option controls the translation of dates that are<br />
transferred between <strong>AionDS</strong> and an external file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Defaults<br />
Integers<br />
If you do not specify a value for this profile option, by default, the date field<br />
must be 11 characters if <strong>AionDS</strong> writes to an external file. The following<br />
date is an example of the 11-character format:<br />
13-aug-1987<br />
<strong>AionDS</strong> can read a default date in either 9 or 11 characters. The following<br />
date is an example of the nine-character format:<br />
13-aug-87<br />
<strong>AionDS</strong> translates the year into 1987. A nine character date must be leftjustified<br />
in the field. In the default format, you cannot write a nine-character<br />
date.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Size<br />
An integer field should be large enough to hold the number as one digit per<br />
character, including a sign if required. Integers are stored right-justified in<br />
the field. <strong>AionDS</strong> accepts a leading plus ( + ) or minus ( - ) sign on input<br />
and writes a minus sign in front of negative numbers.<br />
Numbers are stored in a file right-justified and padded with blanks on the<br />
left. Leading zeros are accepted on input.
Lists and sets<br />
Textual file structures<br />
.........................................................................................................................................................................................................˝..........................................<br />
Storage<br />
Real numbers<br />
Elements of lists and sets are stored consecutively within the field. The basic<br />
data type of the list or set determines the storage of individual elements.<br />
For more information: See the “Textual file structures” section on page 1-<br />
37.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Size<br />
A real number contains two pieces of size information. The first piece<br />
identifies the total number of characters to reserve for the field within the<br />
record. The number following the colon ( : ) indicates the precision, or the<br />
number of digits to the right of the decimal point to keep with the field in<br />
the file.<br />
<strong>AionDS</strong> always writes a decimal point when the TEXTUAL attribute is<br />
specified. You should make the size of the field large enough to hold the<br />
decimal point. You should also make the field large enough to hold the sign<br />
if the field must hold negative values.<br />
When <strong>AionDS</strong> reads a real number, it looks at the contents of the field and<br />
converts it into a real number. For example, the following values can be<br />
stored in a real number with size (8:2):<br />
99999999<br />
-9999999<br />
-9999.99<br />
.9999999<br />
In the case of the first two numbers, <strong>AionDS</strong> uses a precision of .00. In the<br />
last case, <strong>AionDS</strong> rounds the number to 1.00.<br />
Numbers are stored in a file right-justified and padded with blanks on the<br />
left. Leading zeros are accepted on input.<br />
Type Definition <strong>Language</strong> 1-41
Textual file structures<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Strings<br />
1-42 <strong>Language</strong> <strong>Reference</strong><br />
Consider the following definition for the field CREDIT_LIMIT:<br />
file (textual) of record<br />
credit_limit is real(8:2)<br />
...<br />
end<br />
The size of CREDIT_LIMIT is eight bytes. There are two bytes after a byte that<br />
contains the decimal point. The range of the data that can be stored in<br />
CREDIT_LIMIT is -9,999.99 to 99,999.99.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Storage<br />
Times<br />
Strings are left-justified and padded with blanks on the right. On input,<br />
<strong>AionDS</strong> terminates input strings at the first NULL value encountered;<br />
consequently, trailing blanks are removed. If you want to preserve trailing<br />
blanks on input, you can specify the NOTRIM attribute.<br />
Caution: Specify the NOTRIM attribute when the string contains NULL<br />
values before other valid values; otherwise the string is truncated incorrectly.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Profile options<br />
The FILE-TIME-MASK controls the translation of times that are transferred<br />
between <strong>AionDS</strong> and an external file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default<br />
If you do not specify this profile option, by default the time field must be 11<br />
characters if <strong>AionDS</strong> writes to an external file. The following time is an<br />
example of the 11 character format:<br />
09:08:56.40<br />
In the example, the time is 9:08 a.m., fifty-six and forty hundredths seconds.
Textual file structures<br />
<strong>AionDS</strong> can read a time in any number of characters. For example, the<br />
following input fields all represent 10:00 a.m. in default format:<br />
1<br />
10<br />
10:0<br />
10:00<br />
...<br />
Type Definition <strong>Language</strong> 1-43
Textual file structures<br />
Textual file example<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
1-44 <strong>Language</strong> <strong>Reference</strong><br />
The following example shows a file type object called CUST_REC_FILE in<br />
textual format.<br />
file (textual) of record<br />
cust_no is >0 10<br />
cust_name is string (checklength,30)<br />
payment_hist is from ('under 30 days',<br />
'not under 30 days') (17)<br />
credit_limit is >=0,
Non-textual file structures<br />
Non-textual file structures<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
If you do not specify the TEXTUAL attribute for the FILE statement, the file is<br />
by default a non-textual file. Data in non-textual files are represented in the<br />
binary format supported by the operating system.<br />
Type Definition <strong>Language</strong> 1-45
Non-textual file structures<br />
Field and record sizes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-46 <strong>Language</strong> <strong>Reference</strong><br />
The following table shows data types, possible sizes, precision, and the default<br />
size and precision for fields that you can store in a file. An “n.a.” in the<br />
precision column indicates that the precision is not relevant for the data type.<br />
Data type Size<br />
(bytes)<br />
Precision<br />
(digits)<br />
BOOLEAN 1, 2, or 4 n.a. 1<br />
BOOLEAN (PACKED) 1 - 16 n.a. 1<br />
BOOLEAN (ZONED) 1 - 32767 n.a. 1<br />
DATE 1, 2, or 4 n.a. 4<br />
DATE (PACKED) 1 - 16 n.a. 4<br />
DATE (ZONED) 1 - 32767 n.a. 4<br />
INTEGER 1, 2, or 4 n.a. 4<br />
INTEGER (PACKED) 1 - 16 n.a. 4<br />
INTEGER (ZONED) 1 - 32767 n.a. 4<br />
LIST 0 - 65535 n.a. 0<br />
REAL 4 or 8 n.a. 8<br />
REAL (FIXED) 2 or 4 0 - 5 or 0 - 10 none<br />
REAL (PACKED) 1 - 16 1 - size 8:2<br />
REAL (ZONED) 1 - 32767 1 - size 8:2<br />
SET 0 - 32767 n.a. 0<br />
STRING 1 - 65536 n.a. 255<br />
TIME 1, 2, or 4 n.a. 4<br />
TIME (PACKED) 1 - 16 n.a. 4<br />
TIME (ZONED) 1 - 32767 n.a. 4<br />
Default<br />
(size:precision)
Non-textual file structures<br />
The size for list and set data types specifies the number of elements in the list<br />
or set.<br />
You should specify a size for the following data types:<br />
■ SET<br />
■ LIST<br />
■ REAL with FIXED attribute specified<br />
<strong>AionDS</strong> does not read LIST or SET data types with the default size from the<br />
file or write it to the file. A default real using the FIXED attribute generates a<br />
consultation error when you access the record.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following example shows the CUST_REC_FILE in a non-textual format.<br />
file of record<br />
spec_type is boolean<br />
cust_no is integer<br />
cust_name is string<br />
amount_owed is real<br />
amount_paid is real<br />
end<br />
The default field sizes for the records in CUST_REC_FILE file are as follows:<br />
Field Size in bytes<br />
SPEC_TYPE 1<br />
CUST_NO 4<br />
CUST_NAME 255<br />
AMOUNT_OWED 8<br />
AMOUNT_PAID 8<br />
Total 276<br />
The following sections describe storage for non-textual data types.<br />
Type Definition <strong>Language</strong> 1-47
Non-textual file structures<br />
Booleans<br />
.........................................................................................................................................................................................................˝..........................................<br />
Storage<br />
Dates<br />
1-48 <strong>Language</strong> <strong>Reference</strong><br />
A Boolean is stored as a value between -100 and 100, inclusive. A value of<br />
-100 is FALSE, a value of 100 is TRUE, and a value of 0 is UNKNOWN.<br />
The way in which a Boolean is stored depends upon whether it is stored as a<br />
binary number, or as a packed or zoned number. The default is binary,<br />
which allows the number to be stored in one, two, or four bytes. The default<br />
size is one byte.<br />
For more information: See the “Numeric field attributes” section on page<br />
1-51 on PACKED and ZONED attributes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Storage<br />
Integers<br />
A date is stored as the number of days from January 1, 1900.<br />
The way in which a date is stored depends upon whether it is stored as a<br />
binary number, or as a packed or zoned number. The default is binary,<br />
which allows the number to be stored in one, two, or four bytes. The default<br />
size is four bytes.<br />
For more information: See the “Numeric field attributes” section on page<br />
1-51 on PACKED and ZONED attributes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Storage<br />
The way in which an integer is stored depends upon whether it is stored as a<br />
binary number, or as a packed or zoned number. The default is binary,<br />
which allows the number to be stored in one, two, or four bytes. The default<br />
size is four bytes.<br />
For more information: See the “Numeric field attributes” section on page<br />
1-51 on PACKED and ZONED attributes.
Lists and sets<br />
Non-textual file structures<br />
.........................................................................................................................................................................................................˝..........................................<br />
Storage<br />
Elements of lists and sets are stored consecutively within the field. The basic<br />
data type of the list or set determines the storage of individual elements.<br />
For more information: See the “Non-textual file structures” section on<br />
page 1-45 for more information.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Attributes<br />
Real numbers<br />
You can specify the following attribute for lists and sets:<br />
WRITELENGTH Write the number of elements.<br />
If you specify the WRITELENGTH attribute, <strong>AionDS</strong> writes a two-byte integer<br />
that contains the number of elements in the list or set immediately in front of<br />
the first element of the list or set. On input, <strong>AionDS</strong> reads only elements<br />
that are part of the original list or set. If you do not specify WRITELENGTH,<br />
<strong>AionDS</strong> reads the maximum number of elements into the list or set and the<br />
non-original elements become UNKNOWN.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Storage<br />
The way in which a real number is stored depends upon whether it is stored<br />
as a binary number, or as a fixed, packed, or zoned number. The default is<br />
binary, which allows the number to be stored in four or eight bytes. The<br />
default size is eight bytes.<br />
For more information: See the “Numeric field attributes” section on page<br />
1-51 about FIXED, PACKED, and ZONED attributes.<br />
Strings<br />
.........................................................................................................................................................................................................˝..........................................<br />
Storage<br />
Strings are represented in the internal character set of the computer. The<br />
character set on the PC is ASCII. The character set on the mainframe is<br />
EBCDIC.<br />
Type Definition <strong>Language</strong> 1-49
Non-textual file structures<br />
.........................................................................................................................................................................................................˝..........................................<br />
Attributes<br />
Times<br />
1-50 <strong>Language</strong> <strong>Reference</strong><br />
You can specify the following attributes for strings:<br />
WRITELENGTH Write the length of the string.<br />
NOTRIM Do not truncate the string at the first NULL value.<br />
If you specify the WRITELENGTH attribute, <strong>AionDS</strong> writes a two-byte integer<br />
that contains the length of the string immediately in front of the string. On<br />
input, <strong>AionDS</strong> reads only the number of characters that are specified. If you<br />
do not specify WRITELENGTH, <strong>AionDS</strong> does not keep any trailing blanks,<br />
even if they were part of the original string.<br />
By default, <strong>AionDS</strong> terminates input strings at the first NULL value<br />
encountered. When the NOTRIM attribute is used, the string is not truncated<br />
at any NULL value. Also, all leading and trailing blanks are preserved.<br />
Because all leading and trailing blanks are preserved, you might need to<br />
increase the buffer size to accommodate the resulting string.<br />
Caution: Specify the NOTRIM attribute when the string contains NULL<br />
values before other valid values; otherwise the string is truncated incorrectly.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Storage<br />
A time is stored as the number of one-hundredth seconds from midnight.<br />
The way in which a time is stored depends upon whether it is stored as a<br />
binary number, or as a packed or zoned number. The default is binary,<br />
which allows the number to be stored in one, two, or four bytes. The default<br />
size is four bytes.<br />
For more information: See the “Numeric field attributes” section on page<br />
1-51 about PACKED and ZONED attributes.
Numeric field attributes<br />
Non-textual file structures<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of attributes<br />
Fixed attribute<br />
<strong>AionDS</strong> provides attributes that allow you to specify additional characteristics<br />
of numeric fields in non-textual files. The following example shows the<br />
attributes that you can specify.<br />
Attributes Descriptions<br />
FIXED Represent real numbers in fixed-point notation.<br />
PACKED Represent numbers in packed-decimal format, which is<br />
two digits per byte.<br />
TEXTUAL Represent numbers in character format.<br />
UNSIGNED Interpret integers as positive numbers without a sign bit.<br />
ZONED Represent numbers in zoned-decimal format, which is<br />
similar to character format.<br />
The following sections discuss each of the numeric attributes in detail.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
The FIXED attribute causes <strong>AionDS</strong> to interpret a real number in fixed-point<br />
notation as a two-byte or four-byte integer in a file. You can specify fixed for<br />
any REAL number field.<br />
You can specify a size of either 2 bytes with a precision of 0 to 5 digits,<br />
inclusive, or a size of 4 bytes with a precision of 0 to 10 digits, inclusive.<br />
You must specify a size for real data types with the FIXED attribute. The<br />
default size for real data types with the FIXED attribute generates a<br />
consultation error when you access the record.<br />
Type Definition <strong>Language</strong> 1-51
Non-textual file structures<br />
Packed attribute<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Textual attribute<br />
1-52 <strong>Language</strong> <strong>Reference</strong><br />
The packed attribute causes <strong>AionDS</strong> to interpret a number as a string of<br />
digits, two digits per byte. You can specify a size of between 1 and 16 bytes,<br />
inclusive, which allows a number to be 32 digits.<br />
For real numbers, you can specify a maximum precision of the number of<br />
digits that the bytes can hold. The default size is eight bytes and a two-digit<br />
precision.<br />
For integers, the default size is four bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
If a number is stored in character format, you can specify that the field is<br />
TEXTUAL. The way in which the number is stored depends on the basic data<br />
type of the number.<br />
For more information: See the “Textual file structures” section beginning<br />
on page 1-37.<br />
Unsigned attribute<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
The UNSIGNED attribute causes <strong>AionDS</strong> to interpret a number as a positive<br />
value without a sign bit.<br />
For example, a field in a record defined as INTEGER(2) can hold integer<br />
values between -32,768 and 32,767, inclusive. If the UNSIGNED attribute is<br />
specified, as in the following example, the sign bit is interpreted as part of the<br />
value and the field can hold values between 0 and 65,535, inclusive:<br />
file of record<br />
air_type is string<br />
range is integer(2, unsigned)<br />
end
Zoned attribute<br />
Non-textual file structures<br />
Integers and real numbers in ZONED or PACKED representation can be<br />
UNSIGNED. Integer data includes Booleans, dates, and times.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
The ZONED attribute causes <strong>AionDS</strong> to interpret a number as zoned-decimal,<br />
which is similar to a character display format. The size of the number is<br />
between 1 and 32,767 bytes, inclusive.<br />
For real numbers, the maximum precision is the number of bytes. The<br />
default size is eight bytes, with 2-digit precision.<br />
For integers, the default size is four bytes.<br />
Type Definition <strong>Language</strong> 1-53
Non-textual file structures<br />
No certainty information attribute<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
1-54 <strong>Language</strong> <strong>Reference</strong><br />
The attribute NOATTR cancels the reading or writing of certainty<br />
information. Ordinarily, <strong>AionDS</strong> keeps certainty information about each<br />
field in a file. You might not want to keep certainty information, particularly<br />
if the file is used by non-<strong>AionDS</strong> software.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Omitting NOATTR<br />
If you do not specify NOATTR, <strong>AionDS</strong> keeps a one-byte certainty attribute<br />
with each field, and with each higher-level element in the record. For<br />
example, consider the following file definition:<br />
file of record<br />
set1 is set (10) of string (10)<br />
int1 is integer(2)<br />
details is record<br />
str1 is string(10)<br />
bln1 is boolean(1)<br />
r1 is real (8:2)<br />
end<br />
end<br />
The field sizes in the record total 121 bytes. There is an attribute byte for<br />
each of the following items:<br />
■ The record itself<br />
■ Each of the 10 strings in SET1<br />
■ SET1<br />
■ INT1<br />
■ The DETAILS record<br />
■ STR1<br />
■ BLN1<br />
■ R1<br />
There are 17 attribute bytes in the record. The record size, therefore, is 138<br />
bytes.
Non-textual file structures<br />
.........................................................................................................................................................................................................˝..........................................<br />
Using NOATTR for<br />
entire structure<br />
You can use the NOATTR attribute at an outermost level of the data structure<br />
to suppress the attribute bytes for the entire data structure. The following<br />
example shows suppression of all attribute bytes:<br />
file (noattr) of record<br />
set1 is set (10) of string (10)<br />
int1 is integer(2)<br />
details is record<br />
str1 is string(10)<br />
bln1 is boolean(1)<br />
r1 is real (8:2)<br />
end<br />
end<br />
In this case, the record contains no attribute bytes and the record length is<br />
121 bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Using NOATTR at<br />
field level<br />
You can suppress the attribute byte for individual fields, by specifying<br />
NOATTR on the field. Consider the following example:<br />
file of record<br />
set1 is set (10) of string (10, noattr)<br />
int1 is integer(2)<br />
details is record<br />
str1 is string(10, noattr)<br />
bln1 is boolean(1)<br />
r1 is real (8:2)<br />
end<br />
end<br />
The attribute byte for each of the 10 strings in SET1 is suppressed, along with<br />
the attribute byte for STR1. The attribute byte for SET1, however, remains.<br />
To remove the attribute byte for SET1, specify the following type definition:<br />
file of record<br />
set1 is set (10, noattr) of string (10, noattr)<br />
int1 is integer(2)<br />
details is record<br />
str1 is string(10, noattr)<br />
bln1 is boolean(1)<br />
r1 is real (8:2)<br />
end<br />
end<br />
Type Definition <strong>Language</strong> 1-55
Non-textual file structures<br />
1-56 <strong>Language</strong> <strong>Reference</strong><br />
In this example, the record contains 5 attribute bytes, one for each of the<br />
following items:<br />
■ The record itself<br />
■ INT1<br />
■ The DETAILS record<br />
■ BLN1<br />
■ R1
Non-textual file example<br />
Non-textual file structures<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following example shows the Base Type property of a VSAM file<br />
parameter.<br />
file (vsam,noattr) of record<br />
cust_no is integer (6,textual)<br />
cust_name is string (24)<br />
credit limit is real (packed,4:2)<br />
last_update is date (2,unsigned)<br />
purchases is list (10,writelength) of<br />
real (fixed,4:2)<br />
end<br />
The file is a VSAM file. No certainty information is kept within the file. It<br />
is a non-textual file since the TEXTUAL attribute is not specified with the file<br />
specification.<br />
For more information: See the “File attributes” section on page 1-31<br />
about file attributes.<br />
The CUST_NO field is a 6-byte integer stored one digit per byte. It is stored<br />
in ASCII on the PC and EBCDIC on the mainframe. The CUST_NAME is a<br />
24-byte string, which is also stored in ASCII on the PC and EBCDIC on the<br />
mainframe.<br />
The CREDIT_LIMIT field is a real number, stored as a packed-decimal<br />
number in four bytes. It can hold an 8-digit number, of which two digits<br />
represent the fraction.<br />
The LAST_UPDATE field is a date, stored as a 2-byte unsigned integer.<br />
Because the sign bit is treated as data, the field can hold values from 1900<br />
through 2079 (65,536/365 = 179 years).<br />
The PURCHASES field is a list of ten or fewer real numbers in fixed-point<br />
notation. Each value is stored in a 4-byte integer. Two digits of each<br />
number represent the decimal point. The WRITELENGTH attribute causes<br />
<strong>AionDS</strong> to place at the beginning of the list a 2-byte field that contains the<br />
number of elements in the list.<br />
Type Definition <strong>Language</strong> 1-57
Non-textual file structures<br />
1-58 <strong>Language</strong> <strong>Reference</strong><br />
The record size is 78 bytes. The record size is determined by the field sizes,<br />
which are as follows:<br />
Field Size in bytes<br />
cust_no 6<br />
cust_name 24<br />
credit_limit 4<br />
last_update 2<br />
purchases 42<br />
Total 78
Chapter 2<br />
TDL Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Introduction<br />
This chapter describes the complete syntax for the Type Definition <strong>Language</strong><br />
(TDL). You use TDL to specify the data type of slots and parameters. You<br />
can use TDL in the following places:<br />
■ Base Type property of slots and parameters<br />
■ Type Definition property of type objects<br />
■ Function Arguments, Local Variables, and Return Value properties of<br />
functions.<br />
■ Class Definition property of classes<br />
.........................................................................................................................................................................................................˝..........................................<br />
In this chapter<br />
Topic Page<br />
Type Definition <strong>Language</strong> syntax 2-2<br />
Constraints in TDL 2-35<br />
TDL summary 2-38<br />
TDL Syntax 2-1
Type Definition <strong>Language</strong> syntax<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
2-2 <strong>Language</strong> <strong>Reference</strong><br />
The following sections describe the syntax of each data type. The syntax for<br />
constraints follows the data type sections.<br />
The following data types are supported:<br />
■ Boolean ■ Pointer<br />
■ Date ■ Real<br />
■ File ■ Record<br />
■ Integer ■ Set<br />
■ Instance ■ String<br />
■ List ■ Time<br />
■ Object-Pointer<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,” for<br />
general information on the use of TDL.
Boolean<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax for BOOLEAN data types:<br />
{BOOLEAN | [library::]type_ref} [( [size | attrib] [,<br />
attrib ... ] )]<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
type_ref<br />
is a type object that resolves to a Boolean data type.<br />
.........................................................................................................................................................................................................˝..........................................<br />
size<br />
is the length, in bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
NOATTR Data does not include a certainty byte.<br />
NOMENU Do not display a menu of choices.<br />
NOUNKNOWN Do not allow UNKNOWN input.<br />
OUTPUT Identifies a function argument as an output argument.<br />
PACKED Represent data in packed-decimal format, two digits per<br />
byte.<br />
TEXTUAL Data is in character format.<br />
UNSIGNED Data is non-negative.<br />
ZONED Represent data in zoned-decimal format, which is<br />
character display format.<br />
TDL Syntax 2-3
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
2-4 <strong>Language</strong> <strong>Reference</strong><br />
■ You can specify size and attrib in any order.<br />
■ It is only necessary to specify size if the Boolean is used in an external file<br />
or is passed into or out of <strong>AionDS</strong> using API.<br />
■ If the Boolean is a field in a non-textual file, the default size is one byte.<br />
■ The PACKED, ZONED, and TEXTUAL attributes are mutually exclusive.<br />
■ If the Boolean is a field in a textual file, the FILE-YES-STRING and FILE-<br />
NO-STRING profile options control the format of the field in the file.<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,” for<br />
more information about field specifications, attributes, and masks.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following Base Type property specifies that the data type of the slot is a<br />
Boolean:<br />
Boolean (2,nomenu,noattr)<br />
Two bytes of data are transferred between <strong>AionDS</strong> and the external data<br />
structure, either TU or FA. No attribute byte is transferred with the data. A<br />
menu is not presented during user sourcing.<br />
If the Boolean is only used within <strong>AionDS</strong>, you do not need to specify size or<br />
attributes information, such as NOATTR. The following Base Type property<br />
is sufficient in this case:<br />
Boolean (nomenu)<br />
If the nomenu Boolean type exists in the Global included library, you would<br />
specify the following in the Base Type property of a slot:<br />
Boolean (Global::nomenu)
Date<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax for DATE data types:<br />
{ DATE | [library::]type_ref | constraint }<br />
[(size | attrib [, attrib ... ])]<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
type_ref<br />
is a type object that resolves to a date data type.<br />
.........................................................................................................................................................................................................˝..........................................<br />
constraint<br />
is a numeric constraint.<br />
.........................................................................................................................................................................................................˝..........................................<br />
size<br />
is the length, in bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
NOATTR Data does not include a certainty byte.<br />
NOUNKNOWN Do not allow UNKNOWN input.<br />
OUTPUT Identifies a function argument as an output argument.<br />
PACKED Represent data in packed-decimal format, two digits per<br />
byte.<br />
TEXTUAL Data is in character format.<br />
UNSIGNED Data is non-negative.<br />
TDL Syntax 2-5
Type Definition <strong>Language</strong> syntax<br />
2-6 <strong>Language</strong> <strong>Reference</strong><br />
ZONED Represent data in zoned-decimal format, which is<br />
character display format.<br />
mask is a date mask.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Internally, <strong>AionDS</strong> stores a date as a positive integer. The value<br />
represents the number of days from January 1, 1900.<br />
■ You can specify size and attrib in any order.<br />
■ It is only necessary to specify size if the date is used in an external file or<br />
is passed into or out of <strong>AionDS</strong> using API.<br />
■ If the date is a field in a non-textual file, the default size is four bytes.<br />
■ The PACKED, ZONED, and TEXTUAL attributes are mutually exclusive.<br />
■ If the Boolean is a field in a textual file, the FILE-DATE-MASK profile<br />
option controls the format of the field in the file.<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,” for<br />
more information about field specifications, attributes, and masks.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following Base Type property specifies a date that cannot be entered as<br />
UNKNOWN:<br />
date (nounknown)<br />
The following Base Type property specifies that the parameter or slot only<br />
contains dates between 10-OCT-65 and 1-JAN-2000, inclusive:<br />
>= date ('10-oct-65'),
File<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax for FILE data types:<br />
FILE [( [attrib] [, attrib ... ] )]<br />
OF [library::]rec_type<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
DBASE is the access method for databases that use dBASE.<br />
DLI is the access method for DL/I databases.<br />
ESDS is a VSAM dataset organization.<br />
KSDS is a VSAM dataset organization.<br />
NOATTR Data does not include a certainty byte.<br />
OUTPUT Identifies a function argument as an output argument.<br />
QSAM is the Queued Sequential Access Method that allows<br />
sequential access to records in a file. On non-mainframe<br />
platforms, QSAM is implemented using the flat file<br />
access services for the host environment.<br />
RRDS is a VSAM dataset organization.<br />
SQL is an access method for relational databases that use<br />
SQL.<br />
TEXTUAL Data is in character format.<br />
TDL Syntax 2-7
Type Definition <strong>Language</strong> syntax<br />
2-8 <strong>Language</strong> <strong>Reference</strong><br />
VARIABLE Records are variable length.<br />
VSAM is the Virtual Storage Access Method that supports<br />
sequential and direct access using key fields, relative<br />
record numbers, or absolute addresses.<br />
.........................................................................................................................................................................................................˝..........................................<br />
rec_type<br />
is a data type or type object that resolves to a record.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You must choose the access method that corresponds to the data<br />
management system in which the data is stored. <strong>AionDS</strong> environments<br />
support the following access methods:<br />
Environment Access methods<br />
<strong>AionDS</strong>/PC QSAM, SQL, DBASE<br />
<strong>AionDS</strong>/Win QSAM, SQL, DBASE, VSAM<br />
<strong>AionDS</strong>/2 QSAM, SQL, DBASE, VSAM<br />
<strong>AionDS</strong>/MVS QSAM, VSAM, SQL<br />
<strong>AionDS</strong>/IMS QSAM, VSAM, SQL, DLI<br />
<strong>AionDS</strong>/CICS QSAM, VSAM, SQL, DLI<br />
<strong>AionDS</strong>/HP-UX QSAM, SQL<br />
<strong>AionDS</strong>/Solaris QSAM, SQL<br />
<strong>AionDS</strong>/AIX QSAM, SQL<br />
■ The DBASE, DLI, QSAM, SQL, and VSAM attributes are mutually<br />
exclusive.<br />
■ If you do not specify an access method attribute, <strong>AionDS</strong> assumes QSAM.<br />
■ You cannot use FILE data types in the Return Value property of a<br />
function.<br />
■ The attributes ESDS, KSDS, and RRDS are valid only with the VSAM<br />
access method. These attributes are ignored if the VSAM access is local or<br />
the CICS transaction driver returns the dataset organization. You can<br />
specify the dataset organization following VSAM or you can omit VSAM.
Type Definition <strong>Language</strong> syntax<br />
If the VSAM data resides in a File Owning Region (FOR) that is separate<br />
from the Application Owning Region (AOR), you must specify a VSAM<br />
dataset organization.<br />
■ <strong>AionDS</strong>/Win and <strong>AionDS</strong>/2 can access VSAM, DL/I and DB2 data on<br />
the mainframe when used with the Cooperative Processing Option.<br />
■ A file parameter cannot be resolved by backward chaining and cannot<br />
initiate forward chaining. You must use a record or instance to hold the<br />
data from the file and reference the record or instance in the rules in<br />
order to perform inferencing on the data read from the file.<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,” for<br />
more information about attrib.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following Type Definition property specifies a type object for a VSAM<br />
file:<br />
file (vsam,noattr) of cust_rec<br />
The following Type Definition property specifies the contents of the record:<br />
file (vsam,noattr) of record<br />
cust_no is integer(2)<br />
cust_name is string(20)<br />
cust_addr is string(20)<br />
cust_city is string(20)<br />
cust_state is string(2)<br />
cust_zip is string(5)<br />
cust_phone is string(10)<br />
end<br />
TDL Syntax 2-9
Type Definition <strong>Language</strong> syntax<br />
Integer<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
2-10 <strong>Language</strong> <strong>Reference</strong><br />
Use the following syntax for INTEGER data types:<br />
{ INTEGER | [library::]type_ref | constraint } [(size |<br />
attrib [, attrib ... ])]<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
type_ref<br />
is a type object that resolves to an integer data type.<br />
.........................................................................................................................................................................................................˝..........................................<br />
constraint<br />
is a numeric constraint.<br />
.........................................................................................................................................................................................................˝..........................................<br />
size<br />
is the length, in bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
NOATTR Data does not include a certainty byte.<br />
NOUNKNOWN Do not allow UNKNOWN input.<br />
OUTPUT Identifies a function argument as an output argument.<br />
PACKED Represent the number externally in packed-decimal<br />
format, two digits per byte.<br />
TEXTUAL Represent the number externally is in character format<br />
(with leading spaces or zeros).<br />
UNSIGNED Data is non-negative.
Type Definition <strong>Language</strong> syntax<br />
ZONED Represent the number externally in zoned-decimal<br />
format, which is similar to storing the digits as display<br />
characters (with leading zeros).<br />
mask is an integer mask.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ An integer can hold a whole number from -2,147,483,648 to<br />
2,147,483,647, inclusive.<br />
■ You can specify size and attrib in any order.<br />
■ It is only necessary to specify size if the integer is used in an external file<br />
or is passed into or out of <strong>AionDS</strong> using API.<br />
■ If the integer is a field in a non-textual file, the default size is four bytes.<br />
■ The PACKED, ZONED, and TEXTUAL attributes are mutually exclusive.<br />
■ If the integer is a field in a textual file read into <strong>AionDS</strong>, the number<br />
should be right-justified with either leading zeros or spaces. A sign can<br />
appear immediately to the left of the first digit. <strong>AionDS</strong> always writes<br />
textual integers as right-justified with leading spaces.<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,”<br />
about field specifications, attributes, and masks.<br />
TDL Syntax 2-11
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
2-12 <strong>Language</strong> <strong>Reference</strong><br />
The following Base Type property specifies an integer that cannot be entered<br />
as UNKNOWN:<br />
integer (nounknown)<br />
The following Base Type property specifies a positive non-zero integer that<br />
cannot be entered as UNKNOWN:<br />
>0 (nounknown)<br />
The following Base Type property specifies an integer that is transferred<br />
between <strong>AionDS</strong> and an external data source:<br />
integer(2,noattr)<br />
The data is stored externally as a 2-byte integer, without certainty<br />
information.
Instance<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax for INSTANCE data types:<br />
INSTANCE OF [library::]{ class | type_ref }<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class or type object exists.<br />
The library name is only required when duplicate class or type names exist in<br />
any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
class<br />
is a class name.<br />
.........................................................................................................................................................................................................˝..........................................<br />
type_ref<br />
is a type object that resolves to an instance data type.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
You can only use INSTANCE in an input or output argument to a function.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement shows the Input Arguments property for a function:<br />
instance of credit<br />
CREDIT is the name of a class.<br />
TDL Syntax 2-13
Type Definition <strong>Language</strong> syntax<br />
List<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
2-14 <strong>Language</strong> <strong>Reference</strong><br />
Use the following syntax for LIST data types:<br />
LIST [( size | attrib [, attrib ... ] )]<br />
OF [library::]res_type<br />
.........................................................................................................................................................................................................˝..........................................<br />
size<br />
is the maximum number of elements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
CHECKLENGTH Check the length of input data.<br />
NOATTR Data does not include certainty information.<br />
NOEMPTY Require at least one value to be entered.<br />
NOUNKNOWN Do not allow UNKNOWN input.<br />
OUTPUT Identifies a function argument as an output argument.<br />
TEXTUAL Data is in character format.<br />
WRITELENGTH A two-byte length field exists before the data.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
res_type<br />
is a data type or type object that resolves to a Boolean, string, integer, real,<br />
date, time, set, list, pointer, record, or constraint.
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ A list is an ordered collection of elements.<br />
■ All elements have the same base type and the base type of the elements<br />
specify the base type of the list.<br />
■ A list can hold 32,767 elements.<br />
■ The following list data types are predefined:<br />
Data type Description<br />
INTEGER_LIST A list of integers<br />
REAL_LIST A list of real numbers<br />
STRING_LIST A list of strings<br />
If you use one of these data types instead of LIST, do not specify OF<br />
res_type.<br />
■ You can specify size and attrib in any order.<br />
■ Unless the CHECKLENGTH attribute is used, specify size if the list is used<br />
in an external file or is passed into or out of <strong>AionDS</strong> using API. The size<br />
specifies the maximum number of elements that the list can contain.<br />
The default is zero elements, which causes <strong>AionDS</strong> to ignore the list<br />
during input and output.<br />
■ You cannot use LIST data types in the Return Value property of a<br />
function.<br />
■ You cannot specify a list of records in the Base Type property of a slot.<br />
■ If you specify WRITELENGTH for a non-textual file, <strong>AionDS</strong> writes a<br />
two-byte field at the beginning of the list that contains the number of<br />
elements. On input, <strong>AionDS</strong> reads only elements that are part of the<br />
original list. If you do not specify WRITELENGTH, <strong>AionDS</strong> reads in the<br />
maximum number of elements into the parameter or slot and the nonoriginal<br />
elements become UNKNOWN. For TEXTUAL files,<br />
WRITELENGTH is ignored.<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,”<br />
about field specifications, attributes, and masks.<br />
TDL Syntax 2-15
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
2-16 <strong>Language</strong> <strong>Reference</strong><br />
The following Base Type property specifies a list of Boolean values, for which<br />
at least one value must be entered during user sourcing:<br />
list (noempty) of Boolean<br />
The following Base Type property specifies a list of integers, for which at least<br />
one value must be entered during user sourcing:<br />
integer_list (noempty)<br />
The following Base Type property specifies a list of positive non-zero integers,<br />
for which at least one value must be entered during user sourcing:<br />
> 0 (noempty)<br />
The following Base Type property specifies a list of positive non-zero real<br />
numbers, for which at least one value must be entered during user sourcing:<br />
> 0.0 (noempty)<br />
The following Base Type property specifies a list of constrained strings:<br />
list of from ('red','white','blue')<br />
The following Base Type property specifies a list of pointers to class<br />
CUSTOMER:<br />
list of pointer to customer<br />
The following Base Type property specifies a list of records:<br />
list of record<br />
cust_no is integer<br />
cust_name is string<br />
end
Object_Pointer<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
OBJECT_POINTER is used to efficiently represent a link to an object within<br />
the knowledge base. Its use is restricted to the attachment schema of the<br />
window interface and DDE classes (WINLIB). That is, this data type is only<br />
used with graphical knowledge bases.<br />
A parameter or slot that is of type OBJECT_POINTER contains an internal<br />
representation of another object in the knowledge base. This internal<br />
representation allows the system to quickly locate and manipulate the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax to define OBJECT_POINTER data types:<br />
OBJECT_POINTER<br />
Use the following syntax to define values for an object of the<br />
OBJECT_POINTER type:<br />
objecttype { ( [library::]contextname<br />
([library::]objectname) ) | ([library::] objectname) }<br />
.........................................................................................................................................................................................................˝..........................................<br />
objecttype<br />
is one of the <strong>AionDS</strong> object types:<br />
MESSAGE<br />
PARAMETER<br />
SLOT<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the context or object exists. The<br />
library name is only required when duplicate context or object names exist in<br />
any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
TDL Syntax 2-17
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
contextname<br />
2-18 <strong>Language</strong> <strong>Reference</strong><br />
is the name of the context that owns the object. The context name is<br />
optional.<br />
.........................................................................................................................................................................................................˝..........................................<br />
objectname<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
For example, an object with the data type OBJECT_POINTER could have a<br />
value as follows:<br />
message (Results)<br />
parameter (Main (LoginName))<br />
slot (Problem(Problem_0001).ProblemNumber)<br />
The base type of these objects would be OBJECT_POINTER in each case.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Modifying and<br />
comparing<br />
If you need to set or compare the value of an OBJECT_POINTER parameter,<br />
use the same syntax for all cases except for slots.<br />
.............................................................................................................................................................................<br />
Syntax<br />
For slots, use the following syntax:<br />
slot ( [instance_ref.] slotname)<br />
instance_ref is a reference to a specific instance. It may have<br />
one of these forms:<br />
class_name(instance_name)<br />
instance_pointer-><br />
static_instance_name<br />
instance_ref. may be omitted if you are<br />
referring to a slot in the current instance.<br />
slotname is the name of the desired slot.
Type Definition <strong>Language</strong> syntax<br />
.............................................................................................................................................................................<br />
Examples<br />
For example, if you have a text window called MY_TW, you can see if the<br />
message MSG1 is attached to it:<br />
if my_tw.attachedobject = message(msg1)<br />
then ...<br />
If you have a pointer to an instance (in the parameter PTR), you could refer<br />
to the slot NAME in the following way:<br />
slot(ptr->.name)<br />
TDL Syntax 2-19
Type Definition <strong>Language</strong> syntax<br />
Pointer<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
2-20 <strong>Language</strong> <strong>Reference</strong><br />
Use the following syntax for POINTER data types:<br />
POINTER TO [library::]class | [library::]type_ref<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
class<br />
is a class name.<br />
.........................................................................................................................................................................................................˝..........................................<br />
type_ref<br />
is a type object that resolves to a pointer data type.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following Base Type property specifies a pointer to the class CREDIT:<br />
pointer to credit<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You use a pointer to reference instances in a class.<br />
■ You can use a pointer to reference instances in the specified class or any<br />
of its subclasses. However, you cannot use a pointer to a parent class to<br />
reference slots or methods in a subclass that do not exist in the parent<br />
class.
Real<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax for REAL data types:<br />
{ REAL | [library::]type_ref | constraint }<br />
[(size[:precision] | attrib [, attrib ... ])]<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
type_ref<br />
is a type object that resolves to a real data type.<br />
.........................................................................................................................................................................................................˝..........................................<br />
constraint<br />
is a numeric constraint.<br />
.........................................................................................................................................................................................................˝..........................................<br />
size<br />
is the length, in bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
precision<br />
is the number of digits to the right of an implied decimal point.<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
FIXED Represent the number externally in fixed-point notation<br />
as a two-byte or four-byte integer.<br />
NOATTR Data does not include a certainty byte.<br />
NOUNKNOWN Do not allow UNKNOWN input.<br />
OUTPUT Identifies a function argument as an output argument.<br />
PACKED Represent the number externally in packed-decimal<br />
format, two digits per byte.<br />
TDL Syntax 2-21
Type Definition <strong>Language</strong> syntax<br />
2-22 <strong>Language</strong> <strong>Reference</strong><br />
TEXTUAL Represent the number externally in character format<br />
(with leading spaces or zeros).<br />
UNSIGNED Data is non-negative.<br />
ZONED Represent the number externally in zoned-decimal<br />
format, which is similar to storing the digits as display<br />
characters (with leading zeros).<br />
mask is a real mask.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The default real number is floating-point number between ±1.0E±306<br />
on the PC and between -5.3E-79 and 7.2E+75 on the mainframe.<br />
■ FIXED, PACKED, ZONED, and TEXTUAL are mutually exclusive. If you<br />
do not specify one of these attributes, <strong>AionDS</strong> assumes that external data<br />
is in floating-point notation.<br />
■ You can specify size and attrib in any order.<br />
■ It is only necessary to specify size if the real is used in an external file or is<br />
passed into or out of <strong>AionDS</strong> using API. If the FIXED attribute is<br />
specified, you must specify size.<br />
■ You can specify the total size and precision of a real data type. The<br />
following table shows the kind of real, the size, precision, and default.<br />
When the size and precision are not specified for a real, the size and<br />
precision defaults are used.<br />
Data type Size<br />
(bytes)<br />
Precision<br />
(digits)<br />
REAL (floating) 4 or 8 n.a. 8:2<br />
REAL FIXED 2 or 4 0 - 5 or 0 - 10 none<br />
REAL PACKED 1 - 16 1 - size 8:2<br />
REAL ZONED 1 - 32767 1 - size 8:2<br />
Default<br />
(size:precision)<br />
The notation “n.a.” indicates that the precision is not relevant when<br />
storing and transferring values with this data type. In the Precision<br />
column, the notation “size” indicates that the precision can be up to the
Type Definition <strong>Language</strong> syntax<br />
size that you specify, which must be less than or equal to the value for<br />
size shown in the Size column.<br />
■ Precision follows the size and is preceded by a colon. Precision indicates<br />
the number of digits to the right of the decimal point. For example, 8:2<br />
after REAL PACKED indicates that the total size of the data is 8 bytes and<br />
the precision is in hundredths (10 -2 ). Precision is used when the number<br />
is translated into a textual format.<br />
■ If the real number is a field in a textual file read into <strong>AionDS</strong>, the<br />
number should be right-justified with either leading zeros or spaces. A<br />
sign can appear immediately to the left of the first digit. You should<br />
make the field large enough to hold a decimal point and, if applicable,<br />
the minus ( - ) sign for negative values. <strong>AionDS</strong> always writes textual<br />
real numbers as right-justified with leading spaces.<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,”<br />
about field specifications, attributes, and masks.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following Base Type specifies a real data type, for which UNKNOWN is<br />
not allowed during user sourcing:<br />
real (nounknown)<br />
The following Base Type specifies a real data type that is greater than one, for<br />
which UNKNOWN is not allowed during user sourcing:<br />
>1.0 (nounknown)<br />
The following Base Type specifies a real data type for a floating point number<br />
that is stored externally to <strong>AionDS</strong>:<br />
real (8, noattr)<br />
The length of the external data is eight bytes. It does not include a certainty<br />
byte.<br />
The following Base Type specifies a real data type for a fixed point number<br />
that is stored externally to <strong>AionDS</strong>:<br />
real (4:2, fixed, noattr)<br />
TDL Syntax 2-23
Type Definition <strong>Language</strong> syntax<br />
2-24 <strong>Language</strong> <strong>Reference</strong><br />
The length of the external data is four bytes. The precision is two digits. It<br />
does not include a certainty byte.<br />
The following Base Type specifies a real data type for a packed decimal<br />
number that is stored externally to <strong>AionDS</strong>:<br />
real (16:4, packed, noattr)<br />
The length of the external data is sixteen bytes. The precision is four digits.<br />
It does not include a certainty byte.<br />
The following Base Type specifies a real data type for a zoned number that is<br />
stored externally to <strong>AionDS</strong>:<br />
real (40:8, zoned, noattr)<br />
The length of the external data is forty bytes. The precision is 8 digits. It<br />
does not include a certainty byte.
Record<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax for RECORD data types:<br />
RECORD [( attrib [, attrib ... ] )]<br />
field_name [(dl1_alias)] IS [library::]res_type<br />
[field_name [(dl1_alias)] IS [library::]res_type ...] END<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
NOATTR Data does not include certainty information.<br />
OUTPUT Identifies a function argument as an output argument.<br />
TEXTUAL Data is in character format.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
res_type<br />
is a data type or type object that resolves to a Boolean, string, integer, real,<br />
date, time, set, list, pointer, record, or constraint.<br />
.........................................................................................................................................................................................................˝..........................................<br />
field_name<br />
is the name of the <strong>AionDS</strong> record field.<br />
.........................................................................................................................................................................................................˝..........................................<br />
dl1_alias<br />
is the name of the DL/I field that corresponds to the <strong>AionDS</strong> field.<br />
TDL Syntax 2-25
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You cannot use RECORD data types in the Return Value property of a<br />
function.<br />
2-26 <strong>Language</strong> <strong>Reference</strong><br />
■ You can nest records. See Chapter 1, “Type Definition <strong>Language</strong>,” for<br />
more information.<br />
■ You cannot specify a record in the Base Type property of a slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following Base Type property defines a record in <strong>AionDS</strong>:<br />
record<br />
cust_no is integer<br />
cust_name is string<br />
cust_balance is real<br />
end<br />
The following Base Type property defines a record format that is used by an<br />
external data structure:<br />
record (textual,noattr)<br />
cust_no is integer(8)<br />
cust_name is string(24)<br />
cust_balance is real(10:2)<br />
end<br />
In a TEXTUAL record, each character position is a character or digit. The<br />
record is 42 bytes long.<br />
You can nest records. The following Base Type property of a parameter<br />
shows CUST_ADDR as a nested record:<br />
record<br />
cust_no is integer<br />
cust_name is string<br />
cust_addr is addr_rec<br />
cust_balance is real<br />
end<br />
The Type Definition property of the ADDR_REC type object is as follows:<br />
record<br />
addr_line1 is string<br />
addr_line2 is string<br />
city is string<br />
state is string<br />
zip is integer<br />
end
Set<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax for SET data types:<br />
[[MULTIPLE] CERTAINTY] SET [(size | attrib<br />
[, attrib ... ])] OF [library::]res_type<br />
.........................................................................................................................................................................................................˝..........................................<br />
size<br />
is the maximum number of elements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
CHECKLENGTH Check the length of input data.<br />
NOATTR Data does not include certainty information.<br />
NOEMPTY Require at least one element to have a value.<br />
NOMENU Do not display a menu of choices.<br />
NOUNKNOWN Do not allow UNKNOWN input.<br />
OUTPUT Identifies a function argument as an output<br />
argument.<br />
TEXTUAL Data is in character format.<br />
WRITELENGTH A two-byte length field exists before the data.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
res_type<br />
is a data type or type object that resolves to a Boolean, string, integer, real,<br />
date, time, set, list, pointer, record, or constraint.<br />
TDL Syntax 2-27
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
2-28 <strong>Language</strong> <strong>Reference</strong><br />
■ A set is an unordered collection of items in which each item is unique. A<br />
certainty set is a set that contains pairs of values and certainty factors.<br />
■ All elements have the same base type and the base type of the elements<br />
specify the base type of the set.<br />
■ A set can hold 32,767 elements.<br />
■ The following set data types are predefined:<br />
Data type Description<br />
INTEGER_SET A set of integers<br />
REAL_SET A set of real numbers<br />
STRING_SET A set of strings<br />
If you use one of these data types instead of SET, do not specify OF<br />
res_type.<br />
■ You can specify size and attrib in any order.<br />
For more information: See Appendix A about certainty sets.<br />
■ Unless the CHECKLENGTH attribute is used, specify size if the set is used<br />
in an external file or is passed into or out of <strong>AionDS</strong> using API. The<br />
size specifies the maximum number of elements that the set can contain.<br />
The default is zero elements, which causes <strong>AionDS</strong> to ignore the set<br />
during input and output.<br />
■ You cannot use SET data types in the Return Value property of a<br />
function.<br />
■ You cannot specify a set of records in the Base Type property of a slot.<br />
■ If you specify WRITELENGTH for a non-textual file, <strong>AionDS</strong> writes a<br />
two-byte field at the beginning of the set that contains the number of<br />
elements. On input, <strong>AionDS</strong> reads only elements that are part of the<br />
original set. If you do not specify WRITELENGTH, <strong>AionDS</strong> reads in the<br />
maximum number of elements into the parameter or slot and the nonoriginal<br />
elements become UNKNOWN. For textual files, WRITELENGTH<br />
is ignored.
Type Definition <strong>Language</strong> syntax<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,”<br />
about field specifications, attributes, and masks.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following Base Type property specifies a set of Boolean values, for which<br />
at least one value must be entered during user sourcing:<br />
set (noempty) of Boolean<br />
The following Base Type property specifies a set of integers, for which at least<br />
one value must be entered during user sourcing:<br />
integer_set (noempty)<br />
The following Base Type property specifies a set of positive non-zero integers,<br />
for which at least one value must be entered during user sourcing:<br />
> 0 (noempty)<br />
The following Base Type property specifies a set of positive non-zero real<br />
numbers, for which at least one value must be entered during user sourcing:<br />
> 0.0 (noempty)<br />
The following Base Type property specifies a set of constrained strings:<br />
set of from ('red','white','blue')<br />
The following Base Type property specifies a set of pointers to class<br />
CUSTOMER:<br />
set of pointer to customer<br />
The following Base Type property specifies a set of records:<br />
set of record<br />
cust_no is integer<br />
cust_name is string<br />
end<br />
TDL Syntax 2-29
Type Definition <strong>Language</strong> syntax<br />
String<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
2-30 <strong>Language</strong> <strong>Reference</strong><br />
Use the following syntax for STRING data types:<br />
{ STRING | [library::]type_ref | constraint }<br />
[(size | attrib [, attrib ... ])]<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
type_ref<br />
is a type object that resolves to a string data type.<br />
.........................................................................................................................................................................................................˝..........................................<br />
constraint<br />
is a string constraint.<br />
.........................................................................................................................................................................................................˝..........................................<br />
size<br />
is the length, in bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
CHECKLENGTH Check the length of input data.<br />
MEMO String value maps to a dBASE memo file.<br />
NOATTR Data does not include a certainty byte.<br />
NOEMPTY Require a value to be entered.<br />
NOMENU Do not display a menu of choices.<br />
NOTRIM Preserve leading and trailing spaces on input.<br />
NOUNKNOWN Do not allow UNKNOWN input.<br />
OUTPUT Identifies a function argument as an output argument.
TEXT Allow multiple lines of text input.<br />
TEXTUAL Data is in character format.<br />
UPPERCASE Convert input data to uppercase.<br />
Type Definition <strong>Language</strong> syntax<br />
WRITELENGTH Write a two-byte length field before the data.<br />
mask is a string mask.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ A string can hold up to 65,512 bytes, inclusive.<br />
■ You can specify size and attrib in any order.<br />
■ Unless the CHECKLENGTH attribute is used, specify size if the string is<br />
used in an external file or is passed into or out of <strong>AionDS</strong> using API.<br />
The default size is 255 bytes.<br />
■ If you specify WRITELENGTH for a non-textual file, <strong>AionDS</strong> writes a<br />
two-byte field at the beginning of the string that contains the actual size<br />
of the string before it is padded with trailing blanks. On input, the pad<br />
characters are removed and the string becomes its original length again.<br />
If you do not specify WRITELENGTH, <strong>AionDS</strong> does not keep any trailing<br />
blanks, even if they were part of the original string. For textual files,<br />
WRITELENGTH is ignored.<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,”<br />
about field specifications, attributes, and masks.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following Base Type property specifies a string that cannot be entered as<br />
UNKNOWN:<br />
string (nounknown)<br />
The following Base Type property specifies a constrained string that cannot<br />
be entered as UNKNOWN:<br />
is from ('red','white','blue') (nounknown)<br />
The following Base Type property specifies a string that is transferred<br />
between <strong>AionDS</strong> and an external data source:<br />
string(20,noattr,checklength,writelength)<br />
TDL Syntax 2-31
Type Definition <strong>Language</strong> syntax<br />
2-32 <strong>Language</strong> <strong>Reference</strong><br />
The data is stored externally as a 20-byte string, without certainty<br />
information. The CHECKLENGTH attribute prevents transfer of more than<br />
20 characters. The WRITELENGTH attribute specifies that a two-byte field<br />
exists in front of the string that contains the actual length of the data within<br />
the 20 characters. The total size of the string is 22 bytes.
Time<br />
Type Definition <strong>Language</strong> syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax for TIME data types:<br />
{ TIME | [library::]type_ref | constraint }<br />
[(size | attrib [, attrib ... ])]<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the type object exists. The<br />
library name is only required when duplicate type names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
type_ref<br />
is a type object that resolves to a time data type.<br />
.........................................................................................................................................................................................................˝..........................................<br />
constraint<br />
is a numeric constraint.<br />
.........................................................................................................................................................................................................˝..........................................<br />
size<br />
is the length, in bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
attrib<br />
is one or more of the following attributes:<br />
NOATTR Data does not include a certainty byte.<br />
NOUNKNOWN Do not allow UNKNOWN input.<br />
OUTPUT Identifies a function argument as an output argument.<br />
PACKED Represent data in packed-decimal format, two digits per<br />
byte.<br />
TEXTUAL Data is in character format.<br />
UNSIGNED Data is non-negative.<br />
TDL Syntax 2-33
Type Definition <strong>Language</strong> syntax<br />
2-34 <strong>Language</strong> <strong>Reference</strong><br />
ZONED Represent the number externally in zoned-decimal<br />
format, which is similar to storing the digits as display<br />
characters.<br />
mask is a time mask.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Internally, <strong>AionDS</strong> represents time as an integer. The value is the<br />
number of one-hundredth seconds from midnight.<br />
■ You can specify size and attrib in any order.<br />
■ It is only necessary to specify size if the time is used in an external file or<br />
is passed into or out of <strong>AionDS</strong> using API.<br />
■ If the time is a field in a non-textual file, the default size is four bytes.<br />
■ The PACKED, ZONED, and TEXTUAL attributes are mutually exclusive.<br />
■ If the time is a field in a textual file, the FILE-TIME-MASK profile option<br />
controls the format of the field in the file.<br />
For more information: See Chapter 1, “Type Definition <strong>Language</strong>,”<br />
about field specifications, attributes, and masks.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following Base Type property specifies a time that cannot be entered as<br />
UNKNOWN:<br />
time (nounknown)<br />
The following Base Type property specifies that the parameter or slot only<br />
contains times between noon and 10:10 p.m., inclusive:<br />
>= time ('12:00'),
Constraints in TDL<br />
Constraints in TDL<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
There are two kinds of constraints, as follows:<br />
■ Numeric constraints<br />
■ String constraints<br />
In TDL, constraints are restricted to constants. You cannot use a parameter<br />
or slot in a TDL constraint.<br />
TDL Syntax 2-35
Constraints in TDL<br />
Numeric constraints<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
2-36 <strong>Language</strong> <strong>Reference</strong><br />
Use the following syntax to specify a constraint for an integer, date, time, or<br />
real number:<br />
{ { > | >= } num_ref [, { < | = 0, < 100<br />
>= date ('10-oct-65'), = time ('12:00'),
String constraints<br />
Constraints in TDL<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
Use the following syntax to specify a constraint for a string:<br />
[IS] FROM (['str' [, 'str'...]])<br />
.........................................................................................................................................................................................................˝..........................................<br />
str<br />
is a string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
is from ('red', 'white', 'blue')<br />
Examples<br />
from ('red', 'white', 'blue')<br />
TDL Syntax 2-37
TDL summary<br />
TDL summary<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
2-38 <strong>Language</strong> <strong>Reference</strong><br />
The following list summarizes the Type Definition <strong>Language</strong> syntax.<br />
{BOOLEAN | [library::]type_ref} [( [size | attrib] [,<br />
attrib ... ] )]<br />
{ DATE | [library::]type_ref | constraint }<br />
[(size | attrib [, attrib ... ])]<br />
FILE [( [attrib] [, attrib ... ] )]<br />
OF [library::]rec_type<br />
{ INTEGER | [library::]type_ref | constraint } [(size |<br />
attrib [, attrib ... ])]<br />
INSTANCE OF [library::]{class | type_ref }<br />
LIST [( size | attrib [, attrib ... ] )]<br />
OF [library::]res_type<br />
OBJECT_POINTER<br />
POINTER TO [library::]class | type_ref<br />
{ REAL | [library::]type_ref | constraint }<br />
[(size[:precision] | attrib [, attrib ... ])]<br />
RECORD [(attrib [,attrib ... ] )]<br />
field_name [(dl1_alias)] IS [library::]res_type<br />
[field_name [(dl1_alias)] IS [library::]res_type ...] END<br />
[[MULTIPLE] CERTAINTY] SET [(size | attrib<br />
[, attrib ... ])] OF [library::]res_type<br />
{ STRING | [library::]type_ref | constraint }<br />
[(size | attrib [, attrib ... ])]<br />
{ TIME | [library::]type_ref | constraint}<br />
[(size | attrib [, attrib ... ])]
Chapter 3<br />
Knowledge Definition <strong>Language</strong><br />
.........................................................................................................................................................................................................˝..........................................<br />
Introduction<br />
You specify most of the logic in a knowledge base with the Knowledge<br />
Definition <strong>Language</strong> (KDL). Some of the uses of KDL are as follows:<br />
■ To specify inference rules that <strong>AionDS</strong> uses to execute a consultation<br />
■ To specify the Agenda of a state, which controls the flow of a<br />
consultation<br />
■ To specify message passing in object processing applications<br />
■ To specify facts that <strong>AionDS</strong> uses to initialize slots and parameters<br />
■ To specify default values for <strong>AionDS</strong> to use when the value of a<br />
parameter or slot is unknown<br />
■ To specify conditions that must be true before <strong>AionDS</strong> enters a state, or<br />
executes a report, graph, process, or message<br />
■ To write functions attached to methods or other procedural code.<br />
This chapter discusses major constructs that are used in KDL. See Chapter<br />
4, “KDL Statement Syntax,” for KDL statement syntax.<br />
.........................................................................................................................................................................................................˝..........................................<br />
In this chapter<br />
Topic Page<br />
Expressions and operators 3-2<br />
Flow control 3-22<br />
Inference rules 3-23<br />
Message passing 3-26<br />
Agenda statements 3-28<br />
KDL in Facts and Default properties 3-39<br />
Knowledge Definition <strong>Language</strong> 3-1
Expressions and operators<br />
Expressions and operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
3-2 <strong>Language</strong> <strong>Reference</strong><br />
To specify the logic in a knowledge base, you must use KDL statements.<br />
These statements require you to use various expressions and operators.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Expressions<br />
An expression is anything that evaluates to a value. The data type of value<br />
can be a number, string, Boolean, list, set, record, date, time, or pointer. A<br />
Boolean expression, for example, contains a value of either TRUE or FALSE.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Operators<br />
The operators are as follows:<br />
■ Relational operators, such as less than, greater than, equal, an so on<br />
■ Arithmetic operators, such as add, subtract, multiply, divide, and so on<br />
■ Logical operators, such as AND, OR, and so on<br />
■ Selection operators, such as selection of an element from a list or set,<br />
selection of a field from a record, selection of an instance from a class,<br />
and so on.<br />
The following sections describe the expressions and operators that you can<br />
use with in KDL and describes how the expressions and operators are<br />
evaluated in a premise.
Expressions<br />
Expressions and operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Boolean expressions<br />
In KDL, the data type of an expression determines how you can use the<br />
expression. For example, only Boolean expressions can be used in the premise<br />
of a rule, because only Boolean expressions evaluate to TRUE or FALSE.<br />
In many cases, the Base Type property of parameters or slots determine the<br />
kind of expression. The following sections show examples of the kinds of<br />
expressions that you can use.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following expressions are Boolean expressions:<br />
105_PREREQ_TAKEN is a Boolean expression because its Base Type<br />
property is BOOLEAN.<br />
CAR_PRICE > 10000 is a Boolean expression because it evaluates to either<br />
TRUE or FALSE.<br />
SEL_LIST INCLUDES 'PART_100'<br />
is a Boolean expression since it evaluates to either<br />
TRUE or FALSE.<br />
CF(0.5) is a Boolean expression, because the function CF<br />
converts the real number 0.5 into a Boolean value.<br />
Knowledge Definition <strong>Language</strong> 3-3
Expressions and operators<br />
Numeric expressions<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
String expressions<br />
3-4 <strong>Language</strong> <strong>Reference</strong><br />
Numeric expressions can be integers or real numbers. The following<br />
expressions are numeric expressions:<br />
CAR_PRICE is a numeric expression because it is a parameter<br />
with a numeric base type.<br />
5000 is a numeric expression because it evaluates to the<br />
numeric value 5000.<br />
RNUM_LIST(PART_NO) is a numeric expression because the base type of the<br />
list is REAL_LIST. PART_NO is also a numeric<br />
expressions because it evaluates to a position within<br />
the list.<br />
TRUCK(FORDBRONCO).COST<br />
is a numeric expression, because the base type of the<br />
COST slot is real.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following expressions are string expressions:<br />
FIRST is a string expression because its Base Type property<br />
is STRING.<br />
FIRST & SECOND is a string expression because it evaluates to a string<br />
that contains the strings FIRST and SECOND<br />
concatenated together. The ampersand ( & ) is the<br />
concatenation operator.<br />
SEL_LIST(PART_NO) is a string expression because each element in a<br />
STRING_LIST or STRING_SET is a string.
List and set expressions<br />
Expressions and operators<br />
PERSONNEL.L_NAME is a string expression because it identifies the<br />
L_NAME field in the PERSONNEL record, which is<br />
base type STRING. An element of a record is<br />
identified by the record name and the field name,<br />
separated by a dot ( . ).<br />
FSPEC->.LNAME is a string expression, because the L_NAME field in<br />
the record referred to by the FSPEC file parameter is<br />
base type STRING.<br />
'THE OPERATOR' is a string expression because it is a string constant.<br />
'THE OPERATOR''S ADVICE'<br />
is a string expression that results in the string THE<br />
OPERATOR'S ADVICE. Note that the when two<br />
consecutive quote marks ( '' ) are used, <strong>AionDS</strong><br />
interprets them as a single quote ( ' ) within the<br />
string.<br />
'''FILE.NAME''' is a string expression that results in the string<br />
'FILE.NAME'. The resulting string is quoted within<br />
the <strong>AionDS</strong> string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following expressions are list and set expressions:<br />
SEL_LIST can evaluate to either a set or list, depending upon<br />
its base type.<br />
ASORT(NAME_LIST) is a list or set expression because ASORT returns a<br />
sorted list with the same base type as the input list<br />
or set, NAME_LIST.<br />
Knowledge Definition <strong>Language</strong> 3-5
Expressions and operators<br />
Record expressions<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Pointer expressions<br />
3-6 <strong>Language</strong> <strong>Reference</strong><br />
The following expressions are record expressions:<br />
REC1 is a record because its base type is RECORD.<br />
RECORD_LIST(2) is a record because it refers to the second record in a<br />
list of records.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following expressions are pointer expressions:<br />
TRUCK_PTR is a pointer expression because its base type is<br />
POINTER to the instances of a class.<br />
->TRUCK_INST is a pointer expression because the statement<br />
generates a pointer to an instance.<br />
->CURRENT is a pointer expression because the statement<br />
generates a pointer to the current instance.
Relational operators<br />
Expressions and operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Relational operators are used anywhere you can use a Boolean expression.<br />
For example, you can use relational operators in the premise of IF statements,<br />
rules, and in entry and execution conditions because a premise specifies<br />
conditions that must be true before <strong>AionDS</strong> executes the actions associated<br />
with the premise.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following rule that advises students to take course 105 if they<br />
have the prerequisite:<br />
Consider the following statement:<br />
if 105_prereq_taken<br />
then<br />
advice is 'take course 105'<br />
The premise is the Boolean parameter 105_PREREQ_TAKEN. When the<br />
premise is true, <strong>AionDS</strong> takes the action following the THEN keyword. In<br />
this case, <strong>AionDS</strong> assigns the value "take 105" to the parameter ADVICE.<br />
Alternatively, you can write the premise as follows:<br />
if 105_prereq_taken = TRUE<br />
then ...<br />
The premise shows an equal relationship between 105_PREREQ_TAKEN and<br />
the system constant TRUE. Booleans allow you to specify a premise in a<br />
shorthand way because they have an implied relationship of either true or<br />
false.<br />
Knowledge Definition <strong>Language</strong> 3-7
Expressions and operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of operators<br />
3-8 <strong>Language</strong> <strong>Reference</strong><br />
When you compare parameters to each other or to a constant other than<br />
TRUE or FALSE, you must explicitly identify the relationship between the<br />
parameters and constants. The following table shows the possible<br />
relationships between the left and right sides of an operator.<br />
Operator Relationship<br />
= left equals right<br />
left does not equal right<br />
> left is greater than right<br />
>= left is greater than or equal to right<br />
< left is less than right<br />
Expressions and operators<br />
■ When it compares strings, <strong>AionDS</strong> considers a capital letter to be the<br />
same as a lowercase letter. For example, <strong>AionDS</strong> does not distinguish<br />
between “A” and “a.”<br />
■ You should be careful when comparing strings for less than or greater<br />
than relationships. Shorter strings are compared to longer ones as if they<br />
are padded with spaces on the right of the shorter string. Certain<br />
characters compare differently in ASCII and EBCDIC because of<br />
differences in the internal representation of these character sets.<br />
■ You can only compare entire records, sets, or lists by equality (is, are, =)<br />
or inequality (is not, are not, ).<br />
■ For basic data types, if any parameter in a premise is not known, the<br />
comparison returns UNKNOWN. For structured data types, the premise<br />
is UNKNOWN, except when there is enough information to make a<br />
decision.<br />
For example, if part of a record is not known, a test for equality (is, are,<br />
=) results in FALSE if the known part of the record is different from<br />
another record in the premise. In this case, a test for inequality (is not,<br />
are not, ) results in TRUE.<br />
If one or more fields in a record is not known but all of the known fields<br />
are equal, testing for either equality or inequality results in UNKNOWN,<br />
since <strong>AionDS</strong> cannot determine that the result should be TRUE or FALSE.<br />
■ In a relational comparison, an empty list is a known value. For example,<br />
a premise comparing two empty lists for equality (is, are, =) results in<br />
TRUE.<br />
Knowledge Definition <strong>Language</strong> 3-9
Expressions and operators<br />
Real number comparisons<br />
.........................................................................................................................................................................................................˝..........................................<br />
Unexpected results<br />
3-10 <strong>Language</strong> <strong>Reference</strong><br />
Comparisons between real numbers might not be what you expect when you<br />
generate the numbers differently. For example, consider the following<br />
premise:<br />
if 10.0/10.0 = 1.0 then ...<br />
The premise might not compare as equal because one expression is generated<br />
by division, and the other expression is a constant. It is also possible that<br />
they compare correctly in one environment, such as <strong>AionDS</strong>/PC, but<br />
differently in another environment, such as <strong>AionDS</strong>/MVS.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Comparison<br />
tolerance<br />
To handle this situation, <strong>AionDS</strong> provides a profile option to perform real<br />
number comparisons within tolerance that you specify. The option is as<br />
follows:<br />
comparison-tolerance = tolerance<br />
For example, if the tolerance is 0.00010, then numbers such as 10.00000 and<br />
10.00009 are equal. If you do not specify a comparison tolerance, <strong>AionDS</strong><br />
uses 0.0000 as the default.<br />
The following table shows the effect of specifying a tolerance for real number<br />
comparisons:<br />
Operator Comparison<br />
< lnum-rnum < -tolerance<br />
lnum-rnum > tolerance<br />
ABS(lnum-rnum) > tolerance
Expressions and operators<br />
Values for lnum appear on the left side of the operator, and values for rnum<br />
appear on the right side. The tolerance is the number you specify in the<br />
COMPARISON-TOLERANCE profile option. The absolute value is represented<br />
by ABS.<br />
Knowledge Definition <strong>Language</strong> 3-11
Expressions and operators<br />
Arithmetic operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
3-12 <strong>Language</strong> <strong>Reference</strong><br />
Expressions can use arithmetic operators. The following numeric expression<br />
results in twice the value of the product of PI and R, multiplied by itself, with<br />
the intermediate result added to 25, then divided by 100 before subtracting<br />
K:<br />
(25 + sqr(2*pi*r))/100-k<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of operators<br />
The following table shows the arithmetic operators.<br />
Operator Description<br />
+ Add<br />
- Subtract<br />
* Multiply<br />
/ Divide<br />
** Exponent<br />
DIV Integer divide<br />
MOD Modulus<br />
For more information: See Chapter 4, “KDL Statement Syntax,” for<br />
additional arithmetic functions.
Logical operators<br />
Expressions and operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Conditions can be joined together with logical operators to create a<br />
compound condition for a premise. For example, the following statement<br />
instructs <strong>AionDS</strong> to advise students to take course 105 if they have the<br />
prerequisite and are not freshmen.<br />
if 105_prereq_taken and not freshman<br />
then<br />
advice is 'take 105'<br />
The statement requires 105_PREREQ_TAKEN to be true and FRESHMAN to be<br />
false before the rule can execute. The logical operator NOT negates the<br />
condition that the student must be a freshman. The logical operator AND<br />
specifies that both parts of the premise must be met before the rule can<br />
execute. You can use the logical operator OR to specify that only one part of<br />
the premise must be met before the rule can execute.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Precedence of<br />
operators<br />
There is a precedence associated with logical operators such that NOT is<br />
evaluated before AND, and AND is evaluated before OR. Alternatively, you<br />
can write the rule as follows:<br />
if 105_prereq_taken and (sophomore or junior or<br />
senior)<br />
then advice is 'take 105'<br />
The parentheses are important in this case, because they change the order<br />
that <strong>AionDS</strong> evaluates logical operators. The part of a statement inside the<br />
parentheses is evaluated first. If you do not use parentheses, the order of<br />
precedence in this example is not the same as if you do use parentheses:<br />
if (105_prereq_taken and sophomore) or junior or<br />
senior<br />
then advice is 'take 105'<br />
Leaving out the parentheses instructs <strong>AionDS</strong> to advise juniors and seniors to<br />
take course 105 whether or not they have the prerequisite.<br />
Knowledge Definition <strong>Language</strong> 3-13
Expressions and operators<br />
Selection operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
List and set operators<br />
3-14 <strong>Language</strong> <strong>Reference</strong><br />
KDL provides operators that select elements from lists or sets, fields from<br />
records, records from files, instances from classes, and slots from instances.<br />
The kinds of selection operators are as follows:<br />
■ List and set operators<br />
■ File, record, and field operators<br />
■ Class operators<br />
■ Instance operators<br />
■ Slot operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use a list or set selection operator to refer to an element of a list or set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
list_expr(int_expr)<br />
Syntax<br />
list_expr is the name of a list or set.<br />
int_expr is an integer expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The parentheses cause selection from an element of a list or set. You<br />
must supply an integer expression representing the element to select.<br />
■ The selection operator returns the contents of an element.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Since ASORT is an ascending sort that returns a list expression, you can use<br />
the selection operator to identify the second element of the sorted list as<br />
follows:<br />
asort(cust_list)(2)
File, record, and field operators<br />
Expressions and operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use Format 1 for file operators. Use Format 2 for record and field operators.<br />
.........................................................................................................................................................................................................˝..........................................<br />
file_nm->[.field_nm]<br />
Format 1 syntax<br />
file_nm is the name of a file.<br />
field_nm is a field name.<br />
.........................................................................................................................................................................................................˝..........................................<br />
rec_exp.field_nm<br />
Format 2 syntax<br />
rec_exp is a record expression.<br />
field_nm is a field name.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Use the file operator to refer to the current record of a file.<br />
■ The arrow ( -> ) causes selection of the current record from a file.<br />
■ The dot ( . ) causes selection of the field you specify from a record.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statement refers to the NAME field in the second record of a<br />
list:<br />
record(2).name<br />
You can combine several selection operators in a single KDL statement. For<br />
example, the following statement selects field CUST_NO from the current<br />
record of a file that is identified by the file parameter CUST_FILE_PA:<br />
cust_file_pa->.cust_no<br />
You can refer to the entire contents of a record by specifying the file<br />
parameter, as in the following example:<br />
cust_file_pa-><br />
Knowledge Definition <strong>Language</strong> 3-15
Expressions and operators<br />
Class references<br />
3-16 <strong>Language</strong> <strong>Reference</strong><br />
Consider the following nested record that is specified in the Base Type<br />
property for CUST_ADDR_PA:<br />
record<br />
cust_data is cust_data_ty<br />
addr1 is string<br />
addr2 is string<br />
city is string<br />
state is string<br />
zip is integer<br />
end<br />
The Type Definition property of the CUST_DATA type object contains the<br />
following definition:<br />
record<br />
cust_no is integer<br />
cust_name is string<br />
end<br />
You refer to fields in the nested record by specifying the name of the record<br />
and the field name. For example, the following statement refers to the<br />
CUST_NO field:<br />
cust_addr_pa.cust_data.cust_no<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the class reference operator to refer to an entire class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
CLASS([library::]classname) | CURRENTCLASS |<br />
[library::]classname<br />
classname is the name of a class.<br />
library is the name of the included library in which the class<br />
exists. The library name is only required when duplicate<br />
class names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries
Expressions and operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Only use the CURRENTCLASS syntax within a class. You cannot use the<br />
syntax in a pattern-matching rule.<br />
■ You can use the classname syntax without the CLASS keyword only when<br />
the classname is unambiguous. The following statements allow this<br />
syntax: CREATE, DBMS, and EXISTS.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Instance references<br />
The following statements refer to a class:<br />
class(vehicle::truck)<br />
class(truck)<br />
currentclass<br />
truck<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use an instance reference operator to refer to an instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
[library::]classname[(inst_id)] | pointer-> | CURRENT |<br />
inst_nm<br />
library is the name of the included library in which the class<br />
exists. The library name is only required when duplicate<br />
class names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
classname is the name of a class.<br />
inst_id is one of the following instance identifiers:<br />
inst_nm is the name of an instance.<br />
->str_expr is a string expression that contains the<br />
name of an instance.<br />
Knowledge Definition <strong>Language</strong> 3-17
Expressions and operators<br />
3-18 <strong>Language</strong> <strong>Reference</strong><br />
inst_no is a non-negative integer that identifies<br />
an instance.<br />
pointer is a pointer to an instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Only use the CURRENT syntax within an object attached to a method.<br />
You cannot use the syntax in a pattern-matching rule.<br />
■ Use the classname(inst_nm) syntax or inst_nm syntax to refer to static<br />
instances. You can use the inst_nm syntax only if the instance name is<br />
unique within the knowledge base.<br />
■ The classname(->str_expr) syntax can be used to refer to the instance with<br />
the name contained in str_expr. As a more efficient alternative, however,<br />
you should consider the pointer-> syntax.<br />
■ The classname(inst_no) format is supported in pattern-matching rules. It<br />
allows you to write pattern-matching rules that reference multiple<br />
instances of a single class.<br />
■ The classname format is only supported in pattern-matching rules and in<br />
functions attached to methods. It implies that current instance should be<br />
used.<br />
■ You should use CURRENT to refer to an instance within a method.<br />
■ You can generate a pointer to an instance by preceding the inst_id with<br />
an arrow ( -> ).<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statements refer to instances:<br />
vehicle::truck(fordbronco)<br />
truck(fordbronco)<br />
fordbronco<br />
truck(->instancename)<br />
truck(1)<br />
truck<br />
truck_ptr-><br />
current<br />
The following statements generate pointers to instances:<br />
->vehicle::truck(fordbronco)<br />
->truck(fordbronco)<br />
->truck(->instancename)
Slot references<br />
->truck(1)<br />
->truck<br />
->current<br />
Expressions and operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use a slot reference operator to refer to a slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
[inst_ref].slot_nm<br />
Syntax<br />
inst_ref is an instance reference. See Remarks for more<br />
information.<br />
slot_nm is the name of a slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
An inst_ref is one of the following references:<br />
[library::]classname[(inst_id)] | pointer-> | CURRENT |<br />
inst_nm<br />
library is the name of the included library in which the class<br />
exists. The library name is only required when duplicate<br />
class names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
classname is the name of a class.<br />
inst_id is one of the following instance identifiers:<br />
inst_nm is the name of an instance.<br />
->str_expr is a string expression that contains the<br />
name of an instance.<br />
Knowledge Definition <strong>Language</strong> 3-19
Expressions and operators<br />
3-20 <strong>Language</strong> <strong>Reference</strong><br />
inst_no is a non-negative integer that identifies<br />
an instance.<br />
pointer is a pointer to an instance.<br />
■ You can only use slot_nm without inst_ref if there is an implied instance<br />
reference. Implied instance references exist when an instance is used in a<br />
method, in a CREATE, EXISTS, SELECTONE, or SELECTALL statement, or<br />
in a pattern-matching rule.<br />
For more information: See the remarks for the “Instance references”<br />
section on page 3-17.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statements refer to slots:<br />
vehicle::truck(fordbronco).cost<br />
truck(fordbronco).cost<br />
truck_ptr->.cost<br />
cost
Premise evaluation<br />
Expressions and operators<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
A premise must be a Boolean expression. As soon as the premise is known to<br />
be either true or false, evaluation stops.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Order of evaluation<br />
The following list summarizes the order in which <strong>AionDS</strong> evaluates a<br />
premise.<br />
1 <strong>AionDS</strong> evaluates selection operators.<br />
2 <strong>AionDS</strong> evaluates the contents of parentheses, working from the<br />
innermost set of parentheses to the outermost set.<br />
3 <strong>AionDS</strong> evaluates logical operators in the following order:<br />
■ NOT<br />
■ AND<br />
■ OR or XOR<br />
4 <strong>AionDS</strong> evaluates arithmetic operators in the following order:<br />
■ Exponent<br />
■ Multiplication or division<br />
■ Addition or subtraction<br />
5 <strong>AionDS</strong> evaluates from left to right.<br />
If you use compound conditions or arithmetic operators in a premise, you<br />
should use parentheses to avoid logic errors and to make the logic clear to<br />
others who might need to modify the statements later.<br />
Knowledge Definition <strong>Language</strong> 3-21
Flow control<br />
Flow control<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
3-22 <strong>Language</strong> <strong>Reference</strong><br />
<strong>AionDS</strong> provides all of the constructs found in modern programming<br />
languages for controlling the execution flow during a consultation. Since the<br />
inference engine implicitly provides control as part of its processing, you use<br />
flow control statements primarily for two purposes, as follows:<br />
■ To specify knowledge base execution at a high-level. You accomplish this<br />
task by specifying actions and control mechanisms in the Agenda<br />
properties of states.<br />
■ To specify detailed actions that you want to occur during processing.<br />
Usually, you implement this kind of processing in functions. These<br />
functions are invoked by your higher-level specifications in the agenda or<br />
by message passing.<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of control<br />
statements<br />
The constructs are as follows:<br />
■ IF-THEN-ELSE statements for conditional execution, including ELSEIF<br />
clauses<br />
■ FOR and LOOP statements, which provide iteration, including Do While<br />
and Repeat Until constructs<br />
■ BREAK, BREAKIF, and RETURN statements for loop termination and<br />
branching.<br />
For more information: See Chapter 4, “KDL Statement Syntax” for<br />
examples of the use of each kind of statement.
Inference rules<br />
Inference rules<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
This section introduces the basics of specifying inference rule syntax.<br />
For more information: See the <strong>AionDS</strong> General <strong>Reference</strong> manual for an<br />
explanation of how inference rules interact and are executed by the inference<br />
engine.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Pattern-matching<br />
rules<br />
Inference rules are rules that operate on instances. They are also called<br />
pattern-matching rules because one rule can apply to many instances that<br />
share the same characteristics, or pattern. The following example shows a<br />
very simple pattern-matching rule:<br />
ifmatch<br />
credit with not_processed<br />
then<br />
new_limit = old_limit + 1000<br />
not_processed = false<br />
end<br />
When the rule executes, it operates on instances of the CREDIT class that<br />
share the pattern NOT_PROCESSED = TRUE. Three slots are identified in the<br />
rule, NOT_PROCESSED, NEW_LIMIT, and OLD_LIMIT. For each instance<br />
that meets the criteria NOT_PROCESSED = TRUE, <strong>AionDS</strong> updates the credit<br />
limit by $1,000.00 and marks the instance as processed.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Pattern-matching on<br />
subclasses<br />
Beginning with <strong>AionDS</strong> Version 6.3, IFMATCH statements also operate on all<br />
instances of subclasses that share the pattern contained in the patternmatching<br />
portion of an IFMATCH statement. Thus, the rule in the example<br />
above would operate on all instances of the CREDIT class and on all instances<br />
of its subclasses that share the pattern contained in the statement.<br />
When porting a pre-existing application to <strong>AionDS</strong> Version 6.3 or greater,<br />
check the behavior of some of your IFMATCH statements to make sure that<br />
they execute correctly.<br />
Knowledge Definition <strong>Language</strong> 3-23
Inference rules<br />
.........................................................................................................................................................................................................˝..........................................<br />
Multiple classes and<br />
join criteria<br />
3-24 <strong>Language</strong> <strong>Reference</strong><br />
Consider a slightly more complicated rule, as follows:<br />
ifmatch<br />
sales with sale_date = currentdate<br />
credit, sales with credit.cust_no = sales.cust_no<br />
then<br />
new_limit = new_limit - amount<br />
end<br />
The rule operates over two classes, CREDIT and SALES. The pattern that<br />
must match for SALES is SALES_DATE = CURRENTDATE. Since a pattern is<br />
not specified for CREDIT, all instances are included in the match.<br />
From the instances that meet the criteria, the rule operates over pairs of<br />
instances that meet the join criteria, CREDIT.CUST_NO = SALES.CUST_NO.<br />
Each class that contains join criteria are identified explicitly, followed by the<br />
criteria itself.<br />
For each of the instances that meet the criteria, <strong>AionDS</strong> takes the action of<br />
reducing NEW_LIMIT by AMOUNT. The slots NOT_PROCESSED, CUST_NO<br />
and NEW_LIMIT are part of CREDIT instances. The slots CUST_NO,<br />
SALES_DATE, and AMOUNT are part of SALES instances. Because CUST_NO<br />
is the name of a slot in both classes, it is necessary to identify the classes<br />
explicitly. You do not need to specify the class of slots with unambiguous<br />
names.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Binding and EXISTS<br />
clauses<br />
Consider another rule, as follows:<br />
ifmatch<br />
sales with sale_date = currentdate<br />
credit, sales with credit.cust_no = sales.cust_no<br />
not exists (sales_hist with cust_no = credit.cust_no)<br />
then<br />
create (sales_hist with cust_no = credit.cust_no)<br />
end<br />
The match and join criteria are the same as in the previous rule. The action<br />
of the rule creates a SALES_HIST instance and sets the CUST_NO slot equal to<br />
the CUST_NO slot in each CREDIT instance that meets the match and join<br />
criteria. When instances are matched and joined, a binding is created.
Inference rules<br />
The EXISTS clause specifies that no instance of SALES_HIST can exist with a<br />
CUST_NO equal to the CUST_NO in the CREDIT instance. The EXISTS clause<br />
inhibits execution of bindings that pass the match and join criteria. You can<br />
specify a class that is not part of the match or join criteria. Note that slots<br />
within an EXISTS clause refer to the class within the clause, unless qualified by<br />
another class name.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Binding and<br />
ORDERBY clauses<br />
Consider another rule, as follows:<br />
ifmatch<br />
sales with sale_date = currentdate<br />
credit, sales with credit.cust_no = sales.cust_no<br />
orderby (trunc(amount+.5))<br />
then<br />
new_limit = new_limit - amount<br />
end<br />
The match and join criteria are the same as the previous example. The<br />
ORDERBY clause specifies the order in which the next binding is chosen for<br />
execution. You can only use an integer expression within the orderby clause.<br />
<strong>AionDS</strong> chooses bindings in order from lowest to highest value. In this<br />
example, the bindings are ordered by AMOUNT, rounded up and truncated to<br />
the integer value.<br />
Knowledge Definition <strong>Language</strong> 3-25
Message passing<br />
Message passing<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
3-26 <strong>Language</strong> <strong>Reference</strong><br />
This section shows examples of message passing. The actions of rules in the<br />
previous section are replaced by message passing.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SEND statement<br />
In <strong>AionDS</strong>, you implement message passing with the SEND statement. An<br />
object attached to the receiving method responds. Often, the object is a<br />
function. Consider the following rule that sends a message as the action.<br />
ifmatch<br />
credit with not_processed<br />
then<br />
send (update to credit)<br />
end<br />
The message is UPDATE. It is sent to the current instance of CREDIT, which<br />
is the instance with which <strong>AionDS</strong> executes the rule. In the course of the<br />
rule execution, each instance that matches the pattern is executed.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Alternative syntax<br />
An alternative way to specify message passing is as follows:<br />
credit.update<br />
The method UPDATE in class CREDIT responds to the message. It is attached<br />
to the function UPDATE_CREDIT. The function is executed when the<br />
message is sent. The contents of the function are as follows:<br />
new_limit = old_limit + 1000<br />
not_processed = false<br />
Because the function is invoked with an instance, it is not necessary to specify<br />
which instance. An equivalent way of writing the function is as follows:<br />
current.new_limit = current.old_limit + 1000<br />
current.not_processed = false
Message passing<br />
.........................................................................................................................................................................................................˝..........................................<br />
Specifying input<br />
arguments<br />
Consider another rule that invokes the PROCESS method, as follows:<br />
ifmatch<br />
sales with sale_date = currentdate<br />
credit, sales with credit.cust_no = sales.cust_no<br />
then<br />
send (process to credit with amount)<br />
end<br />
An alternative way to specify message passing is as follows:<br />
credit.process(amount)<br />
The function attached to process is as follows:<br />
new_limit = new_limit + input_arg1<br />
The AMOUNT slot of the SALES instance is passed to the function as an input<br />
argument, INPUT_ARG1.<br />
Consider the following rule:<br />
ifmatch<br />
sales with sale_date = currentdate<br />
credit, sales with credit.cust_no = sales.cust_no<br />
not exists (sales_hist with cust_no = credit.cust_no)<br />
then<br />
send (make_inst to class(sales_hist) with<br />
credit.cust_no)<br />
end<br />
The message MAKE_INST is passed to the SALES_HIST class, since an instance<br />
does not yet exist. An alternative way to specify message passing is as follows:<br />
class(sales_hist).make_inst(credit.cust_no)<br />
The attached function contains the following statement:<br />
create (currentclass with input_arg1)<br />
Knowledge Definition <strong>Language</strong> 3-27
Agenda statements<br />
Agenda statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
3-28 <strong>Language</strong> <strong>Reference</strong><br />
Agenda statements specify the goals of a consultation. Goals are objects that<br />
you want <strong>AionDS</strong> to process during a consultation. For example, you might<br />
want <strong>AionDS</strong> to display a message that contains a diagnosis. The following<br />
agenda statement specifies the goal:<br />
message (show_diagnosis)<br />
The message is a goal of the consultation that causes the inference engine to<br />
determine values for the slots or parameters to be displayed by<br />
SHOW_DIAGNOSIS.<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of agenda<br />
statement<br />
You can specify the following agenda statements as goals for the inference<br />
engine:<br />
Agenda statement Description<br />
FUNCTION Execute a function.<br />
GRAPH Display a graph.<br />
GROUP Display several parameters, slots, or messages and<br />
accept values.<br />
MESSAGE Display a message.<br />
PARAMETER Determine a value for a parameter.<br />
PROCESS Execute and external program.<br />
REPORT Create a “hardcopy” report.<br />
RULE Execute a rule.<br />
SLOT Determine a value for a slot.<br />
STATE Execute the agenda of a state.
Agenda statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Where to use<br />
statements<br />
You can only use agenda statements in the following places:<br />
■ The Agenda property of states<br />
■ The Rule Definition property of rules<br />
■ The Function Body property of functions<br />
.........................................................................................................................................................................................................˝..........................................<br />
Sourcing and<br />
processing control<br />
You can control how <strong>AionDS</strong> attempts to process a goal in two ways:<br />
■ You can specify the amount of work that you want <strong>AionDS</strong> to do to<br />
determine values for parameters or slots needed by the goal. This is<br />
called the sourcing option. It specifies the level of sourcing that <strong>AionDS</strong><br />
should attempt before it processes a goal.<br />
■ You can specify what <strong>AionDS</strong> should do if it cannot determine a value<br />
for one of the parameters or slots with the requested level of sourcing.<br />
This is called the processing option.<br />
The following sections discuss sourcing and processing options.<br />
Knowledge Definition <strong>Language</strong> 3-29
Agenda statements<br />
Sourcing options for agenda statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
3-30 <strong>Language</strong> <strong>Reference</strong><br />
A sourcing option specifies the amount of work that <strong>AionDS</strong> must do to<br />
process a goal. Consider an example of a goal to display a message<br />
SHOW_DIAGNOSIS. The text of the message is as follows:<br />
The problem can be solved by %diag_pa<br />
The parameter DIAG_PA becomes a sub-goal if <strong>AionDS</strong> needs a value for the<br />
parameter in order to display the message.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Sourcing options<br />
You can specify how <strong>AionDS</strong> resolves parameters that are needed in order to<br />
process the goal. You can specify one of the following sourcing options:<br />
.............................................................................................................................................................................<br />
FINALVALUE<br />
Backward chain for all unprocessed parameters. This option can cause<br />
pending of unprocessed parameters.<br />
.............................................................................................................................................................................<br />
SOURCEVALUE<br />
Backward chain for parameters that do not have a value and place on pending<br />
list, if necessary. <strong>AionDS</strong> does not backward chain for parameters that<br />
already have values. For example, <strong>AionDS</strong> does not backward chain for a list<br />
or set that contains at least one value. <strong>AionDS</strong> does not backward chain for a<br />
VALUE-CAN-CHANGE parameter that already has a value either.<br />
For example, if DIAG_PA is a list parameter and you specify the<br />
SOURCEVALUE option for the message DIAG_ME, <strong>AionDS</strong> does not backward<br />
chain if DIAG_PA contains at least one element.<br />
This is the default sourcing option.
Agenda statements<br />
.............................................................................................................................................................................<br />
CURRENTVALUE<br />
Do not backward chain for parameters. For example, the message DIAG_ME<br />
is executed immediately and displays whatever value is available for DIAG_PA.<br />
<strong>AionDS</strong> uses the current value of parameters, even if they are UNKNOWN.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Sourcing and rule<br />
type<br />
If you specify a goal in a rule, the sourcing option overrides the Rule Type<br />
property. For example, if the Rule Type property specifies PURSUEACTIONS<br />
and the sourcing option for the goal is CURRENTVALUE, <strong>AionDS</strong> does not<br />
backward chain to resolve parameters used by the goal. In this case, <strong>AionDS</strong><br />
uses UNKNOWN for unresolved parameters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Sourcing and entry<br />
conditions<br />
Sourcing options have no effect on the Entry Conditions property of an<br />
object. To specify the sourcing level in an entry condition you should use<br />
one of the following KDL statements: FINALVALUE, BESTVALUE,<br />
SOURCEVALUE, or CURRENTVALUE.<br />
For more information: See Chapter 4, “KDL Statement Syntax,” for the<br />
syntax of these statements.<br />
Knowledge Definition <strong>Language</strong> 3-31
Agenda statements<br />
Processing options for agenda statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
3-32 <strong>Language</strong> <strong>Reference</strong><br />
Processing options specify the action that <strong>AionDS</strong> should take when an<br />
object cannot be sourced to the level requested in the sourcing option.<br />
Consider a message without entry conditions. If you create a message with<br />
the FINALVALUE sourcing option, all parameters in the message must be<br />
sourced to their final value before <strong>AionDS</strong> displays the message. The<br />
processing option specifies the action to take if <strong>AionDS</strong> cannot resolve a<br />
parameter in the message.<br />
If you create a message with the CURRENTVALUE option, however, <strong>AionDS</strong><br />
always processes the message "as is" using the current values of parameters.<br />
In this case, the processing option has no effect since <strong>AionDS</strong> always<br />
processes the object.<br />
If the goal contains entry conditions that cannot be resolved, the processing<br />
option determines what to do with the object. For example, the processing<br />
options might specify that <strong>AionDS</strong> pend the object or discard it.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Processing options<br />
You can specify the following processing options:<br />
.............................................................................................................................................................................<br />
COMPLETE<br />
Do not execute the object until all parameters are resolved. If parameters<br />
cannot be sourced to the requested level, <strong>AionDS</strong> places the object on the<br />
pending list and attempts to process the object when it exits each state.<br />
When <strong>AionDS</strong> exits the state in which the object is defined, <strong>AionDS</strong> drops<br />
the object from the pending list. The object is never executed in this case.
Agenda statements<br />
.............................................................................................................................................................................<br />
LASTCHANCE<br />
Do not execute the object until all parameters are sourced to the requested<br />
level or until <strong>AionDS</strong> exits the state in which the object is defined. If<br />
parameters cannot be resolved, <strong>AionDS</strong> places the object on the pending list<br />
and attempts to process the object when it exits each state.<br />
When <strong>AionDS</strong> exits the state in which the object is defined, <strong>AionDS</strong> executes<br />
the object "as is." <strong>AionDS</strong> uses UNKNOWN for unresolved parameters,<br />
except for partial lists, which show value(s). This strategy guarantees that<br />
<strong>AionDS</strong> executes the object unless the entry conditions cannot be evaluated<br />
to TRUE.<br />
This is the default option.<br />
.............................................................................................................................................................................<br />
IMMEDIATE<br />
Execute the object as soon as <strong>AionDS</strong> attempts to source all parameters.<br />
<strong>AionDS</strong> executes the object even if parameters cannot be sourced to the<br />
requested level.<br />
.............................................................................................................................................................................<br />
INSTATE<br />
This option modifies other processing options to override the processing<br />
action that occurs when <strong>AionDS</strong> exits the state in which the agenda<br />
statement is specified.<br />
For example, if you use INSTATE with LASTCHANCE, <strong>AionDS</strong> treats the state<br />
in which the agenda statement is specified as the last chance state for the goal.<br />
If the INSTATE option is not present, the last chance state is the one in which<br />
the object is defined.<br />
.........................................................................................................................................................................................................˝..........................................<br />
For more<br />
information<br />
The processing option also affects entry conditions and facts. See the<br />
“Execution conditions and facts” on page 3-34.<br />
Knowledge Definition <strong>Language</strong> 3-33
Agenda statements<br />
Combining sourcing and processing options<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
3-34 <strong>Language</strong> <strong>Reference</strong><br />
The combination of source and processing options determine how <strong>AionDS</strong><br />
executes a goal. All combinations might not be useful for many applications.<br />
The following sections, however, discuss some of the most useful<br />
combinations.<br />
.........................................................................................................................................................................................................˝..........................................<br />
FINALVALUE,<br />
LASTCHANCE<br />
This combination causes <strong>AionDS</strong> to completely source parameters. If the<br />
goal cannot be processed by the inference engine, <strong>AionDS</strong> executes the object<br />
“as is” when it exits the state in which the object is defined.<br />
.........................................................................................................................................................................................................˝..........................................<br />
FINALVALUE,<br />
LASTCHANCE,<br />
INSTATE<br />
This combination causes the object to be executed in the same manner as the<br />
default, except that <strong>AionDS</strong> executes the object when it exits the state in<br />
which the object is added to the agenda. This combination is useful when<br />
the object is defined in a vocabulary or in a state higher in the hierarchy than<br />
the one in which you want the object to execute.<br />
.........................................................................................................................................................................................................˝..........................................<br />
FINALVALUE,<br />
IMMEDIATE<br />
The combination causes <strong>AionDS</strong> to use all sources to resolve parameters.<br />
<strong>AionDS</strong> executes the object "as is" if parameters cannot be sourced as<br />
requested. This combination is useful when you want <strong>AionDS</strong> to attempt to<br />
resolve all parameters but you want <strong>AionDS</strong> to execute the object<br />
immediately, whether or not the parameters can be resolved.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CURRENTVALUE,<br />
IMMEDIATE<br />
This combination causes <strong>AionDS</strong> to execute the object immediately using<br />
existing values. It is equivalent to the KDL EXECUTE statement in prior<br />
versions of <strong>AionDS</strong>. The IMMEDIATE processing attribute is only required<br />
when the object contains entry conditions and you want to guarantee that the<br />
message is not pended.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Execution conditions<br />
and facts<br />
<strong>AionDS</strong> evaluates Execution Conditions and Facts properties before<br />
executing an object. If <strong>AionDS</strong> cannot execute these properties, it does not<br />
process the object. In this case, the processing option is used to determine<br />
how to handle the object.
Agenda statements<br />
For example, consider a message that is to be executed as CURRENTVALUE,<br />
LASTCHANCE. If the execution conditions cannot be resolved, <strong>AionDS</strong> places<br />
the message on the pending list. The sourcing option is ignored because<br />
<strong>AionDS</strong> does not use it to source entry conditions. The processing option is<br />
used to determine how the object is handled if it cannot be executed. In this<br />
example, LASTCHANCE processing specifies that the object should be pended.<br />
If an execution condition is not present, however, the CURRENTVALUE<br />
attribute specifies that all parameters in the message are resolved using current<br />
values. The message is executed immediately because all parameters can be<br />
sourced to the requested level.<br />
Knowledge Definition <strong>Language</strong> 3-35
Agenda statements<br />
Using agenda statements in rules and functions<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
3-36 <strong>Language</strong> <strong>Reference</strong><br />
You can use agenda statements in rules and functions to specify goals for the<br />
consultation outside of the Agenda property.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
For example, the following rule executes a report:<br />
if report_requested<br />
then<br />
report(rep_1,finalvalue,instate)<br />
end<br />
When <strong>AionDS</strong> executes the rule, it executes the report REP_1 using the<br />
FINALVALUE and INSTATE processing options.<br />
The sourcing option of the agenda statement controls how the report<br />
executes. In the example, the sourcing option causes <strong>AionDS</strong> to backward<br />
chain until it can process all parameters used by the report, regardless of the<br />
Rule Type property of the rule or the Backward Chain property of a function.<br />
The implied LASTCHANCE option and the INSTATE option causes the report<br />
to execute on exit from the state containing the rule if any of parameters or<br />
slots used by REP_1 cannot be completely sourced.<br />
Sourcing options for functions and independent states<br />
.........................................................................................................................................................................................................˝..........................................<br />
Invoking functions<br />
and states<br />
You can specify execution of functions and independent states in a rule in two<br />
ways, as follows:<br />
■ You can explicitly invoke the function or state with the FUNCTION and<br />
STATE agenda statements.<br />
■ You can implicitly invoke the function or state by specifying the name of<br />
the function or state.<br />
If you use the agenda statement, you can specify sourcing options. If you do<br />
not use an agenda statement to invoke a function or state, the sourcing is<br />
determined by the Rule Type property.
Agenda statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example of function<br />
call<br />
Consider the following rule that executes a function:<br />
if data_needed<br />
then<br />
function(get_data(prob_pa,result_data),finalvalue)<br />
end<br />
<strong>AionDS</strong> always executes the FUNCTION statement when it executes the<br />
actions of the rule. The FINALVALUE option causes <strong>AionDS</strong> to backward<br />
chain to resolve the input parameter PROB_PA, if necessary.<br />
Consider the alternative way to write the rule:<br />
if data_needed<br />
then<br />
get_data(prob_pa,result_data)<br />
end<br />
In this format you cannot specify a sourcing option. If <strong>AionDS</strong> must resolve<br />
the input parameter PROB_PA, <strong>AionDS</strong> uses the chaining mode and pursue<br />
action attributes of the Rule Type property to choose the action to take.<br />
If the rule is executed by backward chaining, or if you specify<br />
PURSUEACTIONS, <strong>AionDS</strong> backward chains to resolve its value and proceeds<br />
to execute the function. If the rule is executed by forward chaining and the<br />
pursue actions attribute is DONOTPURSUE, the forward chainer leaves the<br />
rule partially processed and does not execute the function.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example of state call<br />
<strong>AionDS</strong> executes an independent state in a rule in the same two ways. You<br />
can use the STATE agenda statement as follows:<br />
if prob_pa is not unknown<br />
then<br />
state (communications(prob_pa,diag_pa),<br />
currentvalue)<br />
end<br />
In this case, the state is always executed when <strong>AionDS</strong> executes the actions of<br />
the rule.<br />
Knowledge Definition <strong>Language</strong> 3-37
Agenda statements<br />
3-38 <strong>Language</strong> <strong>Reference</strong><br />
Alternatively, you can execute the following statement:<br />
if prob_pa is not unknown<br />
then<br />
communications(prob_pa,diag_pa)<br />
end<br />
In this case, several factors decide whether or not the independent state is<br />
executed. Assume that the only input parameter is PROB_PA.<br />
If the forward chainer executes the rule, the pursue action attribute<br />
determines whether or not the input parameter is sourced. If the pursue<br />
action attribute is DONOTPURSUE, the forward chainer does not consider the<br />
rule. If the backward chainer executes the rule, the input parameter is<br />
sourced and the state is executed.
KDL in Facts and Default properties<br />
KDL in Facts and Default properties<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can use KDL to specify facts and default values for parameters and slots.<br />
Some of the uses of KDL in facts and defaults are as follows:<br />
■ Constrain a parameter or slot to a range of values<br />
■ Assign a default value to a parameter or slot<br />
■ Assign an initial value to a VALUE-CAN-CHANGE parameter or slot<br />
■ Assign a value to a parameter that you want to use as a constant<br />
The following sections discuss constraints and assignments.<br />
Knowledge Definition <strong>Language</strong> 3-39
KDL in Facts and Default properties<br />
Constraints<br />
.........................................................................................................................................................................................................˝..........................................<br />
Definition of<br />
constraints<br />
3-40 <strong>Language</strong> <strong>Reference</strong><br />
Consider the following Facts property of the integer AGE slot:<br />
>0, <br />
>=<br />
<<br />
KDL in Facts and Default properties<br />
.........................................................................................................................................................................................................˝..........................................<br />
Lists and set elements<br />
You can constrain all elements of lists and sets with the “(*)” notation. The<br />
following facts constrain a numeric list, a set of strings, and a field in a list of<br />
records, respectively:<br />
(*) > 5<br />
(*) is from ('red', 'white', 'blue')<br />
(*).status > 0<br />
You cannot constrain individual elements of a list or set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Fields<br />
You can constrain fields in records by specifying the field name and the<br />
constraint. Consider the following Base Type property of a parameter:<br />
record<br />
code is integer<br />
str1 is string<br />
rlist is real_list<br />
end<br />
The following constraints can be placed in the Facts property for the<br />
parameter:<br />
code >=0, code 1.000<br />
.........................................................................................................................................................................................................˝..........................................<br />
Negative constraints<br />
All constraints must be asserted positively. For example, you cannot specify<br />
the following constraints:<br />
is not from ('red','white','blue') /* invalid */<br />
4 /* invalid */<br />
Knowledge Definition <strong>Language</strong> 3-41
KDL in Facts and Default properties<br />
Assignments<br />
.........................................................................................................................................................................................................˝..........................................<br />
Definition of<br />
assignment<br />
3-42 <strong>Language</strong> <strong>Reference</strong><br />
You can use KDL in the Facts or Default properties of a parameter or slot to<br />
make assignments. An assignment stores a value in a parameter or slot, or<br />
stores a value in an element of a structured parameter or slot, such as a list,<br />
set, or record. For example, you can assign a default value that is twice the<br />
sum of AGE and YRS_OF_SERVICE as follows:<br />
= 2 * (age + yrs_of_service)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Assignment operators<br />
You can use the following assignment operators interchangeably:<br />
=<br />
is<br />
are<br />
.........................................................................................................................................................................................................˝..........................................<br />
List elements<br />
You can assign values to single elements of a list if you specify the element<br />
number as follows:<br />
(1) = 5 /* list of integers */<br />
(element_no) is 10 /* list of integers */<br />
(2) = cust_record /* list of records */<br />
.........................................................................................................................................................................................................˝..........................................<br />
Set elements<br />
You cannot assign a value to an individual element of a set. You can only<br />
assign values to all elements of a set since a set is not ordered.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Fields<br />
You can assign a value to a field in a record by specifying the field name. For<br />
example, the following fact sets STATUS to 0.<br />
status = 0
KDL in Facts and Default properties<br />
.........................................................................................................................................................................................................˝..........................................<br />
Entire lists, sets, and<br />
records<br />
You can assign values to entire lists, sets, and records if you surround the<br />
values with parentheses and separate each element or field with a comma.<br />
The following fact assigns values to a list of real numbers:<br />
is ( 3.3, 45.8, 23E-15, 50 )<br />
You can also assign values to a list of lists, a list of sets, or a set of records by<br />
enclosing the entire list or set within parentheses, in addition to placing<br />
parentheses around each individual list, set, or record. You can use this<br />
syntax only in the Facts property. The following fact assigns values to a set of<br />
records:<br />
are ( ('sample data 1', 10, 20, 30 ),<br />
('sample data 2', 12, 16, 48 ),<br />
('sample data 3', 1, 7, 49 ) )<br />
.........................................................................................................................................................................................................˝..........................................<br />
Assigning defaults<br />
You cannot use this format to assign defaults. You must create a parameter<br />
that contains the values in the Facts property and specify the parameter name<br />
in the Defaults property of the parameter to which you want the defaults<br />
assigned. For example, the Facts property of INFLATION_ESTIMATES are as<br />
follows:<br />
is ( 7.5, 4.5, 3.8 )<br />
The Default property of the USER_BELIEF parameter contains the following<br />
entry:<br />
is inflation_estimates<br />
You cannot use this format, however, to assign individual elements of a list or<br />
set, or fields of records. The following statement is invalid:<br />
(1) is ('red', 'white', 'blue') /* Invalid */<br />
You can create a US_COLORS parameter containing the colors, however, and<br />
use it in the assignment of an individual element of a set or list, or the field of<br />
a record, as follows:<br />
(1) is us_colors<br />
(1).colors is us_colors<br />
Knowledge Definition <strong>Language</strong> 3-43
KDL in Facts and Default properties<br />
3-44 <strong>Language</strong> <strong>Reference</strong><br />
You can assign a structured parameter to another of the same type by<br />
specifying the parameter name in the facts or defaults properties. The<br />
following definitions assign a list and record, respectively:<br />
is choice_list<br />
= credit_record
Chapter 4<br />
KDL Statement Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Introduction<br />
This chapter describes the syntax for the following types of KDL:<br />
■ Numeric operations and functions<br />
■ Logical operators<br />
■ String operations<br />
■ Data and time operations<br />
■ List and set operations<br />
■ Certainty set operations<br />
■ Control statements<br />
■ Agenda statements<br />
■ Object processing statements<br />
■ Consultation monitor operations<br />
■ AES statements<br />
■ Input and output statements<br />
This chapter lists the statements alphabetically, not by category.<br />
.........................................................................................................................................................................................................˝..........................................<br />
In this chapter<br />
Topic Page<br />
KDL statement syntax 4-9<br />
& (Concatenate) 4-16<br />
* (Multiply) 4-17<br />
** (Exponent) 4-18<br />
continued<br />
KDL Statement Syntax 4-1
KDL statement syntax<br />
4-2 <strong>Language</strong> <strong>Reference</strong><br />
continued<br />
Topic Page<br />
+ (Add) 4-19<br />
- (Subtract) 4-20<br />
/ (Divide) 4-21<br />
/* */ (Comment) 4-22<br />
ABS 4-23<br />
Add 4-24<br />
AES 4-25<br />
AES Abort 4-26<br />
AES Break 4-27<br />
AES Chain 4-28<br />
AES Error 4-30<br />
AES Exitcode 4-31<br />
AES Profile 4-32<br />
AES Title 4-33<br />
AES Tracelevel 4-34<br />
AES Writelog 4-36<br />
AES Writetrace 4-37<br />
AES_CF 4-38<br />
And 4-39<br />
Append 4-41<br />
ArcTan 4-42<br />
Ask 4-43<br />
ASort 4-47<br />
BestValue 4-50<br />
continued
KDL statement syntax<br />
continued<br />
Topic Page<br />
Bin 4-51<br />
Break 4-52<br />
BreakIf 4-53<br />
ByName 4-54<br />
Certainty 4-56<br />
CF 4-57<br />
Clear 4-58<br />
CM 4-60<br />
CM Add 4-65<br />
CM Beep 4-68<br />
CM Delete 4-69<br />
CM Error 4-71<br />
CM GetCoordinates 4-73<br />
CM GetCursor 4-74<br />
CM GetDimensions 4-75<br />
CM GetInfo 4-76<br />
CM GetObjectInfo 4-78<br />
CM GetOutlineColor 4-79<br />
CM GetPosition 4-81<br />
CM GetStatus 4-82<br />
CM GetText 4-84<br />
CM GetTextColor 4-85<br />
CM GetTitleColor 4-87<br />
CM GetTitlePosition 4-89<br />
continued<br />
KDL Statement Syntax 4-3
KDL statement syntax<br />
4-4 <strong>Language</strong> <strong>Reference</strong><br />
continued<br />
Topic Page<br />
CM GetWindow 4-90<br />
CM GetWindowList 4-93<br />
CM GetWord 4-94<br />
CM PopUp 4-95<br />
CM SetCursor 4-97<br />
CM SetDimensions 4-98<br />
CM SetOutlineColor 4-99<br />
CM SetPosition 4-101<br />
CM SetTextColor 4-102<br />
CM SetTitleColor 4-104<br />
CM SetTitlePosition 4-106<br />
CM System 4-107<br />
COS 4-111<br />
Create 4-112<br />
CSort 4-115<br />
CurrentDate 4-116<br />
CurrentTime 4-117<br />
CurrentValue 4-118<br />
Date 4-119<br />
Date (Integer) 4-120<br />
Date (Months) 4-121<br />
Date (Record) 4-122<br />
Date (String) 4-123<br />
Date (Weekday) 4-124<br />
continued
KDL statement syntax<br />
continued<br />
Topic Page<br />
Date (Yearday) 4-125<br />
Date (Years) 4-126<br />
DBMS 4-127<br />
Delete (from list or set) 4-131<br />
Delete (instance) 4-133<br />
Difference 4-135<br />
DIV 4-136<br />
DSort 4-137<br />
Exists 4-140<br />
ExitState 4-142<br />
EXP 4-144<br />
FinalValue 4-145<br />
First 4-146<br />
For (class iteration) 4-147<br />
For (direct iteration) 4-149<br />
For (explicit iteration) 4-151<br />
For (implicit iteration) 4-153<br />
ForwardChain 4-155<br />
Function 4-157<br />
Graph 4-159<br />
Group 4-161<br />
HEX 4-163<br />
If 4-164<br />
Ifmatch 4-168<br />
continued<br />
KDL Statement Syntax 4-5
KDL statement syntax<br />
4-6 <strong>Language</strong> <strong>Reference</strong><br />
continued<br />
Topic Page<br />
Includes 4-174<br />
Index 4-175<br />
Intersection 4-176<br />
Last 4-177<br />
Length 4-178<br />
LN 4-179<br />
Loop 4-180<br />
Max 4-181<br />
Message 4-182<br />
Min 4-183<br />
MOD 4-184<br />
NameOf 4-185<br />
Not 4-187<br />
Num 4-188<br />
Or 4-189<br />
Parameter 4-191<br />
Process 4-193<br />
ReadStr 4-194<br />
Report 4-199<br />
Return 4-200<br />
Round 4-202<br />
Rule 4-203<br />
SelectAll 4-204<br />
continued
KDL statement syntax<br />
continued<br />
Topic Page<br />
SelectOne 4-205<br />
Send (to class) 4-207<br />
Send (to instance) 4-209<br />
Send Up 4-212<br />
Set 4-214<br />
SIN 4-215<br />
Size 4-216<br />
Slot 4-217<br />
SourceValue 4-219<br />
SQR 4-220<br />
SQRT 4-221<br />
State 4-222<br />
Str (from Booleans) 4-224<br />
Str (from dates and times) 4-226<br />
Str (from integers) 4-229<br />
Str (from real numbers) 4-231<br />
Str (with strings) 4-234<br />
Substring 4-236<br />
Time 4-237<br />
Trunc 4-238<br />
Union 4-239<br />
Unknown 4-240<br />
With 4-242<br />
WriteStr 4-243<br />
continued<br />
KDL Statement Syntax 4-7
KDL statement syntax<br />
4-8 <strong>Language</strong> <strong>Reference</strong><br />
continued<br />
Topic Page<br />
XOR 4-246<br />
KDL syntax summary by data type 4-247<br />
Summary of additional KDL statement syntax 4-257
KDL statement syntax<br />
KDL statement syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
This chapter describes the syntax and use of the following KDL statements:<br />
.........................................................................................................................................................................................................˝..........................................<br />
Numeric operations<br />
and functions<br />
ABS Absolute value<br />
AND Bitwise AND comparison<br />
ARCTAN Arctangent<br />
COS Cosine<br />
DIV Integer Division<br />
EXP Exponent of Log e<br />
LN Logarithm<br />
MAX Maximum value<br />
MIN Minimum value<br />
MOD Modulus<br />
NOT Negation<br />
OR Bitwise OR comparison<br />
ROUND Rounding<br />
SIN Sine<br />
SQR Square<br />
SQRT Square root<br />
STR Convert a time or date into a string<br />
TRUNC Truncate<br />
XOR Bitwise EXCLUSIVE OR comparison<br />
+ Addition<br />
- Subtraction<br />
* Multiplication<br />
KDL Statement Syntax 4-9
KDL statement syntax<br />
4-10 <strong>Language</strong> <strong>Reference</strong><br />
/ Division<br />
** Exponent<br />
.........................................................................................................................................................................................................˝..........................................<br />
Logical operators<br />
AND All conditions are true<br />
NOT Negation<br />
OR Any condition is true<br />
XOR All conditions are either not true or not false<br />
For more information: See Chapter 3, “Knowledge Definition <strong>Language</strong>.”<br />
.........................................................................................................................................................................................................˝..........................................<br />
String operations<br />
& Concatenate strings<br />
BIN Convert string of binary digits to an integer<br />
DATE Convert a date string into an internal date<br />
HEX Convert string of hexadecimal digits to an integer<br />
INDEX Find start of substring in a string<br />
LENGTH Find the size of a string<br />
NUM Convert a string of decimal digits into a number<br />
STR Convert a number into a string<br />
SUBSTRING Extract a substring from a string<br />
.........................................................................................................................................................................................................˝..........................................<br />
Date and time<br />
operations<br />
CURRENTDATE Return the current date as a number<br />
CURRENTTIME Return the current time as a number<br />
DATE Convert or calculate dates<br />
TIME Convert a time into a number<br />
.........................................................................................................................................................................................................˝..........................................<br />
List and set<br />
operations<br />
ADD Add an element<br />
APPEND Add a list<br />
ASORT Ascending sort
DELETE Delete an element from a list or set<br />
DIFFERENCE Find the elements that are not in all sets<br />
DSORT Descending sort<br />
FIRST Select elements from the beginning of a list<br />
INCLUDES Test for the presence of an element<br />
INDEX Find the position of an element<br />
INTERSECTION Find the common elements of sets<br />
LAST Select elements from the end of a list<br />
KDL statement syntax<br />
SIZE Determine the number of elements in a list or set<br />
UNION Find all elements of sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Certainty set<br />
operations<br />
CERTAINTY Return the certainty factor<br />
CF Convert a numeric expression into a certainty factor<br />
CSORT Descending sort by certainty factors<br />
WITH Specify or change a certainty factor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Control statements<br />
AES Execute an <strong>AionDS</strong> internal function<br />
ASK Force user sourcing<br />
BESTVALUE Cause <strong>AionDS</strong> to completely source parameters<br />
BREAK Terminate a loop<br />
BREAKIF Conditionally terminate a loop<br />
CLEAR Clear the value or constraint of a VALUE-CAN-CHANGE<br />
parameter<br />
CURRENTVALUE Use the current value for a parameter<br />
EXITSTATE Abort processing of a state<br />
FINALVALUE Use the final value of a parameter<br />
FOR Iterate over a set, list, or KDL statements<br />
FORWARDCHAIN Cause <strong>AionDS</strong> to execute the rules in the rule queue<br />
KDL Statement Syntax 4-11
KDL statement syntax<br />
4-12 <strong>Language</strong> <strong>Reference</strong><br />
IF Conditional execution<br />
LOOP Iterative execution<br />
RETURN Terminate a rule or a function<br />
SOURCEVALUE Backward chain for unresolved parameters<br />
.........................................................................................................................................................................................................˝..........................................<br />
Agenda statements<br />
FUNCTION Specify a function object as a goal<br />
GRAPH Specify a graph object as a goal<br />
GROUP Specify a group object as a goal<br />
MESSAGE Specify a message object as a goal<br />
PARAMETER Specify a parameter object as a goal<br />
PROCESS Specify a process object as a goal<br />
REPORT Specify a report object as a goal<br />
RULE Specify a rule object as a goal<br />
SLOT Specify a slot object as a goal<br />
STATE Specify a state object as a goal<br />
.........................................................................................................................................................................................................˝..........................................<br />
Object processing<br />
statements<br />
ASORT Sort instances in ascending order<br />
CREATE Create a dynamic instance<br />
DELETE Remove a dynamic instance<br />
DSORT Sort instances in descending order<br />
EXISTS Determine whether an instance exists<br />
IFMATCH Specify a pattern-matching rule<br />
NAMEOF Determine the name of an instance<br />
SELECTALL Retrieve pointers to instances<br />
SELECTONE Retrieve a pointer to an instance<br />
SEND Send a message that invokes a method
KDL statement syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Consultation<br />
monitor statements<br />
CM ADD Add windows of an object to the current screen<br />
CM BEEP Cause the terminal to beep<br />
CM DELETE Remove windows of an object from the current<br />
screen<br />
CM ERROR Display an error message for a window<br />
CM GETCOORDINATES Retrieve the screen coordinates of the cursor<br />
CM GETCURSOR Retrieve the current cursor position<br />
CM GETDIMENSIONS Retrieve the height and width of a window<br />
CM GETINFO Retrieve status information for a window<br />
CM GETOBJECTINFO Retrieve information about the object associated<br />
with a specified window<br />
CM GETOUTLINECOLOR Retrieve the color of the outline of a window<br />
CM GETPOSITION Retrieve the location of a window on the screen<br />
CM GETSTATUS Retrieve status information for an Answer window<br />
CM GETTEXT Retrieve the text for a window<br />
CM GETTEXTCOLOR Retrieve the color of the text of a window<br />
CM GETTITLECOLOR Retrieve the color of the title of a window<br />
CM GETTITLEPOSITION Retrieve the location of the title of a window on<br />
the screen<br />
CM GETWINDOW Retrieve a handle for a window<br />
CM GETWINDOWLIST Retrieve a list of all currently active windows<br />
CM GETWORD Retrieve the word that the cursor is on<br />
CM POPUP Pop up the windows for an object on the current<br />
screen<br />
CM SETCURSOR Move the cursor to a window<br />
CM SETDIMENSIONS Set the height and width of a window<br />
CM SETOUTLINECOLOR Set the color of the outline of a window<br />
CM SETPOSITION Set the location of a window on the screen<br />
KDL Statement Syntax 4-13
KDL statement syntax<br />
4-14 <strong>Language</strong> <strong>Reference</strong><br />
CM SETTEXTCOLOR Set the color of the text of a window<br />
CM SETTITLECOLOR Set the color of the title of a window<br />
CM SETTITLEPOSITION Set the location of the title of a window on the<br />
screen<br />
CM SYSTEM Execute a system-defined function<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES statements<br />
AES ABORT Terminate the consultation without user prompting<br />
AES BREAK Suspend execution of the consultation and invoke the<br />
Debug monitor<br />
AES CHAIN Change the value of AES_CHAIN<br />
AES ERROR Display an error message and abort the consultation<br />
AES EXITCODE Set the return code to the operating system<br />
AES PROFILE Change the value of a profile option<br />
AES TITLE Change the title line of the Consultation monitor<br />
AES TRACELEVEL Change the value of the trace level<br />
AES WRITELOG Modify the return code and write a message to the log<br />
file<br />
AES WRITETRACE Write a string to the trace file<br />
.........................................................................................................................................................................................................˝..........................................<br />
Input and output<br />
statements<br />
The syntax of I/O statements are specific to the access method that you use.<br />
See the <strong>AionDS</strong> I/O <strong>Reference</strong> manual for information about access methods<br />
and the syntax of I/O statements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Other statements<br />
BYNAME Assign fields or slots by name<br />
DBMS Force an I/O operation for an access method of a class<br />
READSTR Copy the contents of a variant record into fields,<br />
parameters, or slots<br />
SET Change a property of an object<br />
UNKNOWN Test whether a parameter has a known value
KDL statement syntax<br />
WRITESTR Copy the contents of fields, parameters, or slots into a<br />
file parameter<br />
/* */ Comment<br />
The operations are described in alphabetical order in the sections that follow.<br />
For more information: See Chapter 3, “Knowledge Definition <strong>Language</strong>,”<br />
for information on expressions, comparisons, and the use of some of these<br />
statements.<br />
KDL Statement Syntax 4-15
& (Concatenate)<br />
& (Concatenate)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-16 <strong>Language</strong> <strong>Reference</strong><br />
Use the concatenation symbol (&) to append a string to another string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
strexpr & strexpr [ & strexpr ... ]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
strexpr<br />
is a string expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
If one of the string expressions is unknown, the result will also be unknown.<br />
.........................................................................................................................................................................................................˝..........................................<br />
param1 & param2 & '.dat'<br />
Example
* (Multiply)<br />
* (Multiply)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the multiplication operator (*) to multiply two numeric expressions.<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr * numexpr<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
real_pa = int_pa * 10.<br />
Example<br />
KDL Statement Syntax 4-17
** (Exponent)<br />
** (Exponent)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-18 <strong>Language</strong> <strong>Reference</strong><br />
Use the exponentiation operator (*) to raise a numeric expression to a power.<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr ** exponent<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
exponent<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
If the result is outside of the range between -2,147,483,648 and<br />
2,147,483,647, either numexpr or exponent must be a real number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
real_pa = int_pa ** 10.1<br />
Example
+ (Add)<br />
+ (Add)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the addition operator (+) to add two numeric expressions.<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr + numexpr<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
real_pa = int_pa + 10.<br />
Example<br />
KDL Statement Syntax 4-19
- (Subtract)<br />
- (Subtract)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-20 <strong>Language</strong> <strong>Reference</strong><br />
Use the subtraction operator (-) to subtract a numeric expression from<br />
another one.<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr - numexpr<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
real_pa = int_pa - 10.<br />
Example
(Divide)<br />
/ (Divide)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the operator (/) to divide a numeric expression by another one.<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr / numexpr<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
numexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
real_pa = int_pa / 10.<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
DIV, MOD<br />
See also<br />
KDL Statement Syntax 4-21
* */ (Comment)<br />
/* */ (Comment)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-22 <strong>Language</strong> <strong>Reference</strong><br />
Use /* and */ to delimit comments in KDL.<br />
.........................................................................................................................................................................................................˝..........................................<br />
/* comment */<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
comment<br />
is a string constant.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Comments can start on one line and end on another. <strong>AionDS</strong> ignores<br />
everything between the start and end of a comment.<br />
■ Comments cannot be nested.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In the following example, ELSEIF clauses are not executed because they are<br />
within the comment:<br />
if option =1 then cost = 5000<br />
/* elseif option =2 then cost = 7000<br />
elseif option =3 then cost = 10000 */ /* TEST */<br />
else<br />
cost =0<br />
error =TRUE<br />
end<br />
The constant string TEST is within a separate comment.<br />
The following statement is invalid because the comments are nested:<br />
/* Invalid comment follows: */<br />
/* if a = b then<br />
/* tricky action */<br />
b = a */<br />
then<br />
...<br />
end
ABS<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use ABS to return the absolute value of a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
ABS (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
abs (sales_costs)<br />
Examples<br />
variance > abs (allow_dev)<br />
ABS<br />
KDL Statement Syntax 4-23
Add<br />
Add<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-24 <strong>Language</strong> <strong>Reference</strong><br />
Use ADD to add an element to a list, set, or certainty set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
ADD item TO [library::]param [WITH CF(cf_val)]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
item<br />
is an element of a set or list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter or slot exists. The<br />
library name is only required when duplicate parameter or slot names exist in<br />
any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is a list, set, certainty set parameter, slot, function argument, or local variable.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cf_val<br />
is a number representing a certainty factor for a certainty set item.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Use the WITH clause only with a certainty set. It assigns a certainty value<br />
for an item.<br />
■ If you do not specify cf_val with a certainty set element, <strong>AionDS</strong> uses a<br />
default of 1.00.<br />
■ You must use CF to convert cf_val into a certainty factor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
add acct_no to acct_list<br />
Examples<br />
add 10.00 to prices_paid<br />
add 'flu' to possible_cause with cf(0.6)
AES<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
Use the AES statement to execute an internal <strong>AionDS</strong> function. The<br />
functions are as follows:<br />
ABORT Causes immediate termination of the consultation<br />
without user prompting.<br />
BREAK Suspends execution of the consultation and places<br />
you in the debug monitor.<br />
CHAIN Changes the value of AES_CHAIN.<br />
ERROR Displays an error message and aborts the<br />
consultation.<br />
EXITCODE Sets the return code to the operating system.<br />
PROFILE Changes the value of a profile option.<br />
TITLE Changes the title line of the consultation monitor.<br />
TRACELEVEL Changes the value of the trace level.<br />
AES<br />
WRITELOG Modifies the return code and writes a message to the<br />
log file.<br />
WRITETRACE Writes a string to the trace file.<br />
See the following sections for specific syntax and other information.<br />
KDL Statement Syntax 4-25
AES Abort<br />
AES Abort<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-26 <strong>Language</strong> <strong>Reference</strong><br />
Use AES ABORT to terminate the consultation without user prompting.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (ABORT [, bool_expr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes execution of the statement when the<br />
expression is true.
AES Break<br />
AES Break<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use AES BREAK to suspend the consultation for debugging.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (BREAK [, bool_expr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes execution of the statement when the<br />
expression is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The debugger must be active. You can do this by setting the DEBUG-<br />
MODE profile option to ON or by enabling the debugger on the Run<br />
Settings dialog in graphical <strong>AionDS</strong>.<br />
■ You are placed in the debugger.<br />
KDL Statement Syntax 4-27
AES Chain<br />
AES Chain<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-28 <strong>Language</strong> <strong>Reference</strong><br />
Use AES CHAIN to start execution of a knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (CHAIN, chain_var [, bool_expr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
chain_var<br />
is a parameter or string that identifies the knowledge base to which you want<br />
to chain.<br />
The syntax for chain_var is as follows:<br />
kb_name [version.level [mvs_hlq] [file_name]]<br />
kb_name is the name of an existing knowledge base.<br />
version is the version number of the knowledge base.<br />
level is the level within the version.<br />
mvs_hlq is a high-level qualifier in MVS.<br />
file_name is the name of the file containing the answers to the<br />
consultation.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes execution of the statement when the<br />
expression is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ AES CHAIN allows a knowledge base to load a knowledge base over itself<br />
and start it executing. This is useful in situations where the knowledge<br />
bases operate in a serial fashion, and you want to reduce memory use.<br />
You can also use AES CHAIN to load the same knowledge base over itself<br />
to create a looping knowledge base.<br />
■ You cannot pass data from the first knowledge base to the second or<br />
chained knowledge base. Instead you can write the data from the first
knowledge base to an external file or database; then the second<br />
knowledge base can read the data from the external file or database.<br />
■ You cannot chain between HPO knowledge bases and non-HPO<br />
knowledge bases.<br />
AES Chain<br />
■ All HPO knowledge base load modules on the mainframe should be in<br />
the same load library, as specified in the STEPLIB of the JCL or<br />
LINKLIB of the CLIST for <strong>AionDS</strong>/MVS, or in the STEPLIB of the<br />
MAES JCL for <strong>AionDS</strong>/CICS or <strong>AionDS</strong>/IMS.<br />
.........................................................................................................................................................................................................˝..........................................<br />
aes (chain, 'd:\acct 1.20')<br />
Example<br />
KDL Statement Syntax 4-29
AES Error<br />
AES Error<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-30 <strong>Language</strong> <strong>Reference</strong><br />
Use AES ERROR to terminate a consultation and to display an error message.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (ERROR, error_no [, bool_expr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
error_no<br />
is an integer expression that evaluates to the error number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes execution of the statement when the<br />
expression is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
Use error numbers from 10,000 to 10,099, inclusive. Other error numbers<br />
are reserved for use by <strong>AionDS</strong>.
AES Exitcode<br />
AES Exitcode<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use AES EXITCODE to set the exit code that <strong>AionDS</strong> returns to the operating<br />
system.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (EXITCODE, exitcode [, bool_expr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
exitcode<br />
is an integer expression that evaluates to the exit code.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes execution of the statement when the<br />
expression is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Use exitcode numbers from 0 to 32,767, inclusive. Other numbers are<br />
reserved for use by <strong>AionDS</strong>.<br />
■ The value specified by exitcode when AES EXITCODE was executed last is<br />
the value that is returned to the operating system, unless a fatal abend<br />
occurs. In the case of a fatal abend, a value of 16 is returned to the<br />
operating system regardless of the value of exitcode when AES EXITCODE<br />
was executed last.<br />
KDL Statement Syntax 4-31
AES Profile<br />
AES Profile<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-32 <strong>Language</strong> <strong>Reference</strong><br />
Use AES PROFILE to change the value of a profile option.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (PROFILE, option, value [, bool_expr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is a string that specifies the profile option to change.<br />
.........................................................................................................................................................................................................˝..........................................<br />
value<br />
is a string that specifies the new value of the profile option.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes the statement to execute when the<br />
expression is TRUE.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ See the <strong>AionDS</strong> User’s <strong>Guide</strong> or User’s <strong>Guide</strong> (Character-Based) for a list<br />
of profile options.<br />
■ The following profile options cannot be modified using the AES PROFILE<br />
command:<br />
510-COMPATIBILITY SCREEN-INFO<br />
DEBUG-MODE TRACE-FILE<br />
LOG-FILE TRACE-LEVEL<br />
MOUSE-SUPPORT USER-INTERFACE<br />
■ Use the AES TRACELEVEL command to change the TRACE-LEVEL profile<br />
option.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following AES PROFILE statement causes the inference engine to use<br />
0.001 as the tolerance for comparing real numbers:<br />
aes (profile, 'comparison-tolerance', '0.001')
AES Title<br />
AES Title<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use AES TITLE to change the title line of the Consultation monitor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (TITLE, title [, bool_expr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
title<br />
is a string or parameter that contains the new title.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes execution of the statement when the<br />
expression is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ AES TITLE is only valid for character-based knowledge bases.<br />
Remarks<br />
■ You can create a title parameter to contain the new title. The default<br />
title, which is called AES_TITLE, is 80 characters long and contains the<br />
current date beginning in column 53, the current time beginning in<br />
column 63, and the version number beginning in column 73.<br />
■ If title is less than 80 characters, the part of the AES_TITLE that is not<br />
overwritten still displays. This is useful, for example, if you want to<br />
display the current date or time. In this case, make title less than 53<br />
characters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
aes (title, new_title)<br />
Example<br />
KDL Statement Syntax 4-33
AES Tracelevel<br />
AES Tracelevel<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-34 <strong>Language</strong> <strong>Reference</strong><br />
Use AES TRACELEVEL to change the trace level.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (TRACELEVEL [, trace_lev [, bool_expr]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
trace_lev<br />
is an integer expression specifying the new trace level.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes execution of the statement when the<br />
expression is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The trace level must be between zero and four inclusive in <strong>AionDS</strong>/PC<br />
and <strong>AionDS</strong>/2, and between zero and three inclusive in <strong>AionDS</strong>/MVS.<br />
■ To turn the trace off an on with AES TRACELEVEL, you must set the<br />
trace-level profile option to 2 or higher before starting the consultation.<br />
■ The trace level controls the availability of trace output and other features,<br />
as follows:<br />
Trace level Description<br />
0 No trace output. Explanation facility is not available.<br />
1 No trace output. Explanation facility is available.<br />
2 Trace output and Explanation facility are available.<br />
3 Same as trace level 2.<br />
4 Trace displayed on screen during a consultation.<br />
Explanation facility is available.<br />
Exception: The Explanation facility is not available for graphical<br />
knowledge bases.
AES Tracelevel<br />
■ If you do not specify trace_lev, <strong>AionDS</strong> resets the trace level to the level<br />
specified by the TRACE-LEVEL profile option.<br />
.........................................................................................................................................................................................................˝..........................................<br />
aes (tracelevel, 4, test_it)<br />
Example<br />
KDL Statement Syntax 4-35
AES Writelog<br />
AES Writelog<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-36 <strong>Language</strong> <strong>Reference</strong><br />
Use AES WRITELOG to modify the return code and to write a string to the log<br />
file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (WRITELOG, ret_code, output_str [, bool_expr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
ret_code<br />
can be any integer value. For example, you can set ret_code to one of the<br />
following return codes:<br />
0 Okay<br />
4 Warning<br />
8 Consultation error<br />
.........................................................................................................................................................................................................˝..........................................<br />
output_str<br />
is a string or parameter that <strong>AionDS</strong> places in the log file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes execution of the statement when the<br />
expression is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The ret_code is available to the operating system.<br />
■ You cannot set ret_code to a lower value than the value set by <strong>AionDS</strong>.<br />
■ AES WRITELOG is provided for compatibility with earlier versions of<br />
<strong>AionDS</strong>. To set the return code, you should use AES EXITCODE instead.<br />
.........................................................................................................................................................................................................˝..........................................<br />
aes (writelog, 16, io_err_msg)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES EXITCODE<br />
See also
AES Writetrace<br />
AES Writetrace<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use AES WRITETRACE to write a string to the trace file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (WRITETRACE, trace_str [, bool_expr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
trace_str<br />
is the string or parameter that <strong>AionDS</strong> writes to the trace file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression that causes execution of the statement when the<br />
expression is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
The trace level must be greater than one.<br />
.........................................................................................................................................................................................................˝..........................................<br />
aes (writetrace, trace_param, test_it)<br />
Example<br />
KDL Statement Syntax 4-37
AES_CF<br />
AES_CF<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-38 <strong>Language</strong> <strong>Reference</strong><br />
Use AES_CF to carry the certainty of the premise over to actions of the rule.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CF([cert_no * ] AES_CF)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
cert_no<br />
is the certainty value<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
if input includes 'red'<br />
then<br />
add 'usa' to possible_flags with cf(.7 * aes_cf)<br />
end
And<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use AND to return the logical or bitwise AND of two expressions.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr1 AND expr2<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr1<br />
is an integer or Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr2<br />
is an integer or Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Both expressions must be the same type.<br />
■ If expr1 is a Boolean that evaluates to false, expr2 is not evaluated.<br />
■ If the expressions are integers, <strong>AionDS</strong> makes a bitwise comparison to<br />
test each bit in expr1 against the corresponding bit in expr2.<br />
■ The expressions cannot be greater than 2,147,483,647.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following premise of a rule:<br />
if not disabled and (age
And<br />
4-40 <strong>Language</strong> <strong>Reference</strong><br />
The integer parameters INT_128 and INT_1023 contain the values 128 and<br />
1,023 respectively. When the statement executes, RESULT contains 128. You<br />
should consider the operation in binary notation, as follows:<br />
int_128: 0000000010000000<br />
int_1023: 0000001111111111<br />
result: 0000000010000000<br />
The RESULT parameter contains the AND of the bits.<br />
Consider the following statement:<br />
if hex('0001') and flag = 1 then ...<br />
The statement tests the FLAG parameter to hexadecimal 1. If only the loworder<br />
bit of FLAG is set, the condition is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BIN, HEX, NOT, OR, XOR<br />
See also
Append<br />
Append<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use APPEND to create a new list from one or more lists.<br />
.........................................................................................................................................................................................................˝..........................................<br />
APPEND (lexpr [, lexpr ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
lexpr<br />
is a list expression containing a list to append.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
Lists are appended in the order specified, from left to right.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
original = append (asort(original), new_items1,<br />
new_items2)<br />
.........................................................................................................................................................................................................˝..........................................<br />
INTERSECTION, UNION<br />
See also<br />
KDL Statement Syntax 4-41
ArcTan<br />
ArcTan<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-42 <strong>Language</strong> <strong>Reference</strong><br />
Use ARCTAN to return a real result for the arctangent of a numeric<br />
expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
ARCTAN (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement returns a value between 0 and 2pi, inclusive.<br />
■ nexpr must result in a number between -1 and 1, inclusive.<br />
.........................................................................................................................................................................................................˝..........................................<br />
arc75 = arctan(.75)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
COS, SIN<br />
See also
Ask<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use ASK to force <strong>AionDS</strong> to ask the user for the value of a parameter, slot,<br />
instance, or class of instances.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
ASK ([library::]param | inst_ref | [inst_ref.]slot |<br />
CLASS([library::]classname) | CURRENTCLASS [,s_option])<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter or class exists.<br />
The library name is only required when duplicate parameter or class names<br />
exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of a parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
inst_ref<br />
is an instance reference. An inst_ref is one of the following references:<br />
[library::]classname [(inst_id)] | pointer-> | CURRENT |<br />
inst_nm<br />
An instance reference can have one of the following forms:<br />
classname(inst_nm) where inst_nm is the name of an instance.<br />
classname(->str_expr) where str_expr is a string expression<br />
that contains the name of an instance.<br />
classname(inst_no) where inst_no is a non-negative integer that<br />
identifies an instance.<br />
Ask<br />
KDL Statement Syntax 4-43
Ask<br />
4-44 <strong>Language</strong> <strong>Reference</strong><br />
classname(pointer->) where pointer is a pointer to an instance.<br />
classname(CURRENT) where CURRENT represents the current<br />
instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
slot<br />
is the name of a slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
s_option<br />
is one of the following sourcing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ This statement is useful for asking the value of a VALUE-CAN-CHANGE<br />
object more than once without requiring the use of iterating states.<br />
■ Except when ASK is executed on a class, <strong>AionDS</strong> only executes the<br />
statement if a slot, slots in an instance or class, or a parameter has<br />
TRUE/ASK specified in its Value Can Change property or if the object has<br />
no value.<br />
■ When ASK is executed on a class that has no instances, the user can enter<br />
additional values for any slot to create new instances. When the class<br />
contains instances, the user can enter values for those slots whose Value<br />
Can Change property is TRUE/ASK.<br />
■ When ASK is executed on a class, you can assign an application key to a<br />
special DELETE command. This will let the user delete the instance that<br />
the cursor is on by pressing the key. For example, enter F3=DELETE in<br />
the Application Keys property of the class display object to let users delete<br />
instances with the F3 key.<br />
■ When ASK is executed on an instance, only slots with displays are<br />
displayed. If none of the slots have a display, nothing is displayed.<br />
■ The ASK statement does not replace user sourcing. If the parameter<br />
becomes a goal, <strong>AionDS</strong> might ask the user for a value even if a value was<br />
assigned already during execution of ASK.<br />
■ The param cannot be part of a structured parameter. For example,<br />
param cannot be a field in a record or an element of a list or set.
Ask<br />
■ The s_option specifies how <strong>AionDS</strong> backward chains to resolve properties,<br />
such as the Prompt, Display, Explain properties, and the _LEN parameter<br />
associated with the parameter.<br />
■ <strong>AionDS</strong> does not ask the user to supply a value if the object is already<br />
processed.<br />
■ <strong>AionDS</strong> uses the contents of the Facts property only once. The ASK<br />
statement does not reuse facts, unless the facts are reset using the CLEAR<br />
statement.<br />
■ If the contents of the Facts property cannot be executed to completion,<br />
<strong>AionDS</strong> executes the ASK statement anyway.<br />
■ Only use the ASK statement when you cannot control sourcing using the<br />
inference-based techniques provided in <strong>AionDS</strong>. Indiscriminate use of<br />
this statement reduces the effectiveness of inference-based processing.<br />
For more information: See Chapter 3 for more information about<br />
instance references and sourcing options.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In the following example, RAWDATE_PA is a VALUE-CAN-CHANGE parameter<br />
equal to TRUE/ASK. The loop forces the user to enter a date less than 30 days<br />
in the future.<br />
loop<br />
ask(rawdate_pa)<br />
/* fix funny date format */<br />
function fix_date(rawdate_pa,pretty_date)<br />
breakif (pretty_date - currentdate) < 30<br />
end<br />
The following examples show the ASK statement for classes:<br />
ask(class(truck))<br />
ask(currentclass)<br />
The following examples show the ASK statement for instances:<br />
ask(class(truck(bronco))<br />
ask(truck(bronco))<br />
ask(truck_ptr->)<br />
ask(current)<br />
KDL Statement Syntax 4-45
Ask<br />
4-46 <strong>Language</strong> <strong>Reference</strong><br />
The following examples show the ASK statement for slots:<br />
ask(driver)<br />
ask(class(truck(bronco).driver)<br />
ask(truck(bronco).driver)<br />
ask(truck_ptr->.driver)<br />
ask(current.driver)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CLEAR<br />
See also
ASort<br />
ASort<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use ASORT to sort a list or set in ascending order, to sort the instances in a<br />
class by ascending order by slot value, to sort a list of pointers to instances in<br />
ascending order by slot value, or to sort a list or set of records in ascending<br />
order by field sequence.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
ASORT (lexpr | CLASS([library::]classname) | CURRENTCLASS<br />
[ON prop [, prop ... ]])<br />
.........................................................................................................................................................................................................˝..........................................<br />
lexpr<br />
is a list, set, or a list or set expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
prop<br />
is a field in a record or a slot in a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You must specify a record field name as a prop when you sort a list or set<br />
of records.<br />
■ You must specify a slot name as a prop when you sort a class.<br />
■ ASORT returns a list or set with the same base type as the lexpr base type.<br />
■ You can use ASORT as a procedure. If you do not specify a return<br />
parameter, <strong>AionDS</strong> sorts the data in place and the source object contains<br />
the sorted data.<br />
KDL Statement Syntax 4-47
ASort<br />
4-48 <strong>Language</strong> <strong>Reference</strong><br />
■ <strong>AionDS</strong> does not backward chain for values of arguments when ASORT<br />
is used as a procedure.<br />
■ If you sort a class, you should use ASORT as a procedure. It sorts the class<br />
in place. If you use a return parameter, the parameter must be a list of<br />
records in which the structure of the records are equivalent to the<br />
structure of the instances.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statement sorts the TEST_SCORES integer list and returns the<br />
sorted data to the SORTED_SCORES integer list:<br />
sorted_scores = asort (test_scores)<br />
The following statement sorts a set expression:<br />
sorted_union = asort (union(group_1, group_2))<br />
The following statement sorts a list of records on the LAST_NAME field:<br />
emp_list = asort (personnel on last_name)<br />
The following statement sorts a list of records on two fields:<br />
asc_trans = asort (trans on tr_year, tr_month)<br />
The TRANS list is sorted by TR_YEAR and TR_MONTH within TR_YEAR.<br />
The following statement sorts instances of the current class on SLOT1:<br />
asort(currentclass on slot1)<br />
The following statement sorts instances of class TRUCK by MAKE and by<br />
MODEL within MAKE:<br />
asort(class(truck) on make, model)
ASort<br />
The following statement sorts pointers to instances of class TRUCK where the<br />
COLOR slot contains red:<br />
ptr_list<br />
= asort(selectall(class(truck) where color = 'red')<br />
on name)<br />
The PTR_LIST parameter is a list of pointers to instances in class TRUCK. The<br />
list is ordered by the slot NAME.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CSORT, DSORT<br />
See also<br />
KDL Statement Syntax 4-49
BestValue<br />
BestValue<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-50 <strong>Language</strong> <strong>Reference</strong><br />
Use BESTVALUE to cause <strong>AionDS</strong> to completely source parameters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BESTVALUE (expr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is an expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ <strong>AionDS</strong> backward chains on all unprocessed parameters in expr,<br />
including VALUE-CAN-CHANGE parameters that have a value.<br />
■ <strong>AionDS</strong> only uses sources that are in scope to determine the value. If a<br />
parameter does not become processed because some sources are out of<br />
scope, <strong>AionDS</strong> uses the value determined by the in scope sources or<br />
UNKNOWN.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CURRENTVALUE, FINALVALUE, SOURCEVALUE<br />
See also
Bin<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use BIN to convert a string containing binary digits into an integer value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BIN (bin_str)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
bin_str<br />
is a string expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The string can only contain the characters 0 (zero) or 1.<br />
■ bin_str cannot exceed 32 characters, or the representation of 4 bytes.<br />
■ You can use STR to reverse the effect of BIN.<br />
.........................................................................................................................................................................................................˝..........................................<br />
int_val = bin('00010111')<br />
Example<br />
Bin<br />
KDL Statement Syntax 4-51
Break<br />
Break<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-52 <strong>Language</strong> <strong>Reference</strong><br />
Use BREAK to immediately terminate execution of a LOOP or FOR statement.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BREAK<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
After a BREAK statement executes, execution continues immediately after the<br />
END statement that terminates the LOOP or FOR statement.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following example:<br />
for listx<br />
if listx(i).key = key_num<br />
then<br />
goal = listx(i).name<br />
break<br />
end<br />
message(goal_found,immediate,currentvalue)<br />
end<br />
The BREAK statement causes unconditional termination of the FOR loop as<br />
soon as GOAL receives a value. The GOAL_FOUND message is not executed.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BREAKIF, RETURN<br />
See also
BreakIf<br />
BreakIf<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use BREAKIF to conditionally terminate execution of a FOR or LOOP<br />
statement.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BREAKIF bool_expr<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
Use BREAKIF to terminate a loop when bexpr is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following example:<br />
for listy<br />
breakif i > 5<br />
...<br />
end<br />
The system parameter I is the implied counter of the FOR loop. The BREAKIF<br />
statement terminates the loop as soon as the condition (I > 5) is true.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BYNAME , RETURN<br />
See also<br />
KDL Statement Syntax 4-53
ByName<br />
ByName<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-54 <strong>Language</strong> <strong>Reference</strong><br />
Use BYNAME to assign fields of a record or slots of an instance to another<br />
record or instance if the names of the fields or slots are the same in both<br />
objects.<br />
.........................................................................................................................................................................................................˝..........................................<br />
[library::]dest = [library::]source BYNAME<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the instance exists. The library<br />
name is only required when duplicate instance names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
dest<br />
is a record or instance that receives the assignment.<br />
.........................................................................................................................................................................................................˝..........................................<br />
source<br />
is a record or instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The BYNAME clause causes transfer between fields or slots only if the slot<br />
or field names match.<br />
■ There must be at least one field or slot name in the source record or<br />
instance that matches a field or slot in the dest record or instance.<br />
■ The source and dest records or instances do not have to contain the same<br />
number of fields or slots.<br />
■ The BYNAME clause is necessary if you cannot guarantee that the order of<br />
slots or fields in source match the order of slots or fields in dest. The<br />
BYNAME clause might also be necessary if you do not have the same<br />
number of slots or fields in source and dest.
ByName<br />
.........................................................................................................................................................................................................˝..........................................<br />
accounts(in_ptr->) = acct_file-> byname<br />
Example<br />
KDL Statement Syntax 4-55
Certainty<br />
Certainty<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-56 <strong>Language</strong> <strong>Reference</strong><br />
Use CERTAINTY to return the certainty factor of a Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CERTAINTY (bexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
bexpr<br />
is a Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
The certainty factor is returned as a real number with a value in the range of -<br />
1.00 to 1.00, inclusive.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cf_val = certainty(colors(i))<br />
Examples<br />
certainty (colors includes 'red')
CF<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CF to convert a numeric expression into a certainty factor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CF(nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
nexpr must resolve to a number between -1.00 and 1.00, inclusive.<br />
.........................................................................................................................................................................................................˝..........................................<br />
add 'flu' to possible_cause with cf(0.6)<br />
Example<br />
CF<br />
KDL Statement Syntax 4-57
Clear<br />
Clear<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-58 <strong>Language</strong> <strong>Reference</strong><br />
Use CLEAR to clear the value and constraint of a VALUE-CAN-CHANGE<br />
parameter or slot and to reset the sourcing sequence.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
CLEAR ([library::]param | [inst_ref.]slot [, CONSTRAINT |<br />
SOURCING])<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of a parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
inst_ref<br />
is an instance reference. An inst_ref is one of the following references:<br />
[library::]classname [(inst_id)] | pointer-> | CURRENT |<br />
inst_nm<br />
An instance reference can have one of the following forms:<br />
classname(inst_nm) where inst_nm is the name of an instance.<br />
classname(->str_expr) where str_expr is a string expression<br />
that contains the name of an instance.<br />
classname(inst_no) where inst_no is a non-negative integer that<br />
identifies an instance.<br />
classname(pointer->) where pointer is a pointer to an instance.<br />
classname(CURRENT) where CURRENT represents the current<br />
instance.
Clear<br />
For more information: See Chapter 3, “Knowledge Definition <strong>Language</strong>,”<br />
for information about instance references.<br />
.........................................................................................................................................................................................................˝..........................................<br />
slot<br />
is the name of a slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement marks the object as not processed so that it can be used in<br />
another ASK statement.<br />
■ If you use the CONSTRAINT option, constraints or assignments in the<br />
Facts property of the param or slot or slots in the instance or class are<br />
reset. When the object is specified as a goal or used in the ASK<br />
statement, <strong>AionDS</strong> reexecutes the constraint or assignment in the Facts<br />
property.<br />
■ The SOURCING option resets all sources for the object, as well as the<br />
object’s constraints. <strong>AionDS</strong> marks the Facts, System, User, and Default<br />
sources as unprocessed so that they can be used again when the object is<br />
specified as a goal or used in an ASK statement. The value of the param,<br />
inst_ref, or slot becomes UNKNOWN.<br />
■ If the sources for the object include rules, the SOURCING option only<br />
resets MULTIFIRE rules.<br />
.........................................................................................................................................................................................................˝..........................................<br />
clear (slot1, sourcing)<br />
Examples<br />
clear (pa1, constraint)<br />
.........................................................................................................................................................................................................˝..........................................<br />
ASK<br />
See also<br />
KDL Statement Syntax 4-59
CM<br />
CM<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
4-60 <strong>Language</strong> <strong>Reference</strong><br />
Use CM to explicitly control Consultation Monitor actions in a characterbased<br />
knowledge base. The CM commands are not valid for graphical<br />
knowledge bases.<br />
When deciding to use CM commands, you must understand how the<br />
Consultation Monitor builds screens. Before a screen is presented to the user,<br />
<strong>AionDS</strong> accumulates all displays associated with the structures that need to be<br />
shown. For example, when a group is executed, the Consultation Monitor<br />
accumulates all of the windows for each group member and assigns each<br />
window a handle. Each handle is a unique integer value that identifies only<br />
one window. Once all of the user-defined member displays are attached, the<br />
system displays (AES_ConsultationMonitor and AES_Template) are added to<br />
the screen and the screen is displayed. The cursor appears in the first active<br />
answer window on the screen, or in a message window if no input is required.<br />
.........................................................................................................................................................................................................˝..........................................<br />
When commands<br />
execute<br />
The CM commands only execute when the Consultation Monitor is active.<br />
The Consultation Monitor is active from the point immediately prior to the<br />
display of a screen until one of the following actions occur:<br />
■ The user files all Answer windows.<br />
■ The user files or quits from a Message or Browsefile window.<br />
When <strong>AionDS</strong> displays a screen, it is the active screen. An active screen does<br />
not exist until <strong>AionDS</strong> determines that a parameter, slot, message, group, or<br />
class or instance needs to be sourced or displayed.<br />
The active screen might change while the Consultation Monitor is active.<br />
For example, if you invoke CM POPUP to show another screen, the screen that<br />
pops up becomes active. When you FILE or QUIT from the pop up screen,<br />
the previous screen returns to being active. Note that the Consultation<br />
Monitor is active during this entire sequence.
You can keep the Consultation Monitor active between displays if you want.<br />
See the CM SETCURSOR statement later in this chapter for information on<br />
how to keep the Consultation Monitor active between displays.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Invoking CM<br />
functions<br />
A Consultation Monitor function is invoked in one of the following ways:<br />
■ By the execution of commands in a function specified by the Initial<br />
Function property of a display object<br />
■ By an application key that invokes a user-defined function that contains<br />
one or more CM statements<br />
■ By an application command that invokes a user-defined function that<br />
contains one or more CM statements<br />
CM<br />
■ By an IMMEDIATE rule that executes one or more CM statements when<br />
the user files an Answer window<br />
Note that the application key, application command, or rule does not have to<br />
invoke a CM statement directly. For example, a CM statement might be in an<br />
independent state that is invoked from a function attached to an application<br />
key.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Identifying the<br />
window<br />
Consultation Monitor functions allow you to manipulate the windows on the<br />
screen. In order to manipulate a window, you must execute the function you<br />
want and identify the window on which the function operates.<br />
Each window is identified uniquely by an integer, called a handle. Some<br />
functions, such as CM GETWINDOW, retrieve the handle. Once you have the<br />
handle for a window, you can use it to specify the window in another<br />
function. For example, the following statements get the handle for the<br />
Answer window of parameter PA1 and place the cursor in the Answer<br />
window:<br />
cm (getwindow, handle, parameter(pa1), 'answer')<br />
cm (setcursor, handle)<br />
In the example, handle must be an integer parameter or slot, or an integer<br />
local variable or input argument in a function.<br />
KDL Statement Syntax 4-61
CM<br />
4-62 <strong>Language</strong> <strong>Reference</strong><br />
The following sections describe CM statements for dynamic screen<br />
management. In the description, if the argument to a Consultation Monitor<br />
function receives a value, the function returns a value. In that case, the<br />
argument must be a parameter, slot, or local variable or output argument in a<br />
function. If the argument contains a value, the value is passed to the<br />
function. In that case, the argument also can be a constant or an input<br />
argument to a function.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
For example, you can use CM commands to verify a quit request before<br />
allowing a user to quit out of the current screen. You can assign a function<br />
key to a user-defined function which could be defined as follows:<br />
Clear(quit_screen_pa)<br />
CM(Popup,Parameter(quit_screen_pa))<br />
If quit_screen_pa = true then<br />
CM(System,'Quit')<br />
End<br />
A popular feature of computer applications is hypertext. This provides the<br />
capability to give text-sensitive information to the user based upon the<br />
position of the cursor. In <strong>AionDS</strong> this feature is usually implemented using<br />
the GETWORD and POPUP options. For example, you can assign F1 to the<br />
following function:<br />
/* Get the word the cursor is on */<br />
CM (GetWord,word_pa)<br />
/* Show the appropriate help message */<br />
If word_pa is 'Inferencing' then<br />
CM (Popup,Message(infer_help_message))<br />
elseif word_pa is 'CASE' then<br />
CM (Popup,Message(CASE_help_message))<br />
else<br />
CM (Popup,Message(not_valid_topic_msg))<br />
End<br />
It is common to store the lookup topics and corresponding help information<br />
in a class or external file.
CM commands can dynamically build and modify the screen based upon user<br />
answers or function keys pressed. The following rule shows a simple example<br />
of how you can modify screens at run time:<br />
ifmatch Car with type = 'Sportscar' then<br />
CM (Add,Slot(num_of_speeding_tix))<br />
End<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of functions<br />
The functions are as follows:<br />
ADD Add windows of an object to the current screen.<br />
BEEP Cause the terminal to beep.<br />
DELETE Remove windows of an object from the current<br />
screen.<br />
ERROR Display an error message for a window.<br />
GETCURSOR Retrieve the current cursor position.<br />
GETDIMENSIONS Retrieve the height and width of a window.<br />
GETINFO Retrieve status information for a window.<br />
GETOBJECTINFO Retrieves information about the object associated<br />
with a window.<br />
GETOUTLINECOLOR Retrieve the color of the outline of a window.<br />
GETPOSITION Retrieve the location of a window on the screen.<br />
GETSTATUS Retrieve status information for an Answer window.<br />
GETTEXT Retrieve the text for a window.<br />
GETTEXTCOLOR Retrieve the color of the text of a window.<br />
GETTITLECOLOR Retrieve the color of the title of a window.<br />
GETTITLEPOSITION Retrieve the location of the title of a window on the<br />
screen.<br />
GETWINDOW Retrieve a handle for a window.<br />
GETWINDOWLIST Retrieve a list of all windows on the current screen.<br />
GETWORD Retrieve the word that the cursor is on.<br />
CM<br />
KDL Statement Syntax 4-63
CM<br />
4-64 <strong>Language</strong> <strong>Reference</strong><br />
POPUP Pop up the windows for an object on the current<br />
screen.<br />
SETCURSOR Move the cursor to a window.<br />
SETDIMENSIONS Set the height and width of a window.<br />
SETOUTLINECOLOR Set the color of the outline of a window.<br />
SETPOSITION Set the location of a window on the screen.<br />
SETTEXTCOLOR Set the color of the text of a window.<br />
SETTITLECOLOR Set the color of the title of a window.<br />
SETTITLEPOSITION Set the location of the title of a window on the<br />
screen.<br />
SYSTEM Execute a system-defined function.
CM Add<br />
CM Add<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM ADD to add all windows that belong to an object to the current<br />
screen. Use this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(ADD, type([library::]name), [append])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
type<br />
is one of the following kinds of objects:<br />
CLASS<br />
DISPLAY<br />
MESSAGE<br />
PARAMETER<br />
SLOT<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class, parameter, or slot<br />
exists. The library name is only required when duplicate class, parameter, or<br />
slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
You cannot specify a display or message that is in a library.<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
append<br />
is a Boolean expression that specifies where to add the window in the list of<br />
windows for the screen.<br />
KDL Statement Syntax 4-65
CM Add<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The CM ADD operation is equivalent to adding a member to a group<br />
object. The windows from type(name) are added to the windows from<br />
other objects.<br />
4-66 <strong>Language</strong> <strong>Reference</strong><br />
The order in which windows display is controlled by their placement in<br />
the list. Windows from the first object’s display are shown before<br />
windows from the next object’s display, and so on. If windows from<br />
multiple displays share the same position, the first display which has<br />
active windows will appear on top of the other display. An active<br />
window is one in which the user is allowed to enter values such as an<br />
Answer Window.<br />
Windows from the first object are displayed before windows from the<br />
next object, and so on. If windows share the same position, the first<br />
window in the list displays.<br />
■ Application keys and commands from name are added to<br />
AES_CONSULTATIONMONITOR and AES_TEMPLATE.<br />
■ If type is SLOT, name is any valid slot reference.<br />
For more information: See Chapter 3, “Knowledge Definition<br />
<strong>Language</strong>,” for more information about slot references.<br />
■ If you add a type that specifies a link code, windows are not linked with<br />
other windows already on the current screen, even if the new windows<br />
have the same link code as the existing windows. However, all new<br />
windows that have the same link code are linked together.<br />
■ If you add a message in which the Pause property is FALSE and another<br />
window on the screen requires user input, the message continues to<br />
display until the screen is filed. The contents of the Pause property is<br />
ignored.<br />
■ If you used CM ADD to add parameter or slot windows and the user was<br />
asked for parameter or slot values, answers are not loaded from the store<br />
file into the parameter or slot. Turning on the Preload-answers profile<br />
option will not force the answers to be loaded into the parameter or slot.
CM Add<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following one-line function that is attached to the F1<br />
application key:<br />
cm(add,message(help))<br />
When the user presses F1, the function executes and the windows for the help<br />
message are added to the current screen.<br />
Consider the difference from the following function that invokes a message<br />
directly:<br />
message(help,currentvalue,immediate)<br />
In the second case, the message replaces the current screen. The original<br />
windows are not preserved.<br />
Consider the following CM ADD statement:<br />
cm(add,parameter(new_pa),FALSE)<br />
If the windows of NEW_PA share screen positions with other windows, the<br />
NEW_PA windows display on top of the other windows. If you do not specify<br />
FALSE, the NEW_PA windows would be covered by the other windows<br />
instead.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM DELETE<br />
See also<br />
KDL Statement Syntax 4-67
CM Beep<br />
CM Beep<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-68 <strong>Language</strong> <strong>Reference</strong><br />
Use CM BEEP to cause the terminal to beep in a character-based knowledge<br />
base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(BEEP)<br />
Syntax
CM Delete<br />
CM Delete<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM DELETE to remove all windows that belong to an object from the<br />
current screen. Use this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(DELETE, type([library::]name))<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
type<br />
is one of the following kinds of objects:<br />
CLASS<br />
DISPLAY<br />
MESSAGE<br />
PARAMETER<br />
SLOT<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class, parameter, or slot<br />
exists. The library name is only required when duplicate class, parameter, or<br />
slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
You cannot specify a display or message that is in a library.<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ <strong>AionDS</strong> takes no action if windows for name are not on the current<br />
screen.<br />
■ If type is SLOT, name is any valid slot reference.<br />
For more information: See Chapter 3, “Knowledge Definition<br />
<strong>Language</strong>,” for more information about slot references.<br />
KDL Statement Syntax 4-69
CM Delete<br />
4-70 <strong>Language</strong> <strong>Reference</strong><br />
■ To relink the windows after deleting some or all windows in a screen, you<br />
must specify the same link code for all windows and use CM ADD to add<br />
all windows together.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following function that is attached to the F1 application key:<br />
cm(delete,display(help))<br />
cm(add,display(help))<br />
When the user presses F1, windows attached to the display object HELP are<br />
removed from the current screen and replaced by new windows. This<br />
technique prevents multiple copies of the windows to be on the screen at one<br />
time if the user presses F1 more than once.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM ADD<br />
See also
CM Error<br />
CM Error<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM ERROR to display an error message for a window in a character-based<br />
knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(ERROR, handle, err_str [, beep])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
err_str<br />
is a string that contains an error message.<br />
.........................................................................................................................................................................................................˝..........................................<br />
beep<br />
is a Boolean that specifies whether to beep when <strong>AionDS</strong> displays err_str.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ You can use GETSTATUS to retrieve the err_str.<br />
Remarks<br />
■ If the cursor is not on a window when the statement executes, the cursor<br />
is moved to the window specified by handle.<br />
■ The err_str is displayed on the message line.<br />
■ You should use this statement as the last CM statement before the user<br />
returns to the screen.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following FORWARD, IMMEDIATE, MULTIFIRE rule. This rule<br />
fires when the user changes either CODE or VAL. The CM GETCURSOR<br />
statement determines the internal identifier for the window. CM ERROR<br />
causes <strong>AionDS</strong> to beep because the last argument is TRUE.<br />
ifmatch account with code = 'A' and (val < 0 or val > 10)<br />
then<br />
cm(getcursor, handle)<br />
err_text is 'Code A numbers must be between 0 and 10'<br />
cm(error,handle,err_text,true)<br />
end<br />
KDL Statement Syntax 4-71
CM Error<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETSTATUS<br />
See also<br />
4-72 <strong>Language</strong> <strong>Reference</strong>
CM GetCoordinates<br />
CM GetCoordinates<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM GETCOORDINATES to retrieve the screen coordinates of the cursor in<br />
a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETCOORDINATES, row[, col])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
row<br />
is an integer that receives the screen row of the cursor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
col<br />
is an integer that receives the screen column of the cursor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ row and col are relative to the upper left hand corner of the screen.<br />
■ The function can be used instead of CM GETCURSOR if the cursor is not<br />
currently in a specific window.<br />
■ GETCOORDINATES provides an absolute measure, whereas GETCURSOR<br />
provides different results when the user has scrolled a specific window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
To retrieve the absolute coordinates of the cursor:<br />
cm(getcoordinates, cur_row, cur_col)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETCURSOR<br />
See also<br />
KDL Statement Syntax 4-73
CM GetCursor<br />
CM GetCursor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-74 <strong>Language</strong> <strong>Reference</strong><br />
Use CM GETCURSOR to retrieve the current cursor position in a characterbased<br />
knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETCURSOR, handle [, row[, col]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that receives the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
row<br />
is an integer that receives the row number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
col<br />
is an integer that receives the column number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ row and col are relative to the window identified by handle. If the cursor<br />
is not in a window, the function returns values of 0 for row, col, and<br />
handle.<br />
■ The system function FILEWINDOW uses the current position of the cursor<br />
to choose the window to file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
In the following example, it is only necessary to determine the internal<br />
identifier, WINDOW_ID:<br />
cm(getcursor, window_id)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM SETCURSOR<br />
See also
CM GetDimensions<br />
CM GetDimensions<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM GETDIMENSIONS to retrieve the height and width of a window in a<br />
character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETDIMENSIONS, handle, height, width)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
height<br />
is an integer that receives the height of the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is an integer that receives the width of the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements get the dimensions for the current window:<br />
cm(getcursor, window_id)<br />
cm(getdimensions, window_id, height_pa, width_pa)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM SETDIMENSIONS<br />
See also<br />
KDL Statement Syntax 4-75
CM GetInfo<br />
CM GetInfo<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-76 <strong>Language</strong> <strong>Reference</strong><br />
Use CM GETINFO to retrieve information about a window in a characterbased<br />
knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETINFO, handle, name [, window [, part]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is a string that receives the name of the display object that owns the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
window<br />
is a string that receives one of the following window names:<br />
Answer<br />
Browse<br />
Browsefile<br />
Certainty<br />
Choices<br />
Command-line<br />
Confirm-menu<br />
Constraint<br />
Description<br />
Explain<br />
Functionkeys<br />
Graphic<br />
Information<br />
Input<br />
KDL<br />
Message-line<br />
Message<br />
Objects-menu<br />
Options-menu<br />
Prompt<br />
SelectionInput<br />
Summary<br />
Text<br />
.........................................................................................................................................................................................................˝..........................................<br />
part<br />
is a string that receives the name specified in the Field Name property of the<br />
display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you do not specify window, information about the Answer window or<br />
Message window is returned, depending on the kind of display object.<br />
■ If you do not specify part for a class or record, information about the first<br />
slot or field is returned.
CM GetInfo<br />
■ You can use the Field Name property in the Window Properties editor to<br />
differentiate part when there is more than one window of the same type,<br />
such as TEXT, in the display. For example, if you have two text windows,<br />
you can specify TEXT_1 and TEXT_2 in their respective Field Name<br />
properties. This property allows you to determine which text window<br />
corresponds to the handle.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following function retrieves the name of the display for the current<br />
window into NAME_PA:<br />
cm(getcursor, window_id)<br />
cm(getinfo, window_id, name_pa)<br />
WINDOW_ID is a local variable of type INTEGER.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETSTATUS, CM GETWINDOW, CM GETOBJECTINFO<br />
See also<br />
KDL Statement Syntax 4-77
CM GetObjectInfo<br />
CM GetObjectInfo<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-78 <strong>Language</strong> <strong>Reference</strong><br />
Use CM GETOBJECTINFO to retrieve the name, type, parent name, library<br />
name, and print name of the object associated with the specified window.<br />
Use this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
CM (GETOBJECTINFO, handle, name [, type [, parent<br />
[, library [, printname ]]]])<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is a string that receives the object name.<br />
.........................................................................................................................................................................................................˝..........................................<br />
type<br />
is a string that receives the object type.<br />
.........................................................................................................................................................................................................˝..........................................<br />
parent<br />
is a string that receives the parent name.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is a string that receives the library name.<br />
.........................................................................................................................................................................................................˝..........................................<br />
printname<br />
is a string that receives object print name.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ To retrieve object information about record fields, use the CM GETINFO<br />
command. Retrieving object information about record fields using CM<br />
GETOBJECTINFO will retrieve information about the parameter not the<br />
record fields.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETWINDOW, CM GETINFO<br />
See also
CM GetOutlineColor<br />
CM GetOutlineColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM GETOUTLINECOLOR to retrieve the color of the outline of a window.<br />
Use this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETOUTLINECOLOR, handle, char, [cell, [bright, [blink]]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
char<br />
is a string that receives the color of the characters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cell<br />
bright<br />
is a string that receives the background color of the cell.<br />
is a Boolean parameter that receives whether the brightness attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
blink<br />
is a Boolean parameter that receives whether the blink attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement can return the following colors in char and cell:<br />
BLACK<br />
BLUE<br />
CYAN<br />
GREEN<br />
MAGENTA<br />
RED<br />
WHITE<br />
YELLOW<br />
■ If bright is TRUE, the brightness attribute is set. If bright is FALSE, the<br />
brightness attribute is not set.<br />
■ If blink is TRUE, the blink attribute is set. If blink is FALSE, the blink<br />
attribute is not set.<br />
KDL Statement Syntax 4-79
CM GetOutlineColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
4-80 <strong>Language</strong> <strong>Reference</strong><br />
The following statements retrieve the characteristics of the outline for the<br />
current window:<br />
cm(getcursor, window_id)<br />
cm(getoutlinecolor, window_id,<br />
char_color_pa,<br />
backgnd_color_pa,<br />
bright_on_pa,<br />
blink_on_pa)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM SETOUTLINECOLOR<br />
See also
CM GetPosition<br />
CM GetPosition<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM GETPOSITION to retrieve the location of a window on the screen.<br />
Use this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETPOSITION, handle, row, col)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
row<br />
is an integer that receives the row number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
col<br />
is an integer that receives the column number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
row and col are relative to the upper left-hand corner of the screen.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements find the position of the current window:<br />
cm(getcursor, window_id)<br />
cm(getposition, window_id, row_pa, col_pa)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM SETPOSITION<br />
See also<br />
KDL Statement Syntax 4-81
CM GetStatus<br />
CM GetStatus<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-82 <strong>Language</strong> <strong>Reference</strong><br />
Use CM GETSTATUS to retrieve status information for an Answer window in a<br />
character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETSTATUS, handle, status, [err_str])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
status<br />
is an integer that receives one of the following status codes:<br />
-1 Error<br />
0 Processed<br />
1 Not processed<br />
.........................................................................................................................................................................................................˝..........................................<br />
err_str<br />
is a string that receives the error message text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If the status is 1, the window either is processed or is read-only.<br />
■ The GETSTATUS statement is only useful for determining the status of<br />
Answer windows. Windows other than Answer windows always return a<br />
status of 1.<br />
■ The status is 1 until the Answer window is filed or executed.
CM GetStatus<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements in a function get the status for the current window<br />
and use it to display an error message:<br />
cm(getcursor, window_id) /* get current window */<br />
cm(system, 'filewindow') /* try to file window */<br />
cm(getstatus, window_id, status_flag, err_text) /*filed?*/<br />
if status_flag = -1 /* window cannot be filed */<br />
then<br />
cm(popup,message(show_err_text)) /* report error */<br />
end<br />
WINDOW_ID and STATUS_FLAG are integer local variables in the function.<br />
ERR_TEXT is a string parameter that is used in the SHOW_ERR_TEXT<br />
message.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM ERROR, CM GETINFO<br />
See also<br />
KDL Statement Syntax 4-83
CM GetText<br />
CM GetText<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-84 <strong>Language</strong> <strong>Reference</strong><br />
Use CM GETTEXT to retrieve the text for a window in a character-based<br />
knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETTEXT, handle, text)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
text<br />
is a string that receives the text from the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Trailing blanks are discarded.<br />
■ For Answer windows, leading blanks are discarded if you do not specify<br />
the NOTRIM attribute in the display object that defines the Answer<br />
window.<br />
■ The text of a title is not returned.<br />
■ CM GETTEXT is not supported in Browsefile windows.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements retrieve the prompt text for the parameter PA1 into<br />
TEXT_STR:<br />
cm(getwindow, window_id, parameter(pa1), 'prompt')<br />
cm(gettext, window_id, text_str)<br />
The GETWINDOW statement retrieves the WINDOW_ID handle for the<br />
prompt window. The GETTEXT statement retrieves the text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETWORD<br />
See also
CM GetTextColor<br />
CM GetTextColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM GETTEXTCOLOR to retrieve the color of the text of a window. Use<br />
this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETTEXTCOLOR, handle, char [, cell [, bright [, blink]]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
char<br />
is a string that receives the color of the characters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cell<br />
is a string that receives the background color of the cell.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bright<br />
is a Boolean parameter that receives whether the brightness attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
blink<br />
is a Boolean parameter that receives whether the blink attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement can return the following colors in char and cell:<br />
BLACK<br />
BLUE<br />
CYAN<br />
GREEN<br />
MAGENTA<br />
RED<br />
WHITE<br />
YELLOW<br />
■ If bright is TRUE, the brightness attribute is set. If bright is FALSE, the<br />
brightness attribute is not set.<br />
■ If blink is TRUE, the blink attribute is set. If blink is FALSE, the blink<br />
attribute is not set.<br />
KDL Statement Syntax 4-85
CM GetTextColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
4-86 <strong>Language</strong> <strong>Reference</strong><br />
The following statements retrieve the characteristics of the text for the current<br />
window:<br />
cm(getcursor, window_id)<br />
cm(gettextcolor, window_id<br />
char_color_pa,<br />
backgnd_color_pa,<br />
bright_on_pa,<br />
blink_on_pa)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM SETTEXTCOLOR<br />
See also
CM GetTitleColor<br />
CM GetTitleColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM GETTITLECOLOR to retrieve the color of the title of a window. Use<br />
this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETTITLECOLOR, handle, char, [cell, [bright, [ blink]]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
char<br />
is a string that receives the color of the characters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cell<br />
is a string that receives the background color of the cell.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bright<br />
is a Boolean parameter that receives whether the brightness attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
blink<br />
is a Boolean parameter that receives whether the blink attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement can return the following colors in char and cell:<br />
BLACK<br />
BLUE<br />
CYAN<br />
GREEN<br />
MAGENTA<br />
RED<br />
WHITE<br />
YELLOW<br />
■ If bright is TRUE, the brightness attribute is set. If bright is FALSE, the<br />
brightness attribute is not set.<br />
■ If blink is TRUE, the blink attribute is set. If blink is FALSE, the blink<br />
attribute is not set.<br />
KDL Statement Syntax 4-87
CM GetTitleColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
4-88 <strong>Language</strong> <strong>Reference</strong><br />
The following statements retrieve the characteristics of the title for the current<br />
window:<br />
cm(getcursor, window_id)<br />
cm(gettitlecolor, window_id<br />
char_color_pa,<br />
backgnd_color_pa,<br />
bright_on_pa,<br />
blink_on_pa)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM SETTITLECOLOR<br />
See also
CM GetTitlePosition<br />
CM GetTitlePosition<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM GETTITLEPOSITION to retrieve the location of the title of a window<br />
on the screen. Use this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETTITLEPOSITION, handle, row, col)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
row<br />
is an integer that receives the row number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
col<br />
is an integer that receives the column number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
row and col are relative to the upper left-hand corner of the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements find the position of the title for the current<br />
window:<br />
cm(getcursor, window_id)<br />
cm(gettitleposition, window_id, row_pa, col_pa)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM SETTITLEPOSITION<br />
See also<br />
KDL Statement Syntax 4-89
CM GetWindow<br />
CM GetWindow<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-90 <strong>Language</strong> <strong>Reference</strong><br />
Use CM GETWINDOW to retrieve a handle for a window in a character-based<br />
knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
CM(GETWINDOW, handle, type([library::]name)<br />
[, window [, part]])<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that receives the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
type<br />
is one of the following kinds of objects:<br />
CLASS<br />
DISPLAY<br />
MESSAGE<br />
PARAMETER<br />
SLOT<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class, parameter, or slot<br />
exists. The library name is only required when duplicate class, parameter, or<br />
slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
You cannot specify a display or message that is in a library.<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.
CM GetWindow<br />
.........................................................................................................................................................................................................˝..........................................<br />
window<br />
is one of the following strings:<br />
Answer<br />
Browse<br />
Browsefile<br />
Certainty<br />
Choices<br />
Command-line<br />
Confirm-menu<br />
Constraint<br />
Description<br />
Explain<br />
Functionkeys<br />
Graphic<br />
Information<br />
Input<br />
KDL<br />
Message-line<br />
Message<br />
Objects-menu<br />
Options-menu<br />
Prompt<br />
SelectionInput<br />
Summary<br />
Text<br />
.........................................................................................................................................................................................................˝..........................................<br />
part<br />
is the name of a slot or the Field Name property for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ A handle is an integer that uniquely identifies a window on the current<br />
screen.<br />
■ If you do not specify window, the Answer window or Message window is<br />
considered current, depending on the kind of display object.<br />
■ If you do not specify part for a class or record, the handle for the first slot<br />
window in the class or first field window in a record is returned.<br />
■ If type is SLOT, name is any valid slot reference. See Chapter 3,<br />
“Knowledge Definition <strong>Language</strong>,” for more information about slot<br />
references.<br />
■ You can use the Field Name property in the Window Properties editor to<br />
differentiate part when there are several windows with the same name,<br />
such as TEXT, in the display. For example, if you have two text windows,<br />
you can specify TEXT_1 and TEXT_2 for their respective Field Name<br />
properties. This allows you to retrieve the handle for a specific text<br />
window.<br />
KDL Statement Syntax 4-91
CM GetWindow<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
4-92 <strong>Language</strong> <strong>Reference</strong><br />
The following statement returns the handle for slot ZIPCODE of class<br />
CUSTOMER into WINDOW _ID:<br />
cm(getwindow, window_id, class(customer), 'answer',<br />
'zipcode')<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETSTATUS , CM GETWINDOW<br />
See also
CM GetWindowList<br />
CM GetWindowList<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM GETWINDOWLIST to retrieve a list of all windows on the current<br />
screen. Use this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETWINDOWLIST, handle_list [, window])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle_list<br />
is an integer list that receives the internal identifiers (handles) for all active<br />
windows.<br />
.........................................................................................................................................................................................................˝..........................................<br />
window<br />
is one of the following strings:<br />
Answer<br />
Browse<br />
Browsefile<br />
Certainty<br />
Choices<br />
Command-line<br />
Confirm-menu<br />
Constraint<br />
Description<br />
Explain<br />
Functionkeys<br />
Graphic<br />
Information<br />
Input<br />
KDL<br />
Message-line<br />
Message<br />
Objects-menu<br />
Options-menu<br />
Prompt<br />
SelectionInput<br />
Summary<br />
Text<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
If you specify window, the statement only returns window identifiers that<br />
match the contents of window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement returns all active answer windows in to<br />
WIN_ID_LIST:<br />
cm(getwindowlist, win_id_list, 'answer')<br />
KDL Statement Syntax 4-93
CM GetWord<br />
CM GetWord<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-94 <strong>Language</strong> <strong>Reference</strong><br />
Use CM GETWORD to retrieve the word that the cursor is on. Use this<br />
command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(GETWORD, word)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
word<br />
is a string that receives the word.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ A word consists of one or more characters surrounded by spaces or the<br />
beginning or end of text. Characters that are wrapped between lines are a<br />
single word.<br />
■ If the cursor is not on a word, <strong>AionDS</strong> returns a null string ('').<br />
■ A word in a title is not returned.<br />
■ CM GETWORD is not supported in Browsefile windows.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement places the word that the cursor is on in the buffer<br />
FORM-ID:<br />
cm(getword, form_id)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETTEXT<br />
See also
CM PopUp<br />
CM PopUp<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM POPUP to pop up a window on the current screen in a characterbased<br />
knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(POPUP, type([library::]name) [, sourcingoption])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
type<br />
is one of the following kinds of objects:<br />
CLASS<br />
MESSAGE<br />
PARAMETER<br />
SLOT<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class, parameter, or slot<br />
exists. The library name is only required when duplicate class, parameter, or<br />
slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
You cannot specify a message that is in a library.<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
sourcingoption<br />
is one of the following values:<br />
CURRENTVALUE<br />
SOURCEVALUE<br />
FINALVALUE<br />
KDL Statement Syntax 4-95
CM PopUp<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you used CM POPUP to add parameter or slot windows and the user<br />
was asked for parameter or slot values, answers are not loaded from the<br />
store file into the parameter or slot. You cannot force the answers to be<br />
loaded into the parameter or slot by turning on the Preload-answers<br />
profile option.<br />
4-96 <strong>Language</strong> <strong>Reference</strong><br />
■ When name is displayed, its windows are the only active windows.<br />
■ Application keys and commands for templates, such as AES_TEMPLATE<br />
and AES_CONSULTATIONMONITOR, are not used when the pop up<br />
window displays. Only the application keys and commands defined for<br />
name are available. You must explicitly define the commands and keys<br />
that you want to use in the display object for name.<br />
■ If type is SLOT, name is any valid slot reference.<br />
For more information: See Chapter 3, “Knowledge Definition<br />
<strong>Language</strong>,” for more information about slot references.<br />
■ Use the sourcing options to control backward chaining. The default<br />
sourcing option is SOURCEVALUE.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement pops up the parameter VERIFY with no backward<br />
chaining:<br />
cm(popup, parameter(verify),CURRENTVALUE)
CM SetCursor<br />
CM SetCursor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM SETCURSOR to move the cursor to a window in a character-based<br />
knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(SETCURSOR, handle [, row [, col]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
row<br />
is an integer that contains the row number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
col<br />
is an integer that contains the column number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ row and col are relative to the window identified by handle.<br />
■ If you execute this statement, the Consultation Monitor becomes active<br />
again unless the user issues the QUIT command before leaving the screen.<br />
For example, if you add a message to a screen, you should execute CM<br />
SETCURSOR if you want the user to see the message.<br />
■ The system function FILEWINDOW uses the current position of the<br />
cursor to choose the window to file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements make the Answer window for parameter PA1 active:<br />
cm(getwindow, window_id, parameter(pa1))<br />
cm(setcursor, window_id)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETCURSOR<br />
See also<br />
KDL Statement Syntax 4-97
CM SetDimensions<br />
CM SetDimensions<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-98 <strong>Language</strong> <strong>Reference</strong><br />
Use CM SETDIMENSIONS to set the height and width of a window in a<br />
character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(SETDIMENSIONS, handle, height, width)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
height<br />
is an integer that contains the height of the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is an integer that contains the width of the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The window is redrawn from the upper left-hand corner with the new<br />
dimensions.<br />
■ If you change the width of a window that contains TSL, you should<br />
specify the RELOAD attribute in the display object so that the text is<br />
reformatted to match the new window size.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements make the Answer window for parameter PA1 one<br />
line:<br />
cm(getwindow, window_id, parameter(pa1))<br />
cm(getdimensions, window_id, height, width)<br />
cm(setdimensions, window_id, 1, width)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETDIMENSIONS<br />
See also
CM SetOutlineColor<br />
CM SetOutlineColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM SETOUTLINECOLOR to set the color of the outline of a window. Use<br />
this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
CM(SETOUTLINECOLOR, handle, char [, cell [, bright<br />
[, blink]]])<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
char<br />
is a string that contains the color of the characters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cell<br />
is a string that contains the background color of the cell.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bright<br />
is a Boolean that specifies whether the brightness attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
blink<br />
is a Boolean that specifies whether the blink attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You can specify the following colors for char and cell:<br />
BLACK<br />
BLUE<br />
CYAN<br />
GREEN<br />
MAGENTA<br />
RED<br />
WHITE<br />
YELLOW<br />
■ If bright is TRUE, the brightness attribute is set. If bright is FALSE, the<br />
brightness attribute is not set.<br />
■ If blink is TRUE, the blink attribute is set. If blink is FALSE, the blink<br />
attribute is not set.<br />
KDL Statement Syntax 4-99
CM SetOutlineColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
4-100 <strong>Language</strong> <strong>Reference</strong><br />
The following statements set characteristics of the outline of the current<br />
window to cyan on a white background. Blinking is enabled:<br />
cm(getcursor)<br />
cm(setoutlinecolor, 'blue', 'white', false, false)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETTITLECOLOR<br />
See also
CM SetPosition<br />
CM SetPosition<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM SETPOSITION to set the location of a window on the screen. Use this<br />
command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(SETPOSITION, handle, row, col)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
row<br />
is an integer that contains the row number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
col<br />
is an integer that contains the column number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
row and col specify the relative row and column from the upper left-hand side<br />
of the screen.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements move the Answer window for PA1 to the current<br />
position of the cursor:<br />
cm(getcursor, dummy, row, col)<br />
cm(getwindow, window_id, parameter(pa1))<br />
cm(setposition, window_id, row, col)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETPOSITION<br />
See also<br />
KDL Statement Syntax 4-101
CM SetTextColor<br />
CM SetTextColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-102 <strong>Language</strong> <strong>Reference</strong><br />
Use CM SETTEXTCOLOR to set the color of the text of a window. Use this<br />
command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(SETTEXTCOLOR, handle, char [, cell [, bright [, blink]]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
char<br />
is a string that contains the color of the characters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cell<br />
is a string that contains the background color of the cell.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bright<br />
is a Boolean that specifies whether the brightness attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
blink<br />
is a Boolean that specifies whether the blink attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You can specify the following colors for char and cell:<br />
BLACK<br />
BLUE<br />
CYAN<br />
GREEN<br />
MAGENTA<br />
RED<br />
WHITE<br />
YELLOW<br />
■ If bright is TRUE, the brightness attribute is set. If bright is FALSE, the<br />
brightness attribute is not set.<br />
■ If blink is TRUE, the blink attribute is set. If blink is FALSE, the blink<br />
attribute is not set.
CM SetTextColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements set characteristics of the text in the current window<br />
to bright white on the current background. Blinking is disabled:<br />
cm(getcursor)<br />
cm(gettextcolor, window_id, char_pa, cell_pa)<br />
cm(settextcolor, window_id, 'white', cell_pa)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETTEXTCOLOR<br />
See also<br />
KDL Statement Syntax 4-103
CM SetTitleColor<br />
CM SetTitleColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-104 <strong>Language</strong> <strong>Reference</strong><br />
Use CM SETTITLECOLOR to set the color of the title of a window. Use this<br />
command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
CM(SETTITLECOLOR, handle, char [, cell [, bright<br />
[, blink]]])<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
char<br />
is a string that contains the color of the characters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cell<br />
is a string that contains the background color of the cell.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bright<br />
is a Boolean that specifies whether the brightness attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
blink<br />
is a Boolean that specifies whether the blink attribute is set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You can specify the following colors for char and cell:<br />
BLACK<br />
BLUE<br />
CYAN<br />
GREEN<br />
MAGENTA<br />
RED<br />
WHITE<br />
YELLOW<br />
■ If bright is TRUE, the brightness attribute is set. If bright is FALSE, the<br />
brightness attribute is not set.<br />
■ If blink is TRUE, the blink attribute is set. If blink is FALSE, the blink<br />
attribute is not set.
CM SetTitleColor<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements set characteristics of the title of the current window<br />
to bright white on a blue background. Blinking is disabled:<br />
cm(getcursor)<br />
cm(settitlecolor, 'white', 'blue', true, false)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETTITLECOLOR<br />
See also<br />
KDL Statement Syntax 4-105
CM SetTitlePosition<br />
CM SetTitlePosition<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-106 <strong>Language</strong> <strong>Reference</strong><br />
Use CM SETTITLEPOSITION to set the location of the title of a window on the<br />
screen. Use this command in a character-based knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(SETTITLEPOSITION, handle, row, col)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
handle<br />
is an integer that contains the internal identifier for the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
row<br />
is an integer that receives the row number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
col<br />
is an integer that receives the column number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
row and col are relative to the upper left-hand corner of the window.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements move the title of the current window to one column<br />
to the right of the upper left-hand corner:<br />
cm(getcursor, window_id)<br />
cm(settitleposition, window_id, 1, -1)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM GETTITLEPOSITION<br />
See also
CM System<br />
CM System<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CM SYSTEM to execute a system-defined function in a character-based<br />
knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(SYSTEM, function)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
function<br />
is a string that contains the name of a system function. You can specify<br />
function as follows:<br />
ABORT End the consultation and return to the Main<br />
monitor<br />
BACKUP Back up to a previous object<br />
COMMAND Execute a command using the system command line<br />
DEBUG Invoke the Debug monitor<br />
ENTER Emulate the action of the ENTER key<br />
EXECUTE Execute all windows of the same object<br />
EXPLAIN Display the Explain property of a parameter or<br />
message<br />
FILEALL File all answer windows on the screen<br />
FILEOBJECT File all windows of the same object<br />
FILEWINDOW File the current window<br />
HELP Invoke the Help system<br />
HOW Display how <strong>AionDS</strong> processed a parameter<br />
MARK Mark or unmark a selection in an Answer window<br />
OPTIONS Execute a menu command using the system menu<br />
PRINTWINDOW Print the contents of the current window to a file<br />
QUIT Quit the current screen<br />
KDL Statement Syntax 4-107
CM System<br />
4-108 <strong>Language</strong> <strong>Reference</strong><br />
RESTART Restart execution from a user source<br />
SELECT Mark a selection in an Answer window and file it<br />
STORE Save user responses to a file<br />
TRACE Display the trace of a consultation<br />
UNKNOWNALL Mark all answer windows as unknown<br />
UNKNOWNOBJECT Mark object as unknown<br />
UNKNOWNWINDOW Mark answer window as unknown<br />
VIEW Display the object currently being processed<br />
WHAT Display possible uses of the current object<br />
WHY Display the reason for sourcing an object<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The QUIT function causes immediate cancellation of the current screen<br />
without filing any changes.<br />
■ The FILEWINDOW function uses the current position of the cursor to<br />
choose the window to file.<br />
■ If the user is allowed to make a choice, for example to select from a<br />
constrained string, you should use the MARK function before you file or<br />
execute the window.<br />
■ By default, the ENTER key terminates the screen. If you want the screen<br />
to remain, you should attach a function to the ENTER key.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following function uses CM SYSTEM functions to execute and file the<br />
current window, which is the Answer window for parameter PA1:<br />
cm(system, 'execute')<br />
if valid_choice includes pa1<br />
then<br />
cm(system, 'filewindow')<br />
else<br />
cm(popup,message(invalid_choice))<br />
clear(pa1)<br />
end
CM System<br />
The EXECUTE causes the value in the Answer window on the screen to be<br />
assigned to the parameter PA1. If the choice is valid, the FILEWINDOW<br />
causes the parameter Answer window to become processed. If you file the<br />
window before you check for a valid choice, the parameter Answer window<br />
becomes processed and the contents of the Answer window cannot be<br />
changed by the user. Note that parameter PA1 must be VALUE-CAN-<br />
CHANGE TRUE/ASK in order for the EXECUTE command to leave the Answer<br />
window unprocessed.<br />
The following FORWARD, IMMEDIATE, MULTIFIRE rule uses the CM SYSTEM<br />
function to file a window. The CODE and VAL slots use VALUE-CAN-<br />
CHANGE TRUE/ASK and the ENTER key is defined as ENTER-EXECUTE in the<br />
displays for the slots.<br />
ifmatch applicant with code = 'A' and (val >= 0 or<br />
val
CM System<br />
4-110 <strong>Language</strong> <strong>Reference</strong><br />
The following function shows how to use the QUIT function and avoid loss of<br />
the information on the screen if there is an error:<br />
cm(setcursor, win) /* choose a window */<br />
... /* process window */<br />
cm(system,'fileall') /* file window */<br />
quit_flag = TRUE /* set error flag */<br />
cm(getwindowlist,n_windows, 'answer')<br />
/* get all answer windows */<br />
for n_windows /* for each window */<br />
cm(getstatus,n_windows(i), status)<br />
/* check for error */<br />
if status 0 /* if error status */<br />
then<br />
quit_flag = FALSE /* flag error */<br />
break /* break loop on error */<br />
end<br />
end<br />
if quit_flag = TRUE /* if no error flag */<br />
then<br />
cm(system, 'quit') /* safe to quit */<br />
else<br />
... /* error actions */<br />
end
COS<br />
COS<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use COS to return a real result for the cosine of a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
COS (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
nexpr contains a value representing radians, not degrees. It must be between -<br />
1 and 1, inclusive.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cos_b = cos (angle_b)<br />
Examples<br />
cos_75 = cos (0.75)<br />
.........................................................................................................................................................................................................˝..........................................<br />
ARCTAN, SIN<br />
See also<br />
KDL Statement Syntax 4-111
Create<br />
Create<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-112 <strong>Language</strong> <strong>Reference</strong><br />
Use CREATE to create a dynamic instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
CREATE(CLASS([library::]classname) | CURRENTCLASS |<br />
[library::]classname [,instance [WITH assertion<br />
[, assertion ...]]])<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
assertion<br />
is an assertion for a slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
instance<br />
is the name of an instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The CREATE statement returns a pointer to the instance that <strong>AionDS</strong><br />
creates. If you choose to receive the pointer, the base type of the<br />
receiving object must be type POINTER to the class or parent class.<br />
■ An instance must use <strong>AionDS</strong> naming conventions. It must start with a<br />
letter (A - Z) and can be 24 characters, which are letters, digits (0 - 9), or<br />
underscores ( _ ). Letters are not case sensitive. The letters “a” and “A”<br />
are equivalent.<br />
Caution: Do not specify the classname_nnnnn format for instance,<br />
where nnnnn is a five-digit number.
Create<br />
■ If instance is not specified, <strong>AionDS</strong> creates an instance name by<br />
concatenating the class name with a five-digit number. For example, if<br />
two instances are created for class SOLUTION, the following names are<br />
used:<br />
Solution_00001<br />
Solution_00002<br />
A maximum of 18 characters of the class name are concatenated with the<br />
number. If the number exceeds 99,999, <strong>AionDS</strong> might truncate<br />
additional characters from the class name.<br />
■ The following actions occur, in order, when a CREATE statement is<br />
executed:<br />
1 The instance is created.<br />
2 The static facts are assigned from the slots. This action causes a<br />
WHENMODIFIED message to be sent to each slot that caused an<br />
assignment.<br />
3 The slots specified by the WITH clause are assigned. This action<br />
causes a WHENMODIFIED message to be sent to each slot in the<br />
WITH clause.<br />
4 When WHENCREATED message is sent to the instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
To create the instance A1001 in class TRANSACTION at run time, specify the<br />
following statement in a rule, function, or agenda:<br />
create (transaction, a1001)<br />
You can specify the instance name in a STRING parameter. The following<br />
statements make an assignment into the parameter INSTANCE_NAME and<br />
create the instance using the contents of INSTANCE_NAME:<br />
instance_name = 'a1001'<br />
create(transaction,->instance_name)<br />
The arrow ( -> ) causes <strong>AionDS</strong> to use the contents of INSTANCE_NAME<br />
when it creates the instance.<br />
KDL Statement Syntax 4-113
Create<br />
4-114 <strong>Language</strong> <strong>Reference</strong><br />
The following statement creates an instance in TRANSACTION and returns its<br />
pointer in INSTANCE_PTR:<br />
instance_ptr = create(transaction)<br />
If you do not want to save the pointer, you can create an instance as follows:<br />
create(transaction)<br />
You can assign values to the slots of the instance when you create an instance.<br />
The following statement assigns a value to the ACCT_NUM slot when a<br />
TRANSACTION instance is created:<br />
instance_ptr = create (transaction with<br />
acct_num = 1001)<br />
The WITH clause specifies assignments. If you assign to more than one slot,<br />
you must separate the assignments with commas. The following statement<br />
assigns to three slots:<br />
instance_ptr = create (transaction with<br />
acct_num = 1001,<br />
trans_time = currenttime,<br />
trans_date = currentdate)<br />
.........................................................................................................................................................................................................˝..........................................<br />
DELETE (INSTANCE)<br />
See also
CSort<br />
CSort<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CSORT to sort the values of a certainty set in descending certainty order.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CSORT (csexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
csexpr<br />
is a certainty set expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
factors = csort (probable_cause)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
ASORT, DSORT<br />
See also<br />
KDL Statement Syntax 4-115
CurrentDate<br />
CurrentDate<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-116 <strong>Language</strong> <strong>Reference</strong><br />
Use CURRENTDATE to return the number of days since January 1, 1900.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CURRENTDATE<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
run_date = currentdate<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
CURRENTTIME<br />
See also
CurrentTime<br />
CurrentTime<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use CURRENTTIME to return the current time as an integer.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CURRENTTIME<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
CURRENTTIME returns the number of one hundredth seconds since<br />
midnight.<br />
.........................................................................................................................................................................................................˝..........................................<br />
now = currenttime<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
CURRENTDATE<br />
See also<br />
KDL Statement Syntax 4-117
CurrentValue<br />
CurrentValue<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-118 <strong>Language</strong> <strong>Reference</strong><br />
Use CURRENTVALUE to use the current value of a parameter or slot without<br />
backward chaining.<br />
.........................................................................................................................................................................................................˝..........................................<br />
CURRENTVALUE (expr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is an expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ There is no restriction on the kind of parameters or slots in expr. You<br />
can use CURRENTVALUE with either VALUE-CAN-CHANGE or non-<br />
VALUE-CAN-CHANGE parameters or slots.<br />
■ CURRENTVALUE is useful for manipulating the contents of sets and lists<br />
before they become processed, and for determining whether a parameter<br />
contains a known value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
if currentvalue(param) is not unknown then ...<br />
Examples<br />
if currentvalue(list_param) includes special_val then ...<br />
.........................................................................................................................................................................................................˝..........................................<br />
BESTVALUE, FINALVALUE, SOURCEVALUE<br />
See also
Date<br />
Date<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use DATE to convert a date string to its internal integer representation.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DATE (str)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
str<br />
is a text string in date format.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement returns the number of days from January 1, 1900.<br />
■ str must have the format 'DD-MMM-YYYY' or 'DD-MMM-YY'. You<br />
must include the single quotes around the string.<br />
■ In str, MMM is a three-character mnemonic for the month as follows:<br />
Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec.<br />
■ If you specify the year in str with two digits, 1900 + YY is used for the<br />
year.<br />
.........................................................................................................................................................................................................˝..........................................<br />
n_days = currentdate - date('01-jan-1987')<br />
Examples<br />
report_date = date('30-jun-1987')<br />
KDL Statement Syntax 4-119
Date (Integer)<br />
Date (Integer)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-120 <strong>Language</strong> <strong>Reference</strong><br />
Use DATE INTEGER to convert the day, month, and year to a date in internal<br />
integer representation.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DATE (INTEGER,day,month,year)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
day<br />
is an integer parameter or the integer field of a record parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
month<br />
is an integer parameter or the integer field of a record parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
year<br />
is an integer parameter or the integer field of a record parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The day, month, and year arguments are used to calculate the date.<br />
■ The statement returns a date in internal format.<br />
■ You can use this statement in a date constraint.<br />
.........................................................................................................................................................................................................˝..........................................<br />
tr_date = date(integer,tr_day,tr_mo,tr_yr)<br />
Examples<br />
> date(integer,tr_day,tr_mo,1990) /* constraint */
Date (Months)<br />
Date (Months)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use DATE MONTHS to calculate the number of complete months between<br />
two dates.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DATE (MONTHS,date_val,date_val)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
date_val<br />
is a date in <strong>AionDS</strong> internal format.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement returns an integer that represents the number of complete<br />
months between the first and second date_val.<br />
■ The date_val of the date is the number of days since January 1, 1900.<br />
■ You can use the DATE statement within the DATE MONTHS statement to<br />
determine date_val.<br />
.........................................................................................................................................................................................................˝..........................................<br />
n_months = date(months,start_mo,end_mo)<br />
Examples<br />
n_months = date(months,date('19-jul-1988'))<br />
KDL Statement Syntax 4-121
Date (Record)<br />
Date (Record)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-122 <strong>Language</strong> <strong>Reference</strong><br />
Use DATE RECORD to convert an internal date into three integer parts that<br />
represent the day, month, and year, respectively.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DATE (RECORD,date_val,day,month,year)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
date_val<br />
is a date in <strong>AionDS</strong> internal format.<br />
.........................................................................................................................................................................................................˝..........................................<br />
day<br />
is an integer parameter or slot or the integer field of a record parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
month<br />
is an integer parameter or slot or the integer field of a record parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
year<br />
is an integer parameter or slot or the integer field of a record parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement returns three integer parameters or slots or three integer<br />
fields in a record parameter.<br />
■ The date_val of the date is the number of days since January 1, 1900.<br />
■ You can use the DATE statement within the DATE MONTHS statement to<br />
determine date_val.<br />
.........................................................................................................................................................................................................˝..........................................<br />
date (record,date('01-jan-1987'),rec.day1, rec.mo1,rec.yr1)<br />
Examples<br />
date (record,currentdate,day_pa,mo_pa,yr_pa)
Date (String)<br />
Date (String)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use DATE STRING to convert a date into another format or to return<br />
information about a date value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DATE (STRING,str)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
str<br />
is a text string in date format.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement returns a date in internal format.<br />
■ You can use the statement in a date constraint.<br />
■ In str, MMM is a three-character mnemonic for the month as follows:<br />
Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec.<br />
■ If you specify the year in str with two digits, 1900 + YY is used for the<br />
year.<br />
.........................................................................................................................................................................................................˝..........................................<br />
date_value = date(string,'19-jul-1900')<br />
Example<br />
KDL Statement Syntax 4-123
Date (Weekday)<br />
Date (Weekday)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-124 <strong>Language</strong> <strong>Reference</strong><br />
Use DATE WEEKDAY to determine the day of week for a date.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DATE (WEEKDAY,date_val)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
date_val<br />
is a date in <strong>AionDS</strong> internal format.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement returns a number between 1 and 7, inclusive. The<br />
translation is as follows:<br />
Return Weekday<br />
1 Sunday<br />
2 Monday<br />
3 Tuesday<br />
4 Wednesday<br />
5 Thursday<br />
6 Friday<br />
7 Saturday<br />
■ The date_val of the date is the number of days since January 1, 1900.<br />
■ You can use the DATE statement within the DATE WEEKDAY statement<br />
to determine date_val.<br />
.........................................................................................................................................................................................................˝..........................................<br />
day_of_week = date(weekday,date('19-jul-1988'))<br />
Examples<br />
today = date(weekday,currentdate)<br />
arr_day = date(weekday,arr_date)
Date (Yearday)<br />
Date (Yearday)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use DATE YEARDAY to determine the Julian date.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DATE (YEARDAY,date_val)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
date_val<br />
is a date in <strong>AionDS</strong> internal format.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement returns the Julian date, which is a number between 1 and<br />
366, inclusive.<br />
■ The date_val of the date is the number of days since January 1, 1900.<br />
■ You can use the DATE statement within the DATE YEARDAY statement to<br />
determine date_val.<br />
.........................................................................................................................................................................................................˝..........................................<br />
day_of_year = date(yearday,date('19-jul-1988'))<br />
Examples<br />
julian_date = date(yearday,currentdate)<br />
tr_date = date(yearday,date_pa)<br />
KDL Statement Syntax 4-125
Date (Years)<br />
Date (Years)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-126 <strong>Language</strong> <strong>Reference</strong><br />
Use DATE YEARS to determine the number of complete years between two<br />
dates.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DATE (YEARS,date_val,date_val)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
date_val<br />
is a date in <strong>AionDS</strong> internal format.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The date_val of the date is the number of days since January 1, 1900.<br />
■ You can use the DATE statement within the DATE YEARS statement to<br />
determine date_val.<br />
.........................................................................................................................................................................................................˝..........................................<br />
no_years = date(years,currentdate,date('19-jul-1988'))<br />
Examples<br />
nyears = date(years,date('10-jan-1988'),date('31-dec-60'))<br />
n_years = date(years,start_yr,end_yr)
DBMS<br />
DBMS<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use DBMS to force an I/O operation for a class in which an access method is<br />
specified.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
DBMS (option, CLASS([library::]classname) | CURRENTCLASS |<br />
[library::]classname)<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following options specifies:<br />
FLUSH Deleting instances from the class.<br />
LOAD Reading instances from the database or file into the class.<br />
UPDATE Writing modified instances from <strong>AionDS</strong> to the database or<br />
file.<br />
COMMIT Committing changes to SQL databases files.<br />
ROLLBACK Backing out changes from SQL database files.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
The name of a class.<br />
KDL Statement Syntax 4-127
DBMS<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Although you must specify a class name for the DBMS statement, the<br />
COMMIT and ROLLBACK options do not affect only the specified class.<br />
When a commit or rollback is issued, the current SQL unit of work is<br />
committed or rolled back—all classes which have current SQL<br />
connections are committed or rolled back to the last commit point. A<br />
unit of work consists of the changes made by the knowledge base to<br />
databases since the last commit.<br />
4-128 <strong>Language</strong> <strong>Reference</strong><br />
■ On the mainframe, commits and rollbacks are only supported when you<br />
are using local access. Local access is data access from the MAES or<br />
TSO address space. If you issue a commit or rollback when you are<br />
using remote access, the commit or rollback is ignored. Remote access is<br />
data access from the CICS or IMS regions.<br />
■ For details about using the COMMIT and ROLLBACK options, see the I/O<br />
<strong>Reference</strong>, User’s <strong>Guide</strong>, and User’s <strong>Guide</strong> (Character-Based).<br />
■ You must set the Update Mode property for the access method to<br />
ONREQUEST or AUTOUPDATE before you can use the UPDATE option.<br />
■ Use the FLUSH option to delete all dynamic instances in the class. The<br />
contents of the Selection Criteria property are ignored. <strong>AionDS</strong> marks<br />
the class for reloading. Reload occurs automatically when dynamic<br />
instances are required.<br />
■ Use the UPDATE option to update to disk all changed instances in the<br />
class. The contents of the Selection Criteria property are ignored.<br />
■ The DBMS statement does not cause WHENNEEDED, WHENCREATED,<br />
WHENMODIFIED, or WHENDELETED methods to execute.<br />
■ Static instances are ignored. The DBMS LOAD statement does not read<br />
data into static instances. The DBMS UPDATE statement does not write<br />
static instances. The DBMS FLUSH statement does not delete static<br />
instances.<br />
■ If you use the FLUSH option, you must reinitialize pointers to dynamic<br />
instances in the class before you attempt to use them again, since the<br />
original instances no longer exist.
DBMS<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following agenda that processes transactions based on their<br />
transaction type:<br />
loop<br />
clear(trans_type)<br />
ask(trans_type)<br />
breakif trans_type = 0<br />
send(set_criteria to class(transactions) with<br />
trans_type)<br />
dbms(flush, transactions)<br />
dbms(load, transactions)<br />
forwardchain<br />
dbms(update,transactions)<br />
dbms(commit,transactions)<br />
end<br />
The agenda executes a loop. For each iteration of the loop, the following<br />
actions occur:<br />
■ The CLEAR statement resets any previous value for TRANS_TYPE, which<br />
is a VALUE-CAN-CHANGE parameter.<br />
■ The ASK statement prompts for the value of TRANS_TYPE. If you enter<br />
zero, the loop ends.<br />
■ <strong>AionDS</strong> sends TRANS_TYPE to a method that sets a parameter in the<br />
Selection Criteria property for the access method. For example, the<br />
Selection Criteria might contain the following statement:<br />
code = criteria<br />
CODE is a slot in the class and CRITERIA is a parameter in the class. A<br />
function attached to the method SET_CRITERIA sets CRITERIA to<br />
TRANS_TYPE.<br />
■ The DBMS FLUSH statement deletes all instances in the class.<br />
■ The DBMS LOAD statement causes the records in the file that match the<br />
selection criteria to be created in the class.<br />
■ If AUTOLOAD is specified in the Load Mode property, the explicit DBMS<br />
LOAD statement is not required. <strong>AionDS</strong> automatically reloads dynamic<br />
instances so that rules can execute.<br />
■ The FORWARDCHAIN statement executes all rules that use the newly<br />
created instances.<br />
KDL Statement Syntax 4-129
DBMS<br />
4-130 <strong>Language</strong> <strong>Reference</strong><br />
■ The DBMS UPDATE statement writes all changed instances in the class<br />
back to the file or database.<br />
■ The DBMS COMMIT statement commits all changes for the unit of work.
Delete (from list or set)<br />
Delete (from list or set)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use DELETE to remove elements from a set or list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DELETE (list, index)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
list<br />
is a reference to a list or set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
index<br />
is the element number to delete.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ The list must be a VALUE-CAN-CHANGE parameter.<br />
Remarks<br />
■ If index is not within the number of elements that exist, a run-time error<br />
occurs.<br />
■ For a list of pointers, using the DELETE (list, index) syntax deletes the<br />
element from the list. To delete the instance that the element of a<br />
pointer list points to, use the DELETE (pointer->) syntax instead. For<br />
example:<br />
delete(lst(i)->)<br />
For more information: Refer to the “Delete (instance)” section on<br />
page 4-133.<br />
■ Each time you delete an element from a list, the list is reordered. To<br />
delete all of the elements in a list, complete the following steps:<br />
1 Use the Size statement to determine the number of elements in the<br />
list.<br />
2 Assign the list length to a variable sze.<br />
3 Use a loop to delete the last element in the list using the sze<br />
variable.<br />
4 Each time an element is deleted, decrement the value of sze by 1.<br />
This way the value of sze will always be equal to the actual length of<br />
the list.<br />
KDL Statement Syntax 4-131
Delete (from list or set)<br />
4-132 <strong>Language</strong> <strong>Reference</strong><br />
5 End the loop when the value of sze is zero by using the BreakIf<br />
statement.<br />
sze = Size (lst)<br />
loop<br />
delete(lst, sze)<br />
sze = sze - 1<br />
breakif sze = 0<br />
end<br />
.........................................................................................................................................................................................................˝..........................................<br />
delete(lst,1)<br />
Examples<br />
delete(set_pa,index('red',set_pa))<br />
delete(truck(instance1).maint_dates,3)
Delete (instance)<br />
Delete (instance)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use DELETE to remove a dynamic instance from a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
DELETE([library::]classname[(inst_id)] |<br />
[library::]pointer-> | [library::]pointer | CURRENT)<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class, parameter, or slot<br />
exists. The library name is only required when duplicate class, parameter, or<br />
slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
inst_id<br />
is one of the following instance identifiers:<br />
inst_nm is the name of an instance.<br />
->str_expr is a string expression.<br />
inst_no is a non-negative integer.<br />
.........................................................................................................................................................................................................˝..........................................<br />
pointer<br />
is a parameter or slot with base type POINTER.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The WHENDELETED message is sent to the instance just before it is<br />
removed from the system.<br />
■ If you specify classname without inst_id, <strong>AionDS</strong> deletes the current<br />
instance.<br />
KDL Statement Syntax 4-133
Delete (instance)<br />
4-134 <strong>Language</strong> <strong>Reference</strong><br />
■ When you delete an instance identified by a pointer, the pointer is set to<br />
UNKNOWN. You can test a pointer for equality to UNKNOWN. If other<br />
pointers to a deleted instance exist, however, they are not reset. <strong>AionDS</strong><br />
cannot always detect this kind of error and might result in a fatal error.<br />
You must ensure that the pointers do not point to a deleted instance.<br />
■ <strong>AionDS</strong> does not treat DELETE(pointer) and DELETE(pointer->) the same.<br />
DELETE(pointer) takes the following actions:<br />
1 WhenDeleted is sent.<br />
2 The instance that is pointed to is deleted.<br />
3 The value of pointer is set to UNKNOWN.<br />
DELETE(pointer->) sends WhenDeleted and deletes the instance that is<br />
pointed to. The value left in the pointer is invalid. This can cause the<br />
error described in the previous remark. DELETE(pointer) is the preferred<br />
syntax.<br />
■ If pointer is an element in a list of pointers, the instance that the element<br />
is pointing to is deleted. The element’s value is set to NUL instead of<br />
being deleted. This can cause an invalid pointer reference if the element<br />
is referenced again.<br />
For more information: See Chapter 3, “Knowledge Definition <strong>Language</strong>,”<br />
for additional information about instance references.<br />
.........................................................................................................................................................................................................˝..........................................<br />
delete(truck(ford))<br />
Examples<br />
delete(current)<br />
delete(truck_ptr->)<br />
delete(truck_ptr)<br />
delete(ptr_list(i)->)<br />
.........................................................................................................................................................................................................˝..........................................<br />
CREATE<br />
See also
Difference<br />
Difference<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use DIFFERENCE to return the elements of a set that are not present in<br />
another set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
DIFFERENCE (set_expr, set_expr [, set_expr ... ])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
set_expr<br />
is any expression that results in a set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
DIFFERENCE returns the elements of the left-most set that are not present in<br />
the set to its right. If there are more than two sets, the first difference is<br />
compared to the next set to the right, and the new result becomes those<br />
elements in the prior result that are not in the next set to the right.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following four sets and the statement<br />
result_set = difference (set1,set2,set3,set4)<br />
SET1 containing (1,2,3,4)<br />
SET2 containing (1,2)<br />
SET3 containing (3)<br />
SET4 containing (4)<br />
The difference between SET1 and SET2 is the sets containing (3 and 4). This<br />
result is evaluated against the next set to the right, SET3. The result is the set<br />
containing (4) because it is in the intermediate set, but not in SET3. This<br />
result is compared to SET4. Since the prior result only contains the element<br />
4, and the element is in SET4, RESULT_SET contains the empty set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
INTERSECTION, UNION<br />
See also<br />
KDL Statement Syntax 4-135
DIV<br />
DIV<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-136 <strong>Language</strong> <strong>Reference</strong><br />
Use DIV to perform integer division.<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr1 DIV nexpr2<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr1<br />
is a numeric expression for the divisor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr2<br />
is a numeric expression for the dividend.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Any fractional part of the quotient is discarded, and the result is an<br />
integer.<br />
■ Expressions cannot be larger than 2,147,483,647.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement sets DISCOUNT to be the integer percent of TOTAL:<br />
discount = total div 100<br />
If TOTAL equals 250, DISCOUNT equals 2.<br />
.........................................................................................................................................................................................................˝..........................................<br />
MOD<br />
See also
DSort<br />
DSort<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use DSORT to sort a list or set in descending order, to sort the instances in a<br />
class by descending order by slot value, to sort a list of pointers to instances in<br />
descending order by slot value, or to sort a list or set of records in descending<br />
order by field sequence.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
DSORT (lexpr | CLASS([library::]classname) | CURRENTCLASS<br />
[ON prop [, prop ... ]])<br />
.........................................................................................................................................................................................................˝..........................................<br />
lexpr<br />
is a list, set, or a list or set expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
prop<br />
is a field in a record or a slot in a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You must specify a record field name as a prop when you sort a list or set<br />
of records.<br />
■ You must specify a slot name as a prop when you sort a class.<br />
■ DSORT returns a list or set with the same base type as the lexpr base type.<br />
■ You can use DSORT as a procedure. If you do not specify a return<br />
parameter, <strong>AionDS</strong> sorts the data in place and the source object contains<br />
the sorted data.<br />
KDL Statement Syntax 4-137
DSort<br />
4-138 <strong>Language</strong> <strong>Reference</strong><br />
■ <strong>AionDS</strong> does not backward chain for values of arguments when DSORT is<br />
used as a procedure.<br />
■ If you sort a class, you should use DSORT as a procedure. It sorts the<br />
class in place. If you use a return parameter, the parameter must be a list<br />
of records in which the structure of the records are equivalent to the<br />
structure of the instances.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statement sorts the TEST_SCORES integer list and returns the<br />
sorted data to the SORTED_SCORES integer list:<br />
sorted_scores = dsort (test_scores)<br />
The following statement sorts a set expression:<br />
sorted_union = dsort (union(group_1, group_2))<br />
The following statement sorts a list of records on the SENIORITY field:<br />
sen_list = dsort (personnel on seniority)<br />
The following statement sorts a list of records on two fields:<br />
part_list = asort (dsort (inventory on model_year) on<br />
part_no)<br />
The INVENTORY list is sorted in ascending order by PART_NO and by<br />
descending MODEL_YEAR within PART_NO.<br />
The following statement sorts instances of the current class on SLOT1:<br />
dsort(currentclass on slot1)<br />
The following statement sorts instances of class TRUCK by MAKE and by<br />
MODEL within MAKE:<br />
dsort(class(truck) on make, model)
DSort<br />
The following statement sorts pointers to instances of class TRUCK where the<br />
COLOR slot contains red:<br />
ptr_list<br />
= dsort(selectall(class(truck) where color = 'red')<br />
on name)<br />
The PTR_LIST parameter is a list of pointers to instances in class TRUCK. The<br />
list is ordered by the slot NAME.<br />
.........................................................................................................................................................................................................˝..........................................<br />
ASORT, CSORT<br />
See also<br />
KDL Statement Syntax 4-139
Exists<br />
Exists<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-140 <strong>Language</strong> <strong>Reference</strong><br />
Use EXISTS to determine whether an instance exists that matches your<br />
criteria.<br />
Beginning with <strong>AionDS</strong> Version 6.3, the EXISTS statement operates over all<br />
instances of subclasses of the class whose name appears in the syntax of the<br />
EXISTS statement.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
EXISTS (CLASS([library::]classname) | CURRENTCLASS |<br />
[library::]classname [WITH bool_expr])<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Specify your criteria in bool_expr. If the WITH clause is omitted, WITH<br />
TRUE is assumed.<br />
■ The statement returns TRUE if an instance that meets the criteria is<br />
found, otherwise it returns FALSE.
Exists<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following example:<br />
if exists (truck with color = 'red') then ...<br />
The premise is TRUE if the COLOR slot of an instance of class TRUCK<br />
contains the string RED.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SELECTALL, SELECTONE<br />
See also<br />
KDL Statement Syntax 4-141
ExitState<br />
ExitState<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-142 <strong>Language</strong> <strong>Reference</strong><br />
Use EXITSTATE to abort processing of a state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
EXITSTATE [(state)]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
state<br />
is the name of a state that is above the current state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you do not specify state, <strong>AionDS</strong> aborts processing of the current state.<br />
If you specify state, <strong>AionDS</strong> aborts processing of the current state and all<br />
states above it in the hierarchy, including the state state.<br />
■ Goals on the pending list that can be resolved by last chance processing<br />
are skipped if they are in one of the states that <strong>AionDS</strong> aborts.<br />
■ Only use the EXITSTATE statement when you cannot control entry into<br />
and processing of a state using the inference-based techniques provided in<br />
<strong>AionDS</strong>. Indiscriminate use of this statement reduces the effectiveness of<br />
inference-based processing. For example, you should use entry<br />
conditions to exclude states from consideration during a consultation.
ExitState<br />
■ Do not use the STATE command to call an independent state from<br />
another state and use an output parameter to change the premise in the<br />
calling state’s rule that contains EXITSTATE. The called state is exited<br />
instead of the state that owns the rule.<br />
For EXITSTATE to exit the correct state, you can enter the following KDL<br />
into the Agenda property of the state that owns the rule containing<br />
EXITSTATE:<br />
state (state2(return_bool))<br />
bool_pa = return_bool<br />
state2 is an independent state.<br />
return_bool is an output parameter.<br />
bool_pa is the Boolean parameter used in the rule premise.<br />
The last statement ensures that control is returned to the calling state<br />
when bool_pa is changed.<br />
■ Output parameters are not returned from the exited state.<br />
KDL Statement Syntax 4-143
EXP<br />
EXP<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-144 <strong>Language</strong> <strong>Reference</strong><br />
Use EXP to return the real result for the logarithmic constant e raised to a<br />
power.<br />
.........................................................................................................................................................................................................˝..........................................<br />
EXP (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression representing the power.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following statement:<br />
exp (ln(10)*2)<br />
It is equivalent to 10**2 or 100.<br />
.........................................................................................................................................................................................................˝..........................................<br />
LN<br />
See also
FinalValue<br />
FinalValue<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use FINALVALUE to return the final value of an expression that contains<br />
parameters or slots.<br />
.........................................................................................................................................................................................................˝..........................................<br />
FINALVALUE (expr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is an expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ <strong>AionDS</strong> backward chains to determine a value for the parameters or slots<br />
in expr.<br />
■ <strong>AionDS</strong> terminates KDL statements that use FINALVALUE and require<br />
out of scope objects. The structure of your knowledge base determines<br />
whether these statements are executed later.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BESTVALUE, CURRENTVALUE, SOURCEVALUE<br />
See also<br />
KDL Statement Syntax 4-145
First<br />
First<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-146 <strong>Language</strong> <strong>Reference</strong><br />
Use FIRST to select the first elements from a list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
FIRST num OF lexpr<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
num<br />
is the number of elements to select.<br />
.........................................................................................................................................................................................................˝..........................................<br />
lexpr<br />
is an expression that results in a list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
short_list = first 10 of waiting_list<br />
Examples<br />
alpha_group_1 = first 50 of asort(class(customers) on<br />
name)<br />
.........................................................................................................................................................................................................˝..........................................<br />
LAST<br />
See also
For (class iteration)<br />
For (class iteration)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use FOR to iterate over all instances of a class.<br />
Beginning with <strong>AionDS</strong> Version 6.3, the FOR statement operates over all<br />
instances of subclasses of the class whose name appears in the syntax of the<br />
FOR statement.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
FOR [CLASS ([library::]classname) | CURRENTCLASS], cl_param<br />
stmts<br />
END<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
cl_param<br />
is a string or pointer parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
stmts<br />
are KDL statements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ cl_param must be a pointer to instances in the class or a string. Do not<br />
use the value of cl_param outside of the FOR loop.<br />
■ For efficiency, you should use a pointer for cl_param.<br />
KDL Statement Syntax 4-147
For (class iteration)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
4-148 <strong>Language</strong> <strong>Reference</strong><br />
The following statements show iteration over a class:<br />
for currentclass,ptr<br />
if ptr->.cost = 50000<br />
then<br />
ptr->.type = 'tractor trailer'<br />
end<br />
end<br />
The parameter PTR is a VALUE-CAN-CHANGE parameter with base type<br />
POINTER to the current class, which is created by the developer.
For (direct iteration)<br />
For (direct iteration)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use FOR to iterate over a group of KDL statements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
FOR param = low_val TO high_val<br />
stmts<br />
END<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the iteration parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
low_val<br />
is the initial value for the iteration parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
high_val<br />
is the termination value for the iteration parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
stmts<br />
are KDL statements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ param must be type INTEGER and VALUE-CAN-CHANGE, or the system<br />
variable I. Do not use the value of param outside of the FOR loop. Do<br />
not change its value inside the loop.<br />
■ Direct iteration FOR statements do not have to operate on lists or sets.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statements show an example of direct iteration:<br />
for cnt = 1 to 50<br />
message(get_next_result,currentvalue)<br />
end<br />
The FOR statement executes 50 times. The parameter CNT increments by<br />
one each time through the loop. It starts with a value of 1 and ends with a<br />
value of 50.<br />
KDL Statement Syntax 4-149
For (direct iteration)<br />
4-150 <strong>Language</strong> <strong>Reference</strong><br />
Consider the following example that contains a logic error that might work<br />
correctly for one version of <strong>AionDS</strong> and not work correctly in another<br />
version:<br />
for j = 1 to 10<br />
breakif list_of_elem(j) = search_val<br />
end<br />
...<br />
pos = j /* logic error */<br />
You cannot rely on the value of the iteration parameter outside of the FOR<br />
loop. You should rewrite the loop to save the contents of the iteration<br />
parameter before you exit the loop, as follows:<br />
for j = 1 to 10<br />
if list_of_elem(j) = search_val<br />
then<br />
pos = j<br />
break<br />
end<br />
end<br />
The following statements are another example of direct iteration:<br />
for j = 1 to number_elements<br />
for k = 1 to element_size<br />
ctr = ctr + listy((j-1)*k + k)<br />
end<br />
end<br />
LISTY is a simple list that represents a matrix. The innermost FOR statement,<br />
controlled by K, is executed more rapidly, once for every row. After K equals<br />
ELEMENT_SIZE, J increments, K is reset to the first item, and the next K<br />
elements of LISTY are accessed. When J increments beyond the number of<br />
lists, the FOR statement ends.
For (explicit iteration)<br />
For (explicit iteration)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use FOR to iterate over a list or set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
FOR expr, param<br />
stmts<br />
END<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is a list or set expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the iteration parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
stmts<br />
is any number of KDL statements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
param must be type INTEGER and VALUE-CAN-CHANGE, or the system<br />
variable I. Do not use the value of param outside of the FOR loop. Do not<br />
change its value inside the loop.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statements show an example of explicit iteration:<br />
for listx,j<br />
for listx(j),k<br />
sum = sum + listx(j)(k)<br />
end<br />
end<br />
LISTX is a list of lists. It is used as a matrix in this example. The parameters J<br />
and K identify specific elements within the matrix. You must define the<br />
control parameters. They are not system variables.<br />
The innermost FOR statement, controlled by K, is executed more rapidly,<br />
once for every item in LISTX(J). After all items in LISTX(J) are accessed, J<br />
increments, K is reset to the first item, and the next K elements of LISTX(J) are<br />
accessed. When J increments beyond the number of lists, the FOR statement<br />
ends.<br />
KDL Statement Syntax 4-151
For (explicit iteration)<br />
4-152 <strong>Language</strong> <strong>Reference</strong><br />
The following statements are another example of explicit iteration:<br />
for matrix1,row<br />
for matrix1(row),col<br />
m_tot = m_tot + matrix1(row)(col)<br />
end<br />
end
For (implicit iteration)<br />
For (implicit iteration)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use FOR to iterate over a list or set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
FOR expr<br />
stmts<br />
END<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is a list or set expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
stmts<br />
is any number of KDL statements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The system variable I is the implied iteration parameter for implicit<br />
iteration over a set or list. Do not use its value outside the FOR loop.<br />
■ You cannot nest implicit iteration FOR statements. because you can use<br />
only one implicit control variable. Be careful not to use an implicit FOR<br />
loop that executes a function that contains another implicit FOR loop.<br />
You cannot execute a function in an implicit FOR loop if that function<br />
also contains an implicit FOR loop.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statements show an example of implicit iteration:<br />
for cars<br />
if cars(i).colors includes desired_color and<br />
cars(i).cost
For (implicit iteration)<br />
4-154 <strong>Language</strong> <strong>Reference</strong><br />
The following statements are another example of implicit iteration:<br />
for personnel<br />
if personnel(i).salary >= high_income<br />
then<br />
add personnel(i).name to potential_donor<br />
end<br />
end
ForwardChain<br />
ForwardChain<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use FORWARDCHAIN to cause <strong>AionDS</strong> to forward fire the rules on the rule<br />
schedule when specified.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
FORWARDCHAIN [([ORDERBY (sequence, ...)]<br />
[, STOPWHEN (condition)])]<br />
.........................................................................................................................................................................................................˝..........................................<br />
sequence<br />
is one or more of the following orders:<br />
PRIORITY specifies rule execution in order of the Priority property.<br />
MOSTRECENT specifies rule execution in last-in-first-out order from the<br />
list.<br />
LEASTRECENT specifies rule execution in first-in-first-out order from<br />
the list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
condition<br />
is a Boolean expression that specifies the conditions that cause <strong>AionDS</strong> to<br />
terminate processing of the list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ The default sequence is PRIORITY.<br />
Remarks<br />
■ If you specify more than one ordering sequence, the precedence is by<br />
position in the list. The first item in the list has the highest precedence.<br />
■ The MOSTRECENT and LEASTRECENT orders are mutually exclusive.<br />
■ <strong>AionDS</strong> places a rule on the list whenever the value of a parameter in its<br />
premise changes.<br />
■ During pattern matching, <strong>AionDS</strong> uses only the following instances:<br />
❐ Instances that have changed since the last execution of a<br />
FORWARDCHAIN statement, including instances that are left over<br />
from prior execution.<br />
KDL Statement Syntax 4-155
ForwardChain<br />
4-156 <strong>Language</strong> <strong>Reference</strong><br />
❐ All instances that can be used by pattern-matching rules within the<br />
state. These rules and instances are placed on the list for forward<br />
chaining when the <strong>AionDS</strong> enters the state.<br />
Reminder: When you create an instance, <strong>AionDS</strong> does not consider<br />
the instance to be changed until you modify a slot of the instance.<br />
■ If forward chaining is terminated before the list becomes empty, the<br />
remaining rules are executed when the next FORWARDCHAIN statement<br />
is executed.<br />
■ The rule cost is not used by the forward chainer.<br />
■ The FORWARDCHAIN statement, before Version 6.3 of <strong>AionDS</strong>, was<br />
only allowed in the Agenda property of a state. Beginning with Version<br />
6.3, this statement can be used in the Rule Definition property of rules<br />
and the Function Body property of functions.<br />
■ In choosing the next rule to execute, the Forward Chainer does not<br />
distinguish between pattern-matching and other FORWARD ONREQUEST<br />
rules. It uses the next rule according to the ORDERBY criteria.<br />
■ The recency criteria, MOSTRECENT and LEASTRECENT, are determined<br />
by the order in which <strong>AionDS</strong> makes an assignment to a parameter or<br />
slot that is used in the premise of the rule.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following example:<br />
forwardchain (orderby (priority,mostrecent),<br />
stopwhen (credit_limit is not unknown))<br />
When the FORWARDCHAIN statement executes, the Forward Chainer<br />
chooses the highest priority rule to execute. If more than one rule exists with<br />
equal priority, <strong>AionDS</strong> uses the most recent rule that was added to the list. If<br />
the rule is a pattern-matching rule that is bound to two or more instances,<br />
<strong>AionDS</strong> executes the rule with the most recently bound instance.<br />
If the execution of the rule causes CREDIT_LIMIT to become known, forward<br />
chaining stops. Otherwise. the Forward Chainer chooses the next rule or rule<br />
and binding to execute according to the ORDERBY criteria and proceeds until<br />
no more rules are available to execute.
Function<br />
Function<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use FUNCTION to make a function object a goal.<br />
.........................................................................................................................................................................................................˝..........................................<br />
FUNCTION (name [(in_arg, ..., out_arg)] [, option])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following sourcing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ <strong>AionDS</strong> never places a function on the pending list.<br />
■ The default option is SOURCEVALUE.<br />
■ The sourcing option only applies to input arguments.<br />
■ Usually, functions are invoked without using the Agenda statement, for<br />
example sum(a_list,b_list). See Chapter 3, “Knowledge<br />
Definition <strong>Language</strong>,” for more information.<br />
■ The function cannot have a return value when invoked using the<br />
FUNCTION Agenda statement.<br />
■ When you call a function, the parameters that you pass to the function<br />
must correspond in base type and order with the arguments declared in<br />
the function. You must list the input arguments before the output<br />
arguments.<br />
For more information: Refer to the <strong>AionDS</strong> General <strong>Reference</strong> for<br />
information about function objects.<br />
KDL Statement Syntax 4-157
Function<br />
.........................................................................................................................................................................................................˝..........................................<br />
function(sum(a_list,b_list),currentvalue)<br />
Example<br />
4-158 <strong>Language</strong> <strong>Reference</strong>
Graph<br />
Graph<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use GRAPH to make a graph object a goal in a character-based knowledge<br />
base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
GRAPH (name [, option ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following sourcing or processing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
COMPLETE Do not execute the object until all parameters are<br />
resolved.<br />
LASTCHANCE Execute the object before exiting the state in which the<br />
object is defined.<br />
IMMEDIATE Execute the object immediately.<br />
INSTATE Finish with the object before exiting the current state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The sourcing options are mutually exclusive. You must choose between<br />
FINALVALUE, SOURCEVALUE , and CURRENTVALUE.<br />
■ The following processing options are mutually exclusive: COMPLETE ,<br />
LASTCHANCE, and IMMEDIATE.<br />
■ The default options are SOURCEVALUE and LASTCHANCE.<br />
■ You cannot specify a processing option for an agenda statement used in a<br />
class. The statement is always executed immediately.<br />
KDL Statement Syntax 4-159
Graph<br />
.........................................................................................................................................................................................................˝..........................................<br />
graph(gr_1,finalvalue,complete)<br />
Example<br />
4-160 <strong>Language</strong> <strong>Reference</strong>
Group<br />
Group<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use GROUP to make a group object a goal in a character-based knowledge<br />
base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
GROUP (name [, option ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following sourcing or processing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
COMPLETE Do not execute the object until all parameters are<br />
resolved.<br />
LASTCHANCE Execute the object before exiting the state in which the<br />
object is defined.<br />
IMMEDIATE Execute the object immediately.<br />
INSTATE Finish with the object before exiting the current state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The sourcing options are mutually exclusive. You must choose between<br />
FINALVALUE, SOURCEVALUE, and CURRENTVALUE.<br />
■ The following processing options are mutually exclusive: COMPLETE,<br />
LASTCHANCE, and IMMEDIATE.<br />
■ The default options are SOURCEVALUE and LASTCHANCE.<br />
■ You cannot specify a processing option for an agenda statement used in a<br />
class. The statement is always executed immediately.<br />
KDL Statement Syntax 4-161
Group<br />
.........................................................................................................................................................................................................˝..........................................<br />
group(gr_1,currentvalue,immediate)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
SET<br />
See also<br />
4-162 <strong>Language</strong> <strong>Reference</strong>
HEX<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
HEX<br />
Use HEX to convert a string containing hexadecimal digits to an integer value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
HEX (hex_str)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
hex_str<br />
is a string expression containing a valid hexadecimal number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ This function is not case sensitive. For example, the following are<br />
equivalent: 'aa', 'AA', 'Aa', and 'aA'.<br />
■ hex_str cannot exceed eight characters, or the representation of four bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following examples show conversion of hexadecimal strings into integers:<br />
int_val = HEX(hex_str)<br />
int_val = HEX('011adcFF')<br />
The following example shows a test of a hexadecimal number to a flag:<br />
if (hex('1000') and value) > 0 then ...<br />
The condition is true if the bit in the hexadecimal string is also set in value.<br />
KDL Statement Syntax 4-163
If<br />
If<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-164 <strong>Language</strong> <strong>Reference</strong><br />
Use IF to specify a non-pattern matching rule or to conditionally execute<br />
KDL statements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
IF condition<br />
THEN stmts<br />
[ELSEIF condition THEN stmts ... ]<br />
[ELSE stmts]<br />
[END]<br />
.........................................................................................................................................................................................................˝..........................................<br />
condition<br />
is a Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
stmts<br />
are KDL statements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ In a rule, a condition is called a premise.<br />
■ An ELSEIF clause contains the next condition that <strong>AionDS</strong> tests if the<br />
previous one is false. You can have as many ELSEIF clauses as you need.<br />
■ The ELSE clause contains the statements that you execute if all of the<br />
conditions are false.<br />
■ Two IF statements without an intervening END keyword separating the IF<br />
statements are nested. Nested IF statements imply a logical AND between<br />
the conditions of the IF statements.<br />
■ The END keyword is optional only in simple rules containing a single<br />
action.<br />
■ Do not use an END statement to terminate an ELSEIF or ELSE clause. A<br />
syntax error results because an END can terminate only the entire IF<br />
statement, not just part of an IF statement.<br />
■ You can separate each action with a comma. If you put each action on a<br />
separate line, however, the logic should be clear without commas.
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following example:<br />
if 105_prereq_taken and not freshman<br />
then<br />
advice is 'take 105'<br />
add '105' to req_course<br />
end<br />
The statement contains compound actions. The parameter ADVICE is set to<br />
take 105 and the string 105 is added to the list parameter REQ_COURSE.<br />
.............................................................................................................................................................................<br />
The ELSE clause<br />
Consider the following example:<br />
if 105_prereq_taken<br />
then<br />
advice is 'take 105'<br />
else<br />
advice is 'take 104'<br />
end<br />
Either the action in the THEN clause executes, or the action in the ELSE clause<br />
executes. The ELSE clause specifies the action to take if the premise of the<br />
rule is false. You can always use compound conditions in the premise and<br />
multiple actions in the THEN or ELSE clauses.<br />
When the condition 105_PREREQ_TAKEN is true, the actions following the<br />
THEN execute. You specify actions to execute when the condition is false in<br />
the ELSE clause. In this example, the ADVICE is TAKE 105 if<br />
105_PREREQ_TAKEN is TRUE and TAKE 104 if 105_PREREQ_TAKEN is<br />
FALSE.<br />
If<br />
KDL Statement Syntax 4-165
If<br />
4-166 <strong>Language</strong> <strong>Reference</strong><br />
.............................................................................................................................................................................<br />
The ELSEIF clause<br />
You can create IF statements with multiple conditions. Consider the<br />
following example:<br />
if 105_prereq_taken<br />
then<br />
advice is 'take 105'<br />
elseif 104_prereq_taken<br />
then<br />
advice is 'take 104'<br />
else advice is 'take 101'<br />
end<br />
This example contains two conditions. The condition that<br />
104_PREREQ_TAKEN only evaluated if the first condition is false.<br />
The ELSEIF specifies the next condition to test if the previous condition is<br />
false. You can use as many ELSEIF clauses as you need. As soon as a<br />
condition is true, <strong>AionDS</strong> executes the actions for the condition and the rule<br />
terminates. The order in which you specify conditions in the IF clause and<br />
ELSEIF clauses determines the order in which the conditions are tested.<br />
The ELSE sets up a default set of actions. In this example, if neither of the<br />
two conditions is true, the action in the ELSE clause executes. If you do not<br />
specify an ELSE clause and all conditions are false, no action executes because<br />
there is no default action to take.<br />
Consider the following example that contains mutually exclusive conditions:<br />
if option =1 then cost = 5000<br />
elseif option =2 then cost = 7000<br />
elseif option =3 then cost = 10000<br />
else<br />
cost =0<br />
error =TRUE<br />
end<br />
Do not leave any space between the ELSE and IF parts of the ELSEIF keyword.<br />
If you leave space, <strong>AionDS</strong> interprets the statement as a nested IF statement.
.............................................................................................................................................................................<br />
Nested IF statements<br />
IF statements can be nested. Consider the statement that builds a list of<br />
software products, as follows:<br />
if computer_needs includes 'software'<br />
then<br />
if software_needs includes 'database'<br />
then<br />
add 'xbase' to software_choices<br />
add 'ybase' to software_choices<br />
end<br />
if software_needs includes 'expert systems'<br />
then<br />
add 'ads/pc' to software_choices<br />
end<br />
end<br />
The IF statement with the condition about COMPUTER_NEEDS contains two<br />
nested IF statements. Nested IF statements imply logical AND between the<br />
condition of each IF statement. If COMPUTER_NEEDS includes SOFTWARE<br />
and SOFTWARE_NEEDS includes DATABASE, <strong>AionDS</strong> adds XBASE and YBASE<br />
to SOFTWARE_CHOICES.<br />
The second nested IF statement is independent of the first nested IF<br />
statement. The second nested IF statement, however, implies a logical AND<br />
with the IF statement containing the condition about COMPUTER_NEEDS.<br />
Only when COMPUTER_NEEDS includes SOFTWARE and SOFTWARE_NEEDS<br />
includes EXPERT SYSTEMS does <strong>AionDS</strong> add ADS/PC to<br />
SOFTWARE_CHOICES.<br />
The END keyword between the two IF statements that are nested in the<br />
previous example makes the nested IF statements independent of each other.<br />
The END keyword terminates the level of nesting.<br />
The END keyword terminates the most recent IF that does not already have an<br />
END. In the example, the first END terminates the condition about<br />
DATABASE, the second END terminates the condition about EXPERT<br />
SYSTEMS, and the final END terminates the condition about SOFTWARE.<br />
If<br />
KDL Statement Syntax 4-167
Ifmatch<br />
Ifmatch<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-168 <strong>Language</strong> <strong>Reference</strong><br />
Use IFMATCH to specify a pattern-matching rule.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
IFMATCH [library::]classname1 WITH boolexpr<br />
....<br />
[library::]classnameN WITH boolexpr<br />
[[library::]classname1, [...,] [library::]classnameN with<br />
boolexpr]<br />
[[NOT] EXISTS ([library::]classname |<br />
CLASS([library::]classname)] WITH<br />
boolexpr)]<br />
[ORDERBY (intexpr , [intexpr ...])]<br />
THEN<br />
actions<br />
[END]<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname1<br />
is the name of the first class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
classnameN<br />
is the name of the last class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
intexpr<br />
is an integer expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
boolexpr<br />
is a Boolean expression.
Ifmatch<br />
.........................................................................................................................................................................................................˝..........................................<br />
actions<br />
are the actions in the rule.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ The IFMATCH statement implements a pattern-matching rule.<br />
Remarks<br />
■ You can use up to 100 class names in a pattern-matching rule.<br />
■ IFMATCH statements operate on instances of classes and subclasses that<br />
share the pattern contained in the pattern-matching portion of the<br />
IFMATCH statement. Prior to <strong>AionDS</strong> Version 6.3, the IFMATCH<br />
statements did not execute on subclasses.<br />
The behavior of IFMATCH statements in applications created prior to<br />
Version 6.3 may differ slightly. When porting a pre-existing application<br />
to <strong>AionDS</strong> Version 6.3 or later, check a sample of the pattern-matching<br />
rules to make sure they execute according to your needs. For example,<br />
assume TRUCK contains the subclasses PICKUP_TRUCKS and<br />
FLATBED_TRUCKS:<br />
ifmatch truck with color = 'red'<br />
This statement will now operate on instances of the TRUCK class and all<br />
of its subclasses. Prior to Version 6.3, the IFMATCH statement would not<br />
have executed on the two subclasses.<br />
■ A boolexpr can contain slot assertions.<br />
■ The ORDERBY clause is used to select the next binding with which to<br />
execute the rule. It executes the binding with the lowest intexpr. If you<br />
use AND or OR in intexpr, they are interpreted as logical AND and logical<br />
OR, respectively.<br />
Beginning with <strong>AionDS</strong> Version 6.3, the ORDERBY clause supports<br />
multiple ordering criteria. You can use up to 25 integer expressions. For<br />
example:<br />
ifmatch truck with color = red<br />
orderby (cost,model_number)<br />
COST and MODEL_NUMBER are slots of base type integer.<br />
KDL Statement Syntax 4-169
Ifmatch<br />
4-170 <strong>Language</strong> <strong>Reference</strong><br />
■ In the actions, class qualifiers are not required for slots unless the slot<br />
names are ambiguous. For example, if only the TRUCK class contains a<br />
TYPE slot, the following statements are equivalent in the actions:<br />
truck.type is 'tractor trailer'<br />
type is 'tractor trailer'<br />
■ You can reference multiple instances of the same class by specifying an<br />
instance identifier with classname, classname1, and so on. The syntax for<br />
the instance is as follows:<br />
classname(inst_no)<br />
inst_no is a non-negative integer.<br />
You can interpret classname as classname(1) within the matching and<br />
binding specifications of the rule. You can interpret classname as<br />
classname(0) within the EXISTS clause.<br />
■ During pattern matching, <strong>AionDS</strong> only considers instances that have<br />
changed since the last execution of a FORWARDCHAIN statement,<br />
including instances that are left over from the execution. Before the first<br />
FORWARDCHAIN statement in a state is executed, <strong>AionDS</strong> considers all<br />
instances that are referenced by pattern-matching rules in the state to be<br />
changed.<br />
■ The following parts of the IFMATCH statement specify the match criteria:<br />
classname1 WITH boolexpr<br />
....<br />
classnameN WITH boolexpr<br />
■ The following parts of the IFMATCH statement specify the bind criteria:<br />
[classname1, [...,] classnameN with boolexpr]<br />
[[NOT] EXISTS (classname with boolexpr)]<br />
The EXISTS clause inhibits bindings from being considered for execution.<br />
If existence is specified, only bindings of classname that meet the boolexpr<br />
criteria are considered for execution. If NOT EXISTS is specified, only<br />
bindings that are formed without the boolexpr criteria are considered.<br />
■ The ORDERBY clause specifies the criteria for choosing the next binding<br />
to execute.<br />
■ You can interchange the order of the EXISTS and ORDERBY clauses.
Ifmatch<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following rule:<br />
ifmatch<br />
truck with cost > 50000 and engine is 'diesel'<br />
then<br />
truck.type is 'tractor trailer'<br />
end<br />
It operates over instances in the TRUCK class in which the value in the cost<br />
slot is greater than 50,000 and the value in the ENGINE slot is DIESEL.<br />
Consider the following rule:<br />
ifmatch<br />
truck with color = 'red'<br />
driver with truck_pref = 'red'<br />
then<br />
add truck.license to driver.truck_choice<br />
end<br />
It operates over two classes, TRUCK and DRIVER. When the rule executes,<br />
<strong>AionDS</strong> matches truck instances with the COLOR slot equal to RED and<br />
DRIVER instances with the TRUCK_PREF slot equal to RED. Since no bind<br />
criteria is specified, the contents of the LICENSE slot in each TRUCK instance<br />
is added to the TRUCK_CHOICE slot of each DRIVER instance.<br />
The rule is equivalent to the following rule:<br />
ifmatch<br />
truck with color = 'red'<br />
driver with truck_pref = 'red'<br />
truck, driver with truck.color = 'red' and<br />
driver.truck_pref = 'red'<br />
then<br />
add truck.license to driver.truck_choice<br />
end<br />
Consider the following rule:<br />
ifmatch<br />
truck with cost < 15000 and color is 'red'<br />
driver with loc = city and avail = TRUE<br />
driver,truck with driver.rating = truck.classification<br />
then<br />
send (solution to class (schedule) with<br />
tag_no, name))<br />
end<br />
KDL Statement Syntax 4-171
Ifmatch<br />
4-172 <strong>Language</strong> <strong>Reference</strong><br />
The rule operates over two classes, TRUCK and DRIVER. The match criteria<br />
for instances of TRUCK are that the COST slot contains a value less than<br />
15000 and that the COLOR slot contains the string RED. The match criteria<br />
for instances of DRIVER are that the LOCATION slot match the contents of the<br />
CITY parameter or slot and that the AVAIL slot holds the Boolean value TRUE.<br />
The bind criteria specifies that instances of DRIVER and TRUCK are to be<br />
bound together if the contents of the RATING slot match the contents of the<br />
CLASSIFICATION slot.<br />
For each binding that results from the match and bind operation, <strong>AionDS</strong><br />
sends a message to class SCHEDULE that invokes the SOLUTION method.<br />
Two arguments are passed to the method: the contents of the TAG_NO slot<br />
in the instance of TRUCK and the contents of the NAME slot in the instance of<br />
DRIVER.<br />
Consider the following rule:<br />
ifmatch<br />
person(1) with salary = 'high'<br />
person(1),person(2) with<br />
->person(1) ->person(2) and<br />
person(1).hobby = person(2).hobby and<br />
person(1).department = person(2).department<br />
then<br />
person(1).worklife is 'happy'<br />
end<br />
The rule references multiple instances of the same class, PERSON. The match<br />
criteria for instances of PERSON is that the contents of the salary slot equal<br />
the string HIGH.<br />
The bind criteria are that an instance of person is to match another instance<br />
of person in the following ways:<br />
■ The instances represented by PERSON(1) and PERSON(2) cannot actually<br />
be the same instance;<br />
■ The contents of the HOBBY slot instance must match for each of the two<br />
instances; and<br />
■ The contents of the DEPARTMENT slot must match for each of the two<br />
instances.
Consider the following rule.<br />
ifmatch node, flight with<br />
node.currentcity = flight.startcity<br />
not exists (node with currentcity =<br />
flight.stopcity)<br />
orderby(node.totalmiles+flight.miles)<br />
then<br />
send (make to class(node) with<br />
flight.stopcity,<br />
node.totalmiles+flight.miles,<br />
node.visitedcities)<br />
end<br />
Ifmatch<br />
The rule operates over instances of NODE and FLIGHT. Since match criteria<br />
are not specified for either class, all instances that have changed since<br />
execution of the last FORWARDCHAIN statement are used.<br />
The bind criteria are that the CURRENTCITY slot in instances of NODE are to<br />
contain the same name as the STARTCITY slot in FLIGHT. The NOT EXISTS<br />
clause inhibits execution of bindings in which the NODE instance contains a<br />
CURRENTCITY that is the same as STOPCITY in the FLIGHT instance.<br />
Because there are several alternative orders in which the bindings can be<br />
executed, the ORDERBY clause is used to specify the binding to execute next.<br />
In this rule, the strategy is to execute the binding that minimizes the number<br />
of miles traveled, which is the sum of the distance between nodes (MILES) and<br />
the distance already traveled (TOTALMILES).<br />
The MAKE method is executed for the binding, which is an instance of NODE<br />
and an instance of FLIGHT. The method invokes a function, which is not<br />
shown in this example, that creates a new NODE instance with the updated<br />
mileage. The function also updates the list of VISITEDCITIES, which affects<br />
the bind criteria.<br />
KDL Statement Syntax 4-173
Includes<br />
Includes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-174 <strong>Language</strong> <strong>Reference</strong><br />
Use INCLUDES to test whether a list or set contains a specific element.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr INCLUDES element<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is a list or set expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
element<br />
is a possible element in the list or set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement results in a Boolean value.<br />
■ If expr is a certainty set, the result is a certainty factor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
if wait_list includes 'project 1250' then ...<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
INDEX<br />
See also
Index<br />
Index<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use INDEX to find the position of a substring in a string or the position of an<br />
element in a set or list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
INDEX (expr1, expr2 [, iexpr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr1<br />
is the value that you want to find.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr2<br />
is the string, set, or list that <strong>AionDS</strong> searches.<br />
.........................................................................................................................................................................................................˝..........................................<br />
iexpr<br />
is an integer expression that specifies where to start the search.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ expr1 is the substring that you want to find when you search a string. It<br />
is the element that you want to find when you search a set or list.<br />
■ If you do not use iexpr, the search starts at the first position in a string or<br />
with the first element of a set or list. The first position is number 1.<br />
■ INDEX returns the starting position of the first occurrence of the<br />
substring in a string, or the position of the first occurrence of an element<br />
in a list or set.<br />
■ If the substring or element of a list or set is not found, the function<br />
returns zero.<br />
■ The return value’s data type can be an integer or real.<br />
.........................................................................................................................................................................................................˝..........................................<br />
loc = index(1230,parts_list)<br />
Examples<br />
pos = index(' ',name,3)<br />
.........................................................................................................................................................................................................˝..........................................<br />
INCLUDES<br />
See also<br />
KDL Statement Syntax 4-175
Intersection<br />
Intersection<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-176 <strong>Language</strong> <strong>Reference</strong><br />
Use INTERSECTION to return the elements common to two or more sets.<br />
.........................................................................................................................................................................................................˝..........................................<br />
INTERSECTION (sexpr, sexpr [, sexpr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
sexpr<br />
is a set expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement returns a set.<br />
■ For certainty sets, the elements in the result set keep the lowest certainty<br />
factor of the common elements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
new_set = intersection (set1, set2)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
DIFFERENCE, UNION<br />
See also
Last<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use LAST to select the last elements of a list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
LAST num OF lexpr<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
num<br />
is the number of elements to select.<br />
.........................................................................................................................................................................................................˝..........................................<br />
lexpr<br />
is an expression that results in a list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
final_group = last 10 of waiting_list<br />
Examples<br />
if last 50 of dsort(zip_codes) includes 0 then ...<br />
.........................................................................................................................................................................................................˝..........................................<br />
FIRST<br />
See also<br />
Last<br />
KDL Statement Syntax 4-177
Length<br />
Length<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-178 <strong>Language</strong> <strong>Reference</strong><br />
Use LENGTH to find the number of characters in a string expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
LENGTH (sexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
sexpr<br />
is a string expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ LENGTH returns an integer value.<br />
Remarks<br />
.........................................................................................................................................................................................................˝..........................................<br />
len = length (last_name & first_name)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
SIZE<br />
See also
LN<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use LN to find the base e logarithm of a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
LN (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
ln (10*finalvalue(m_basket))<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
EXP<br />
See also<br />
LN<br />
KDL Statement Syntax 4-179
Loop<br />
Loop<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-180 <strong>Language</strong> <strong>Reference</strong><br />
Use LOOP to create Do While or Repeat Until loops.<br />
.........................................................................................................................................................................................................˝..........................................<br />
LOOP stmts END<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
stmts<br />
are any number of KDL statements.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Use a BREAK or BREAKIF statement to terminate the loop. The loop is<br />
terminated at the point the BREAK or BREAKIF statement is executed.<br />
■ The difference between Do While and Repeat Until loops is the point at<br />
which the break condition is tested. In a Do While loop, BREAKIF tests<br />
the break conditions before the loop is executed each time. In a Repeat<br />
Until loop, the conditions are tested after each execution of the loop.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following example shows a Do While loop. The statements inside the<br />
loop execute while the condition in the BREAKIF statement is false.<br />
ctr = 0<br />
sum = 0<br />
loop<br />
breakif ((sum > 1000) or (ctr > size(listq)))<br />
ctr = ctr + 1<br />
sum = sum + listq(ctr)<br />
end<br />
The following example shows a Repeat Until loop. The statements inside the<br />
loop execute until the condition in the BREAKIF statement becomes true.<br />
ctr = 0<br />
sum = 0<br />
loop<br />
ctr = ctr + 1<br />
sum = sum + listq(ctr)<br />
breakif ((sum > 1000) or (ctr >= size(listq)))<br />
end<br />
.........................................................................................................................................................................................................˝..........................................<br />
FOR<br />
See also
Max<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use MAX to determine the maximum value of two or more numeric<br />
expressions.<br />
.........................................................................................................................................................................................................˝..........................................<br />
MAX (nexpr, nexpr [, nexpr ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
The maximum value is returned.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
max_value = max (comm_85, comm_86, comm_87,<br />
factor*10000)<br />
.........................................................................................................................................................................................................˝..........................................<br />
MIN<br />
See also<br />
Max<br />
KDL Statement Syntax 4-181
Message<br />
Message<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-182 <strong>Language</strong> <strong>Reference</strong><br />
Use MESSAGE to make a message object a goal.<br />
.........................................................................................................................................................................................................˝..........................................<br />
MESSAGE (name [, option ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following sourcing or processing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
COMPLETE Do not execute the object until all parameters are<br />
resolved.<br />
LASTCHANCE Execute the object before exiting the state in which the<br />
object is defined.<br />
IMMEDIATE Execute the object immediately.<br />
INSTATE Finish with the object before exiting the current state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The sourcing options are mutually exclusive. You must choose between<br />
FINALVALUE, SOURCEVALUE, and CURRENTVALUE.<br />
■ The following processing options are mutually exclusive: COMPLETE,<br />
LASTCHANCE, and IMMEDIATE.<br />
■ The default options are SOURCEVALUE and LASTCHANCE.<br />
■ You cannot specify a processing option for an agenda statement used in a<br />
class. The statement is always executed immediately.<br />
.........................................................................................................................................................................................................˝..........................................<br />
message(me_1,currentvalue,immediate)<br />
Example
Min<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use MIN to return the minimum value of two or more numeric expressions.<br />
.........................................................................................................................................................................................................˝..........................................<br />
MIN (nexpr, nexpr [, nexpr ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
The minimum value is returned.<br />
.........................................................................................................................................................................................................˝..........................................<br />
min_val = min (comm_85, comm_86, comm_87, factor*10000)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
MAX<br />
See also<br />
Min<br />
KDL Statement Syntax 4-183
MOD<br />
MOD<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-184 <strong>Language</strong> <strong>Reference</strong><br />
Use MOD to determine the modulus, or the remainder of integer division.<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr1 MOD nexpr2<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr1<br />
is a numeric expression for the dividend.<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr2<br />
is a numeric expression for the divisor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ nexpr1 controls the sign of the result. If nexpr1 is negative, the sign of<br />
the result is negative. Otherwise, the sign is positive.<br />
■ nexpr2 cannot be zero.<br />
■ Expressions cannot be greater than 2,147,483,647.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
if pnum mod 2 = 0<br />
then<br />
even_flag = true<br />
else<br />
even_flag = false<br />
end<br />
.........................................................................................................................................................................................................˝..........................................<br />
DIV<br />
See also
NameOf<br />
NameOf<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the NAMEOF statement to return the name of an instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
NAMEOF([library::]classname[(inst_id)] |<br />
[library::]pointer-> | CURRENT)<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class, parameter, or slot<br />
exists. The library name is only required when duplicate class, parameter, or<br />
slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
inst_id<br />
is one of the following instance identifiers:<br />
inst_nm is the name of an instance.<br />
->str_expr is a string expression.<br />
int is an integer.<br />
.........................................................................................................................................................................................................˝..........................................<br />
pointer<br />
is a parameter or slot with base type POINTER.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You should consider the use of pointers instead of the NAMEOF statement<br />
to identify specific instances.<br />
For more information: See Chapter 3, “Knowledge Definition <strong>Language</strong>,”<br />
for information about specifying instances.<br />
KDL Statement Syntax 4-185
NameOf<br />
.........................................................................................................................................................................................................˝..........................................<br />
instancename = nameof(truck_ptr->)<br />
Example<br />
4-186 <strong>Language</strong> <strong>Reference</strong>
Not<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use NOT to reverse the meaning of a Boolean or numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
NOT expr<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is a Boolean or numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
Numeric expressions cannot be greater than 2,147,483,647.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement could appear in the Execution Conditions property<br />
of a state:<br />
not probable_error<br />
When the Boolean parameter PROBABLE_ERROR is not TRUE, <strong>AionDS</strong> enters<br />
the state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
AND, OR, XOR<br />
See also<br />
Not<br />
KDL Statement Syntax 4-187
Num<br />
Num<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-188 <strong>Language</strong> <strong>Reference</strong><br />
Use NUM to convert a string to a number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
NUM (str)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
str<br />
is a string expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ A run-time error results if str cannot be converted into a number.<br />
■ The statement returns a real number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
part = num (input_str)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
STR<br />
See also
Or<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use OR to return the logical or bitwise OR of two expressions.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr1 OR expr2<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr1<br />
is an integer or Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr2<br />
is an integer or Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Both expressions must be the same type.<br />
■ If expr1 is a Boolean that evaluates to TRUE, expr2 is not evaluated.<br />
■ If the expressions are integers, <strong>AionDS</strong> executes a bitwise comparison to<br />
test each bit of expr1 against the corresponding bit in expr2.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following premise of a rule:<br />
if disabled or (age > 59) then ...<br />
The parameter DISABLED is a Boolean. The expression AGE > 59 is a Boolean<br />
expression. <strong>AionDS</strong> evaluates DISABLED first. If it is TRUE, the evaluation<br />
stops and the actions of the rule can execute.<br />
Or<br />
KDL Statement Syntax 4-189
Or<br />
4-190 <strong>Language</strong> <strong>Reference</strong><br />
Consider the following statement:<br />
result = int_128 or int_1024<br />
The integer parameters INT_128 and INT_1024 contain the values 128 and<br />
1,024 respectively. When the statement executes, RESULT contains 1,152.<br />
You should consider the operation in binary notation, as follows:<br />
int_1024: 0000010000000000<br />
int_128: 0000000010000000<br />
result: 0000010010000000<br />
The RESULT parameter contains the or of the bits.<br />
The following statement sets a bit in FLAG:<br />
flags = flags or hex('1000')<br />
.........................................................................................................................................................................................................˝..........................................<br />
AND, BIN, HEX, XOR<br />
See also
Parameter<br />
Parameter<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use PARAMETER to make a parameter object a goal.<br />
.........................................................................................................................................................................................................˝..........................................<br />
PARAMETER ([library::]name [, option ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following sourcing or processing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
COMPLETE Do not execute the object until all parameters are<br />
resolved.<br />
LASTCHANCE Execute the object before exiting the state in which the<br />
object is defined.<br />
IMMEDIATE Execute the object immediately.<br />
INSTATE Finish with the object before exiting the current state.<br />
KDL Statement Syntax 4-191
Parameter<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The sourcing options are mutually exclusive. You must choose between<br />
FINALVALUE, SOURCEVALUE, and CURRENTVALUE.<br />
4-192 <strong>Language</strong> <strong>Reference</strong><br />
■ The following processing options are mutually exclusive: COMPLETE,<br />
LASTCHANCE, and IMMEDIATE.<br />
■ The default options are SOURCEVALUE and LASTCHANCE.<br />
■ You cannot specify a processing option for an agenda statement used in a<br />
class. The statement is always executed immediately.<br />
.........................................................................................................................................................................................................˝..........................................<br />
parameter(pa_1,complete,instate)<br />
Example
Process<br />
Process<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use PROCESS to make a process object a goal.<br />
.........................................................................................................................................................................................................˝..........................................<br />
PROCESS (name [, option ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following sourcing or processing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
COMPLETE Do not execute the object until all parameters are<br />
resolved.<br />
LASTCHANCE Execute the object before exiting the state in which the<br />
object is defined.<br />
IMMEDIATE Execute the object immediately.<br />
INSTATE Finish with the object before exiting the current state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The sourcing options are mutually exclusive. You must choose between<br />
FINALVALUE, SOURCEVALUE, and CURRENTVALUE.<br />
■ The following processing options are mutually exclusive: COMPLETE,<br />
LASTCHANCE, and IMMEDIATE.<br />
■ The default options are SOURCEVALUE and LASTCHANCE.<br />
■ You cannot specify a processing option for an agenda statement used in a<br />
class. The statement is always executed immediately.<br />
.........................................................................................................................................................................................................˝..........................................<br />
process(pr_1,finalvalue,lastchance,instate)<br />
Example<br />
KDL Statement Syntax 4-193
ReadStr<br />
ReadStr<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-194 <strong>Language</strong> <strong>Reference</strong><br />
Use READSTR to copy the contents of a variant record into fields, parameters,<br />
or slots.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
READSTR (buffer, [library::]index, [library::]dest<br />
[, [library::]dest])<br />
.........................................................................................................................................................................................................˝..........................................<br />
buffer<br />
is a string or a record that contains a single string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter, instance, or slot<br />
exists. The library name is only required when duplicate parameter, instance,<br />
or slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
index<br />
is an integer parameter or constant.<br />
.........................................................................................................................................................................................................˝..........................................<br />
dest<br />
is a record, instance, record field, parameter or slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Variant records are records from an external file with fields that vary<br />
depending upon the type of record. The record type is stored in the same<br />
position of each record.<br />
■ You should read the variant record into a STRING buffer and use<br />
READSTR to copy the record into fields. Alternatively, you can use<br />
READSTR to copy the record into parameters.<br />
■ index specifies the beginning location for transfer of the data. The first<br />
location in buffer is 1.
ReadStr<br />
■ READSTR returns the starting position in buffer of the next substring to<br />
transfer. If you want to process buffer sequentially, you can use the<br />
return value to set index to the beginning of the next field to process.<br />
■ <strong>AionDS</strong> does not backward chain for buffer.<br />
■ Specify the NOTRIM attribute for strings that contain NULL values<br />
before other valid values; otherwise the strings are truncated incorrectly.<br />
By default, <strong>AionDS</strong> terminates input strings at the first NULL value<br />
encountered. When the NOTRIM attribute is used, the string is not<br />
truncated at any NULL value. Also, all leading and trailing blanks are<br />
preserved. Because all leading and trailing blanks are preserved, you<br />
might need to increase the buffer size to accommodate the resulting<br />
string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following example that reads variant records into <strong>AionDS</strong> and<br />
transfers the fields into other records, depending on the record type:<br />
openfile(f,'coerce.dat','read')<br />
loop<br />
getrec(f)<br />
breakif eof(f)<br />
readstr(f->.data,1,format)<br />
if format = 1 then<br />
readstr(f->.data,1,rec1)<br />
add rec1 to rec1_list<br />
elseif format = 2 then<br />
readstr(f->.data,1,rec2)<br />
add rec2 to rec2_list<br />
elseif format = 3 then<br />
readstr(f->.data,1,rec3)<br />
add rec3 to rec3_list<br />
end<br />
The base types of the records and the parameter FORMAT are as follows:<br />
F REC1<br />
file of record(noattr) record(noattr)<br />
data is string(20) type is integer(2)<br />
end name is string(10)<br />
end<br />
KDL Statement Syntax 4-195
ReadStr<br />
4-196 <strong>Language</strong> <strong>Reference</strong><br />
REC2 REC3<br />
record(noattr) record(noattr)<br />
type is integer(2) type is integer(2)<br />
code1 is integer(4) amt is real(8)<br />
code2 is integer(4) name is string(10)<br />
name is string(10) end<br />
end<br />
FORMAT<br />
integer (noattr,2)<br />
The file is opened for reading. The file parameter is F. The base type of F is<br />
the DATA record. Records are read into <strong>AionDS</strong> using a loop, which<br />
terminates when there are no more input records. During execution of the<br />
loop, the following actions occur:<br />
■ A READSTR executes, which transfers from the first byte of DATA to<br />
FORMAT. The base type of FORMAT controls how much data is<br />
transferred as well as the conversion. After the transfer, FORMAT<br />
contains a two-byte integer that represents the record type.<br />
■ Depending on the contents of FORMAT, one of three additional<br />
READSTR statements execute. In all cases, the conversion starts from byte<br />
1. You could start the conversion from byte 3, which might improve<br />
performance because less data is transferred. You would, however, need<br />
to code several READSTR statements, one for each field that you need to<br />
transfer.<br />
■ If FORMAT equals 1, REC1.NAME receives 10 bytes from DATA. The<br />
remaining 8 bytes of data are not transferred.<br />
■ If FORMAT equals 2, four bytes of data are transferred to REC2.CODE1,<br />
the next four bytes are transferred to REC2.CODE2, and the next ten<br />
bytes are transferred to REC2.NAME.<br />
■ If FORMAT equals 3, eight bytes of data are transferred to REC3.AMT and<br />
the next ten bytes are transferred to REC3.NAME.
Consider the following example:<br />
openfile(f,'coerce.dat','read')<br />
loop<br />
getrec(f)<br />
breakif eof(f)<br />
readstr(f->.data,1,format)<br />
if format = 1 then<br />
readstr(f->.data,3,class1_ptr->)<br />
elseif format = 2 then<br />
readstr(f->.data,3,class2_ptr->)<br />
elseif format = 3 then<br />
readstr(f->.data,3,class3_ptr->)<br />
end<br />
ReadStr<br />
It is similar to the previous example. Instead of transferring data to records,<br />
the READSTR statements transfer the data to instances. The instances are<br />
referenced by pointers. Note that the format type code is not present in the<br />
respective classes, therefore, it is not assigned.<br />
Consider the following example:<br />
openfile (f,'elements.dat','read')<br />
rec_no =1<br />
loop<br />
getrec(f)<br />
breakif eof(f)<br />
pos = readstr(f->.data,1,n_values)<br />
for i = 1 to n_values<br />
pos = readstr(f->.data,pos,rec_list(<br />
rec_no).value(i))<br />
end<br />
rec_no = rec_no +1<br />
end<br />
The base type of F, N_VALUES, and REC_LIST are as follows:<br />
F N_VALUES<br />
record(noattr) integer(noattr,2)<br />
data is string(20)<br />
end<br />
REC_LIST<br />
list of record(noattr)<br />
value is list(9)<br />
of integer(2)<br />
end<br />
KDL Statement Syntax 4-197
ReadStr<br />
4-198 <strong>Language</strong> <strong>Reference</strong><br />
The first two bytes of data contain the number of two-byte integers in the<br />
record. A FOR loop operates over each record. For each iteration of the loop,<br />
a number is transferred from DATA to the next VALUE.<br />
The READSTR statement returns POS, the next position from which to<br />
transfer data. Note that although the number of values that are transferred<br />
vary, each DATA record is the same length, 20 bytes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
WRITESTR<br />
See also
Report<br />
Report<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use REPORT to make a report object a goal.<br />
.........................................................................................................................................................................................................˝..........................................<br />
REPORT (name [, option ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following sourcing or processing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
COMPLETE Do not execute the object until all parameters are<br />
resolved.<br />
LASTCHANCE Execute the object before exiting the state in which the<br />
object is defined.<br />
IMMEDIATE Execute the object immediately.<br />
INSTATE Finish with the object before exiting the current state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The sourcing options are mutually exclusive. You must choose between<br />
FINALVALUE, SOURCEVALUE, and CURRENTVALUE.<br />
■ The following processing options are mutually exclusive: COMPLETE,<br />
LASTCHANCE, and IMMEDIATE.<br />
■ The default options are SOURCEVALUE and LASTCHANCE.<br />
■ You cannot specify a processing option for an agenda statement used in a<br />
class. The statement is always executed immediately.<br />
.........................................................................................................................................................................................................˝..........................................<br />
report(re_1)<br />
Example<br />
KDL Statement Syntax 4-199
Return<br />
Return<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-200 <strong>Language</strong> <strong>Reference</strong><br />
Use RETURN to terminate a rule or function.<br />
.........................................................................................................................................................................................................˝..........................................<br />
RETURN [(arg)]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
arg<br />
is an optional argument that is returned from a function.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The RETURN statement terminates the entire rule or function. If you<br />
want to terminate a loop, use a BREAK or BREAKIF statement.<br />
■ You can only use arg in a function.<br />
■ arg can be any expression except one that results in a record, instance, set,<br />
or list.<br />
■ A function that does not return arg is also called a procedure.<br />
■ You cannot return arg from a rule.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In functions, the RETURN statement can return a single value, such as the<br />
integer SUM, or a constant, such as -1.<br />
if size(list_pa) >0<br />
then<br />
...<br />
return(sum)<br />
else<br />
return(-1)<br />
end<br />
In the following example, a pointer to an instance is returned:<br />
ptr = create(statistics)<br />
...<br />
return(ptr)
Consider the following procedural rule:<br />
for listq<br />
if listq(i).key = key_num<br />
then<br />
goal = listq(i).name<br />
return<br />
end<br />
...<br />
end<br />
Return<br />
The RETURN statement terminates the entire rule. If the RETURN statement<br />
in this example is replaced by a BREAK or BREAKIF or statement, only the<br />
FOR loop would terminate. Any other actions would be executed.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BREAK, BREAKIF<br />
See also<br />
KDL Statement Syntax 4-201
Round<br />
Round<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-202 <strong>Language</strong> <strong>Reference</strong><br />
Use ROUND to round a real expression to the nearest integer.<br />
.........................................................................................................................................................................................................˝..........................................<br />
ROUND (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If the fraction is exactly .5, nexpr is rounded away from zero.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following statement:<br />
int_val = round (real_val)<br />
The following table shows the effect of rounding:<br />
REAL_VAL INT_VAL<br />
-1.5 -2<br />
1.5 2<br />
-2.5 -3<br />
2.5 3<br />
.........................................................................................................................................................................................................˝..........................................<br />
TRUNC<br />
See also
Rule<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use RULE to make an If-Then rule object a goal.<br />
.........................................................................................................................................................................................................˝..........................................<br />
RULE (name [, option ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following processing options:<br />
COMPLETE Do not execute the object until all parameters are<br />
resolved.<br />
LASTCHANCE Execute the object before exiting the state in which the<br />
object is defined.<br />
IMMEDIATE Execute the object immediately.<br />
INSTATE Finish with the object before exiting the current state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ RULE is not valid for Ifmatch-Then rules.<br />
Remarks<br />
■ The following processing options are mutually exclusive: COMPLETE,<br />
LASTCHANCE, and IMMEDIATE.<br />
■ The processing options determine whether or not are partially processed<br />
rule is placed on the pending list.<br />
■ The default option is LASTCHANCE.<br />
Rule<br />
■ RULE is only allowed in an Agenda property.<br />
Tip: You usually let rules be invoked automatically by the backward or<br />
forward chainer, rather than explicitly invoking a rule with the RULE Agenda<br />
statement.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SET<br />
See also<br />
KDL Statement Syntax 4-203
SelectAll<br />
SelectAll<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-204 <strong>Language</strong> <strong>Reference</strong><br />
Use SELECTALL to retrieve pointers to instances that match your criteria.<br />
Beginning with <strong>AionDS</strong> Version 6.3, the SELECTALL statement operates over<br />
all instances of subclasses of the class whose name appears in the syntax of the<br />
statement.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
SELECTALL (CLASS([library::]classname) | CURRENTCLASS [WITH<br />
bool_expr])<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Specify your criteria in bool_expr. If the WITH clause is omitted, WITH<br />
TRUE is assumed.<br />
■ The statement returns a list of pointers.<br />
.........................................................................................................................................................................................................˝..........................................<br />
ptr_list = selectall(class(truck) with color = 'red')<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
EXISTS, SELECTONE<br />
See also
SelectOne<br />
SelectOne<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use SELECTONE to retrieve the pointer to an instance that matches your<br />
criteria.<br />
Beginning with <strong>AionDS</strong> Version 6.3, the SELECTONE statement operates over<br />
all instances of subclasses of the class whose name appears in the syntax of the<br />
statement.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
SELECTONE (CLASS([library::]classname) |<br />
CURRENTCLASS [WITH bool_expr])<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bool_expr<br />
is a Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Specify your criteria in bool_expr. If the WITH clause is omitted, WITH<br />
TRUE is assumed.<br />
■ The statement returns a pointer.<br />
■ If more than one instance matches the criteria, the statement returns a<br />
pointer to the first instance that matches the criteria.<br />
.........................................................................................................................................................................................................˝..........................................<br />
ptr = selectone(class(truck) with color = 'red')<br />
Example<br />
KDL Statement Syntax 4-205
SelectOne<br />
.........................................................................................................................................................................................................˝..........................................<br />
EXISTS, SELECTALL<br />
See also<br />
4-206 <strong>Language</strong> <strong>Reference</strong>
Send (to class)<br />
Send (to class)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use SEND to send a message to invoke a method on a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
SEND (method TO CLASS([library::]classname) | CURRENTCLASS<br />
[WITH valuelist])<br />
or<br />
{CLASS([library::]classname) | CURRENTCLASS |<br />
[library::]classname}.method [(valuelist)]<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class exists. The library<br />
name is only required when duplicate class names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
method<br />
is the name of a method.<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
valuelist<br />
are the input and output arguments for the method.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Use this syntax when a method is intended to operate upon the entire<br />
class.<br />
■ Within a method, you should use CURRENTCLASS so that the method<br />
can be inherited.<br />
■ You can use a short-hand dot syntax as an alternative to the SEND<br />
statement. The advantage of the dot syntax is that it is more concise.<br />
KDL Statement Syntax 4-207
Send (to class)<br />
4-208 <strong>Language</strong> <strong>Reference</strong><br />
■ If you pass a valuelist, the method must invoke a function or an<br />
independent state. The valuelist must follow the calling convention for<br />
the function or independent state.<br />
■ If no output arguments are specified for the method, a return value can<br />
be specified and the SEND statement can be used as a function.<br />
■ Message passing is implemented using an indirect function call facility.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statements invoke the MAKE method for class TRUCK:<br />
send(make to class (truck) with 'ford bronco')<br />
class(truck).make('ford bronco')<br />
currentclass.make('ford bronco')<br />
Consider the following statement:<br />
send (new_acct to class (accounts))<br />
No instance is current when you send a message to a class. You must specify<br />
instances within the method. The CREATE_ACCOUNT function that is<br />
attached to the NEW_ACCT method is as follows:<br />
inst_ptr = create (account with<br />
checking_balance =0,<br />
savings_balance =0)<br />
ask (inst_ptr->)<br />
This method creates an instance of an account and returns its pointer in the<br />
parameter INSTANCE_PTR. This is an example of using a class variable to<br />
hold information that is not part of an instance. The pointer is used to<br />
identify the instance within the method. The function uses the pointer in the<br />
ASK statement to collect data for the other slots in the instance.
Send (to instance)<br />
Send (to instance)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use SEND to send a message to invoke a method on an instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
SEND (method TO [library::]classname[(inst_id)] |<br />
[library::]pointer-> | CURRENT | [library::]inst_nm<br />
[WITH valuelist])<br />
or<br />
{[library::]classname[(inst_id)] | [library::]pointer-> |<br />
CURRENT | [library::]inst_nm}.method [(valuelist)]<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class, parameter, or slot<br />
exists. The library name is only required when duplicate class, parameter, or<br />
slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
method<br />
is the name of a method.<br />
.........................................................................................................................................................................................................˝..........................................<br />
classname<br />
is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
inst_id<br />
is one of the following instance identifiers:<br />
inst_nm is the name of an instance.<br />
->str_expr is a string expression.<br />
int is an integer.<br />
.........................................................................................................................................................................................................˝..........................................<br />
pointer<br />
is a parameter or slot with base type POINTER.<br />
KDL Statement Syntax 4-209
Send (to instance)<br />
.........................................................................................................................................................................................................˝..........................................<br />
inst_nm<br />
4-210 <strong>Language</strong> <strong>Reference</strong><br />
is the name of an instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
valuelist<br />
are the input and output arguments for the method.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Use this syntax when the method is intended to operate on an instance.<br />
■ You can use a short-hand dot syntax as an alternative to the SEND<br />
statement. The advantage of the dot syntax is that it is more concise.<br />
■ If you pass a valuelist, the method must invoke a function or an<br />
independent state. The valuelist must follow the calling convention for<br />
the function or independent state.<br />
■ If no output arguments are specified for the method, a return value can<br />
be specified and the send statement can be used as a function.<br />
■ Message passing is implemented using an indirect function call facility.<br />
For more information: See Chapter 3, “Knowledge Definition <strong>Language</strong>,”<br />
for additional information about instance references.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statements invoke the SHOWME method for instances of class<br />
TRUCK:<br />
send (showme to truck(fordbronco))<br />
truck(fordbronco).showme<br />
send (showme to truckptr->)<br />
truckptr->.showme<br />
current.showme<br />
You can specify arguments to be sent to a method. Optionally, the method<br />
can return a value. Consider the following messages, which are equivalent:<br />
send (credit to account with 'checking', amount)<br />
account.credit('checking', amount)
The following function is attached to the CREDIT method:<br />
Input Arguments:<br />
acct is string<br />
amt is real<br />
Function Body:<br />
if acct is 'checking'<br />
then<br />
checking_balance is checking_balance + amt<br />
else<br />
savings_balance is savings_balance + amt<br />
end<br />
Send (to instance)<br />
The WITH clause of the SEND statement defines the arguments. The<br />
arguments in the function must correspond to the arguments in the WITH<br />
clause. You must use <strong>AionDS</strong> conventions for passing arguments.<br />
You can capture return values. Consider the following examples:<br />
new_balance = send(update to account with 'credit',<br />
amount)<br />
new_balance = account.update('credit', amount)<br />
if send (update to account with 'credit',amount) < 0<br />
then ...<br />
if account.update('credit', amount) < 0 then ...<br />
In the examples, the method returns a value when its attached function<br />
terminates. In the first two examples, the return value is assigned to the<br />
parameter NEW_BALANCE. In the second two examples, the return value is<br />
used in a condition of an IF statement and the return value is not retained.<br />
Consider the following ORDERBY clause in a pattern-matching rule:<br />
ORDERBY (flight.fl_time)<br />
When you create the knowledge base, FL_TIME might be a slot that contains<br />
the average flight time. Later you could modify the knowledge base and<br />
replace the FL_TIME slot as a method that calculates the time using factors<br />
such as weather, airport delays, and so on.<br />
KDL Statement Syntax 4-211
Send Up<br />
Send Up<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-212 <strong>Language</strong> <strong>Reference</strong><br />
Use SEND UP to send a message to invoke a method in the parent class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SEND (method UP [WITH valuelist])<br />
Syntax<br />
or<br />
UP.method [(valuelist)])<br />
.........................................................................................................................................................................................................˝..........................................<br />
method<br />
is the name of the method that responds to the message in the parent class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
valuelist<br />
is a list of arguments to the method.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Use this format in a method that is implemented as a specialization of a<br />
method in the parent class.<br />
■ You can use a short-hand dot syntax as an alternative to the SEND<br />
statement.<br />
■ If you pass a valuelist, the method must invoke a function or an<br />
independent state. The valuelist must follow the calling convention for<br />
the function or independent state.<br />
■ If no output arguments are specified for the method, a return value can<br />
be specified and the send statement can be used as a function.<br />
■ Message passing is implemented using an indirect function call facility.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statements invoke the SHOWME method in the parent class of<br />
a subclass:<br />
up.showme<br />
send (showme up)
Send Up<br />
You can create a method in a class that is a specialization of the method in its<br />
parent. For example, consider the following messages, which are equivalent:<br />
send (calc_sale to discount(->this_sale))<br />
discount(->this_sale).calc_sale<br />
The CALC_SALE method responds by invoking a function that contains the<br />
following lines for instances of DISCOUNT:<br />
send (calc_sale up)<br />
total = total *.85<br />
You can also specify the function as follows:<br />
up.calc_sale<br />
total = total *.85<br />
The message is sent up to the parent class, which calculates the TOTAL for the<br />
current instance. The local method reduces the value in the TOTAL slot of<br />
the instance by 15 percent.<br />
If you send the CALC_SALE message directly to the parent class, the method<br />
in the parent responds. Since the parent method does not have the<br />
specialized logic, the sale is not discounted.<br />
Specialization of methods reduces the maintenance effort. If you change the<br />
general way that sales are calculated in the parent, the change is automatically<br />
reflected in methods in subclasses. If you change the discounting logic, you<br />
only make the change in the DISCOUNT subclass. You do not need to change<br />
the general method in the parent class.<br />
KDL Statement Syntax 4-213
Set<br />
Set<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-214 <strong>Language</strong> <strong>Reference</strong><br />
Use SET to change the property of an object during a consultation.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SET (obj_type(obj_name), prop(value))<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
obj_type<br />
is the type of object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
obj_name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
prop<br />
is the property to change.<br />
.........................................................................................................................................................................................................˝..........................................<br />
value<br />
is the new value of the property.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ You can use SET only to specify the Priority property of a rule or group.<br />
Remarks<br />
■ The SET statement is useful if you want to change the order in which a<br />
rule fires or to change the group object to use during user sourcing.<br />
.........................................................................................................................................................................................................˝..........................................<br />
set(rule(r1),priority(10))<br />
Example
SIN<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use SIN to return the real result for the sine of a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SIN (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
nexpr contains a value representing radians, not degrees. It must be in the<br />
range of -1 and 1, inclusive.<br />
.........................................................................................................................................................................................................˝..........................................<br />
sin_b = sin (angle_b)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
ARCTAN, COS<br />
See also<br />
SIN<br />
KDL Statement Syntax 4-215
Size<br />
Size<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-216 <strong>Language</strong> <strong>Reference</strong><br />
Use SIZE to find the number of elements in a set or list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SIZE (expr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is a set or list expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
For certainty sets, all values are counted, even those that have a certainty<br />
factor less than the threshold value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
size(customers)<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
LENGTH<br />
See also
Slot<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use SLOT to make a slot object a goal.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SLOT ([library::]name [, option ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the slot exists. The library name<br />
is only required when duplicate slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following sourcing or processing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
COMPLETE Do not execute the object until all parameters are<br />
resolved.<br />
LASTCHANCE Execute the object before exiting the state in which the<br />
object is defined.<br />
IMMEDIATE Execute the object immediately.<br />
INSTATE Finish with the object before exiting the current state.<br />
Slot<br />
KDL Statement Syntax 4-217
Slot<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The sourcing options are mutually exclusive. You must choose between<br />
FINALVALUE, SOURCEVALUE, and CURRENTVALUE.<br />
4-218 <strong>Language</strong> <strong>Reference</strong><br />
■ The following processing options are mutually exclusive: COMPLETE,<br />
LASTCHANCE, and IMMEDIATE.<br />
■ The default options are SOURCEVALUE and LASTCHANCE.<br />
■ You cannot specify a processing option for an agenda statement used in a<br />
class. The statement is always executed immediately.<br />
.........................................................................................................................................................................................................˝..........................................<br />
slot(slot_1,complete,instate)<br />
Example
SourceValue<br />
SourceValue<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use SOURCEVALUE to backward chain for parameters that do not currently<br />
have a value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SOURCEVALUE (expr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is an expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Only the current scope is used to determine value sources. If a value<br />
cannot be determined because sources for a parameter in expr are out of<br />
scope, <strong>AionDS</strong> terminates execution of the KDL statement. The<br />
structure of your knowledge base determines whether these statements are<br />
executed later.<br />
■ SOURCEVALUE differs from BESTVALUE because backward chaining does<br />
not occur for parameters that already have values.<br />
■ This is the default sourcing option.<br />
.........................................................................................................................................................................................................˝..........................................<br />
BESTVALUE, CURRENTVALUE, FINALVALUE<br />
See also<br />
KDL Statement Syntax 4-219
SQR<br />
SQR<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-220 <strong>Language</strong> <strong>Reference</strong><br />
Use SQR to find the square of a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SQR (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is the numeric expression to be squared.<br />
.........................................................................................................................................................................................................˝..........................................<br />
sqr(r)*pi<br />
Example
SQRT<br />
SQRT<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use SQRT to find the square root of a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SQRT (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is the numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
sqrt(finalvalue(proj_variance))<br />
Example<br />
KDL Statement Syntax 4-221
State<br />
State<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-222 <strong>Language</strong> <strong>Reference</strong><br />
Use STATE to make a state object a goal.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
STATE [(name[(in_parameter, ..., out_parameter)]<br />
[, option])]<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of the object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
in_parameter<br />
is an input parameter for the state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
out_parameter<br />
is an output parameter for the state.<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following sourcing or processing options:<br />
FINALVALUE Backward chain for parameters.<br />
SOURCEVALUE Backward chain for parameters without values.<br />
CURRENTVALUE Do not backward chain.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You must specify the STATE statement in the agenda if you want <strong>AionDS</strong><br />
to process substates.<br />
■ If name is omitted, <strong>AionDS</strong> processes all sub-states not explicitly listed in<br />
the agenda.<br />
■ If you are using the statement in a rule, name must be the name of an<br />
independent state. In this case, name is not optional.<br />
■ The default option is SOURCEVALUE.<br />
■ <strong>AionDS</strong> never places a state on the pending list.<br />
■ The sourcing options only apply to input parameters.
State<br />
■ If the state being executed has input and output parameters, you must<br />
list the input parameters before the output parameters. The parameters<br />
listed in the STATE statement must match in number and base type with<br />
those in the state being executed.<br />
For more information: See Chapter 3, “Knowledge Definition <strong>Language</strong>,”<br />
for more information about sourcing options for states.<br />
.........................................................................................................................................................................................................˝..........................................<br />
state /* from agenda */<br />
Examples<br />
state (ind_1,sourcevalue) /* from agenda */<br />
if common_info is true /* from a rule */<br />
then<br />
state(ind_1,currentvalue)<br />
end<br />
state(ind_2(in_pa,out_pa1,out_pa2),currentvalue)<br />
KDL Statement Syntax 4-223
Str (from Booleans)<br />
Str (from Booleans)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-224 <strong>Language</strong> <strong>Reference</strong><br />
Use STR to convert a Boolean to a string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
STR ([library::]param [:width])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter or slot exists. The<br />
library name is only required when duplicate parameter or slot names exist in<br />
any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is a Boolean parameter or slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions to reserve in the output string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ param is converted to TRUE, FALSE, or UNKNOWN and is returned in a<br />
string.<br />
■ If width is a positive number that specifies more positions than are<br />
needed to hold the conversion, param is right-justified in the string and<br />
padded with spaces on the left.<br />
■ If width is a negative number and specifies more positions than are<br />
needed to hold the conversion, param is left-justified in the string and<br />
padded with spaces on the right.<br />
■ If width is too small to hold the string, the string is truncated.
Str (from Booleans)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
String specification Type Value Result<br />
str (bool_val:8) Boolean unknown ' unknown'<br />
str (bool_val:-8) Boolean true 'true '<br />
str (bool_val:1) Boolean false 'f'<br />
KDL Statement Syntax 4-225
Str (from dates and times)<br />
Str (from dates and times)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-226 <strong>Language</strong> <strong>Reference</strong><br />
Use STR to convert a date or time to a string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
STR ([library::]number [:width [:format]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter or slot exists. The<br />
library name is only required when duplicate parameter or slot names exist in<br />
any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is a date or time constant, slot, or parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions to reserve in the string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is a number that specifies the output format, as follows:<br />
1 specifies DD-MMM-YYYY for dates and HH:MM:SS.hh for times.<br />
2 specifies DD-MMM-YY for dates and HH:MMam for times.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement converts number and returns a string.<br />
■ If width is a positive number that specifies more positions than are<br />
needed to hold the conversion, number is right-justified in the string and<br />
padded with spaces on the left.<br />
■ If width is a negative number and specifies more positions than are<br />
needed to hold the conversion, number is left-justified in the string and<br />
padded with spaces on the right.
Str (from dates and times)<br />
■ If width is too small to hold the string, the string is truncated.<br />
■ If you do not specify format, <strong>AionDS</strong> uses format 1.<br />
KDL Statement Syntax 4-227
Str (from dates and times)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
4-228 <strong>Language</strong> <strong>Reference</strong><br />
String specification Type Value Result<br />
str (currentdate) '10-Jun1987'<br />
str (currenttime) '12:01:30.05'<br />
str (dat_val:14) Date 2-Feb-1988 '2-Feb-1988'<br />
str (dat_val:-14) Date 2-Feb-1988 '2-Feb-1988 '<br />
str (dat_val:14:2) Date 2-Feb-1988 '2-Feb-88'<br />
str (tim_val:14) Time 23:30:02.01 '23:30:02.01'<br />
str (tim_val:-14) Time 23:30:02.01 '23:30:02.01'<br />
str (tim_val:14:2) Time 23:30:02.01 ' 11:30pm'<br />
str (tim_val:8) Time 23:30:02.01 '23:30:02'
Str (from integers)<br />
Str (from integers)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use STR to convert an integer to a string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
STR ([library::]number [:width [:base]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter or slot exists. The<br />
library name is only required when duplicate parameter or slot names exist in<br />
any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is an integer constant, slot, or parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions to reserve in the string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
base<br />
is the constant 2, 10, or 16.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement converts number and returns a string.<br />
■ If width is a positive number that specifies more positions than are<br />
needed to hold the conversion, number is right-justified in the string and<br />
padded with spaces on the left if base is not specified.<br />
■ If width is a negative number and specifies more positions than are<br />
needed to hold the conversion, number is left-justified in the string and<br />
padded with spaces on the right if base is not specified.<br />
■ If width is too small to hold the string, the string is expanded to hold the<br />
value.<br />
■ If you do not specify width, the string does not contain leading or trailing<br />
spaces.<br />
KDL Statement Syntax 4-229
Str (from integers)<br />
4-230 <strong>Language</strong> <strong>Reference</strong><br />
■ If you specify base, the string is padded with leading zeros and the size of<br />
the string is width.<br />
■ If you specify base as 2, the string contains the binary representation of<br />
number. If you specify base as 16, the string contains the hexadecimal<br />
representation.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
String specification Type Value Result<br />
str (int_val:10) Integer 5000 ' 5000'<br />
str (int_val:-10) Integer 5000 '5000 '<br />
str (int_val) Integer 5000 '5000'<br />
str (int_val:8:16) Integer 255 '000000FF'<br />
str (int_val:10:16) Integer 256 '00000000100'<br />
str (int_val:10:2) Integer 256 '00100000000'
Str (from real numbers)<br />
Str (from real numbers)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use STR to convert a real number to a string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
STR ([library::]number [:width [:right]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter or slot exists. The<br />
library name is only required when duplicate parameter or slot names exist in<br />
any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is an integer constant, slot, or parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions to reserve in the string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
right<br />
is the number of digits to place to the right of the decimal point in the string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement converts number and returns a string.<br />
■ If width is a positive number that specifies more positions than are<br />
needed to hold the conversion, number is right-justified in the string and<br />
padded with spaces on the left.<br />
■ If width is a negative number and specifies more positions than are<br />
needed to hold the conversion, number is left-justified in the string and<br />
padded with spaces on the right.<br />
■ If width is too small to hold the string, the string is expanded to hold the<br />
value.<br />
■ If you specify width but do not specify right, number is placed in the<br />
string in exponent format; for example, 1.23E+003.<br />
KDL Statement Syntax 4-231
Str (from real numbers)<br />
4-232 <strong>Language</strong> <strong>Reference</strong><br />
■ If you do not use width and right, number is stored in fixed-point<br />
notation with two digits after the decimal point; for example, 100.00.<br />
■ If you use width and right, leave space for the decimal point. If you only<br />
use width, leave enough space for the decimal point, the character E, the<br />
sign, and the precision that you want.
Str (from real numbers)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
String specification Type Value Result<br />
str (real_val:10) Real 5000 ' 5.00E+003'<br />
str (real_val:10:0) Real 5000 ' 5000'<br />
str (real_val) Real 5000 '5000.00'<br />
.........................................................................................................................................................................................................˝..........................................<br />
NUM<br />
See also<br />
KDL Statement Syntax 4-233
Str (with strings)<br />
Str (with strings)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-234 <strong>Language</strong> <strong>Reference</strong><br />
Use STR to convert a string to a string with another format.<br />
.........................................................................................................................................................................................................˝..........................................<br />
STR ([library::]param [:width [:format]])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter or slot exists. The<br />
library name is only required when duplicate parameter or slot names exist in<br />
any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions to reserve in the string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
specifies one of the following trimming actions for leading or trailing spaces:<br />
-1 Left trim<br />
0 Left and right trim<br />
1 Right trim<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The statement converts param and returns a string.<br />
■ If width is a positive number that specifies more positions than are<br />
needed to hold the conversion, param is right-justified in the string and<br />
padded with spaces on the left.<br />
■ If width is a negative number and specifies more positions than are<br />
needed to hold the conversion, param is left-justified in the string and<br />
padded with spaces on the right.<br />
■ Trimming occurs before formatting. If you specify zero width along with<br />
the trim format, enough space is reserved for the result of the trim<br />
operation.
Str (with strings)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
String specification Type Value Result<br />
str (tim_val:8) Time 23:30:02.01 '23:30:02'<br />
str (str_val:8) String 'red' ' red'<br />
str (str_val:-8) String 'red' 'red '<br />
str (str_val:2) String 'red' 're'<br />
str (str_val:-2) String 'red' 're'<br />
str (str_val:0:0) String ' red ' 'red'<br />
str (str_val:0:1) String ' red ' ' red'<br />
str (str_val:0:-1) String ' red ' 'red '<br />
str (str_val:2:0) String ' red ' 're'<br />
str (str_val:2) String ' red ' ' '<br />
str (str_val:-8:-1) String ' red ' 'red '<br />
str (str_val:8:-1) String ' red ' ' red '<br />
str (str_val:8:1) String ' red ' ' red'<br />
KDL Statement Syntax 4-235
Substring<br />
Substring<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-236 <strong>Language</strong> <strong>Reference</strong><br />
Use SUBSTRING to return a substring from a string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
SUBSTRING (str, start [, len])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
str<br />
is a string expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
start<br />
is the position in the string from which copying starts.<br />
.........................................................................................................................................................................................................˝..........................................<br />
len<br />
is the number of characters to be copied from the string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
If you do not specify len, the substring contains the characters from start to<br />
the end of the string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
string1 = substring (long_str,1,10)<br />
Examples<br />
string2 = substring (long_str,11)
Time<br />
Time<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use TIME to convert a string into the number of one hundredth seconds since<br />
midnight.<br />
.........................................................................................................................................................................................................˝..........................................<br />
TIME (str)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
str<br />
is a string that contains the time.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The complete format for str is as follows:<br />
'HH:MM:SS.hh'<br />
where HH is the hour, MM is the minute, SS is the second, and hh is<br />
the hundredth second.<br />
■ You do not have to specify the complete format. For example, '12' is<br />
exactly twelve o’clock, and '12:30' is twelve thirty and no seconds.<br />
■ You can use the TIME function in a constraint.<br />
.........................................................................................................................................................................................................˝..........................................<br />
time ('09:10:43.86')<br />
Examples<br />
time ('10:10:10')<br />
time ('00:01')<br />
time ('23')<br />
time (currenttime)<br />
.........................................................................................................................................................................................................˝..........................................<br />
DATE<br />
See also<br />
KDL Statement Syntax 4-237
Trunc<br />
Trunc<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-238 <strong>Language</strong> <strong>Reference</strong><br />
Use TRUNC to truncate a numeric expression to an integer.<br />
.........................................................................................................................................................................................................˝..........................................<br />
TRUNC (nexpr)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
nexpr<br />
is a numeric expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
The fractional part of nexpr is dropped, leaving a whole number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement rounds PRICE to the nearest whole number:<br />
rounded_price = trunc (price +.5)<br />
For example, if price is 4.3, the TRUNC of PRICE+.5 is 4. If price is 4.8, the<br />
TRUNC of PRICE+.5 is 5.<br />
.........................................................................................................................................................................................................˝..........................................<br />
ROUND<br />
See also
Union<br />
Union<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use UNION to find all elements in two or more sets.<br />
.........................................................................................................................................................................................................˝..........................................<br />
UNION (sexpr, sexpr [, sexpr])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
sexpr<br />
is a set expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ No duplicates are contained in the result.<br />
■ From all matching elements, the most positive certainty factor is<br />
associated with the resulting certainty set element.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
common_err is union (instruction_errors,<br />
bad_interpretation,<br />
stupid_mistakes)<br />
KDL Statement Syntax 4-239
Unknown<br />
Unknown<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-240 <strong>Language</strong> <strong>Reference</strong><br />
Use UNKNOWN to test whether a parameter or slot has a known value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
{[IS | ARE | =] [NOT | ] UNKNOWN} | {INCLUDES UNKNOWN}<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You can only use the IS UNKNOWN format to test a parameter in a<br />
condition, such as the premise of a rule.<br />
■ If you test a non-structured parameter for IS UNKNOWN, such as an<br />
integer or string, the condition is TRUE if the parameter is processed with<br />
no value or the certainty factor for the parameter is between -0.2 and<br />
+0.2.<br />
■ If you test an empty list or set for IS UNKNOWN, the condition is TRUE.<br />
A list or set is empty if no elements are assigned.<br />
■ If you test a structured parameter, such as a set or record, all elements or<br />
fields must be processed with no value or the certainty factor for each<br />
element or field must be between -0.2 and +0.2 for the condition to be<br />
TRUE. If any elements or fields contain a known value, the condition is<br />
FALSE.<br />
■ You can only use INCLUDES UNKNOWN with lists, sets, or records.<br />
■ If you test an empty set or list for INCLUDES UNKNOWN, the condition<br />
is TRUE.<br />
■ If you test for INCLUDES UNKNOWN and any element or field is<br />
processed with no value or the certainty factor for the element or field is<br />
between -0.2 and +0.2, the condition is TRUE. If all elements or fields<br />
contain known values, the condition is FALSE.<br />
■ If you use UNKNOWN, the inference engine may backward chain to<br />
determine the object’s value, unless it has already processed the object.<br />
To prevent backward chaining when testing for unknown, use<br />
CURRENTVALUE instead.
■ If you use CLEAR with the SOURCING option, the object becomes<br />
UNKNOWN.<br />
Unknown<br />
■ If you delete an instance via a pointer, the pointer becomes UNKNOWN.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
if currentvalue(interest_rate) is unknown then<br />
process(get_irate)<br />
end<br />
if credit_rec includes unknown then<br />
process(get_missing_values)<br />
end<br />
KDL Statement Syntax 4-241
With<br />
With<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-242 <strong>Language</strong> <strong>Reference</strong><br />
Use WITH to change the certainty factor for the premise of a rule or to set the<br />
certainty factor when you add an element to a certainty set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Format 1 Syntax<br />
The WITH statement has two formats. Set the certainty factor for a premise:<br />
bexpr1 WITH bexpr2<br />
.........................................................................................................................................................................................................˝..........................................<br />
bexpr1<br />
is a Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
bexpr2<br />
is a certainty factor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Format 2 Syntax<br />
Set the certainty factor for an element of a certainty set:<br />
WITH bexpr2<br />
.........................................................................................................................................................................................................˝..........................................<br />
bexpr2<br />
is a certainty factor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
In Format 1, bexpr2 specifies the certainty factor to use when you test bexpr1.<br />
If bexpr1 is less than bexpr2, the premise evaluates to FALSE with a certainty<br />
factor of -1.0.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
if roi > .15 with cf(0.7) then<br />
add project to high_pri with cf(0.4)<br />
end
WriteStr<br />
WriteStr<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use WRITESTR to copy the contents of fields, parameters, or slots into a file<br />
buffer or string parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
WRITESTR (buffer, [library::]index, [library::]source [,<br />
[library::]source])<br />
.........................................................................................................................................................................................................˝..........................................<br />
buffer<br />
is a string or a record that contains a single string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter, slot, or instance<br />
exists. The library name is only required when duplicate parameter, slot, or<br />
instance names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
index<br />
is an integer parameter or constant.<br />
.........................................................................................................................................................................................................˝..........................................<br />
source<br />
is a record, instance, record field, parameter or slot.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Variant records are records from an external file with fields that vary<br />
depending upon the type of record. The record type is stored in the same<br />
position of each record.<br />
■ WRITESTR copies source to buffer. The size of the base type for source<br />
controls the number of bytes transferred.<br />
■ index specifies the beginning location for placement of the data in buffer.<br />
The first location in buffer is 1.<br />
KDL Statement Syntax 4-243
WriteStr<br />
4-244 <strong>Language</strong> <strong>Reference</strong><br />
■ WRITESTR returns the starting position in buffer of the next available<br />
location. If you want to fill buffer sequentially, you can use the return<br />
value to set index, which starts placement of data at that location.<br />
■ <strong>AionDS</strong> does not backward chain for source.<br />
■ WRITESTR can be used for coercing any data type into a string. This can<br />
be useful in setting up hexadecimal or ASCII data in a knowledge base.<br />
■ When the buffer is longer than the source and you specify an index before<br />
the end of the buffer, the source is appended to the buffer at the index<br />
point and the rest of the buffer is deleted.<br />
■ Specify the NOTRIM attribute for strings that contain NULL values<br />
before other valid values; otherwise the strings are truncated incorrectly.<br />
By default, <strong>AionDS</strong> terminates input strings at the first NULL value<br />
encountered. When the NOTRIM attribute is used, the string is not<br />
truncated at any NULL value. Also, all leading and trailing blanks are<br />
preserved. Because all leading and trailing blanks are preserved, you<br />
might need to increase the buffer size to accommodate the resulting<br />
string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following example:<br />
openfile(f,'instance.dat','append')<br />
format = 1<br />
for class(class1),class1_ptr<br />
writestr(f->.data,1,format)<br />
writestr(f->.data,3,class1_ptr->)<br />
putrec(f)<br />
end<br />
format = 2<br />
for class(class2),class2_ptr<br />
writestr(f->.data,1,format)<br />
writestr(f->.data,3,class2_ptr->)<br />
putrec(f)<br />
end<br />
closefile(f)<br />
The base type for F and FORMAT are as follows:<br />
F FORMAT<br />
file of record(noattr) integer(noattr,2)<br />
data is string(22)<br />
end
WriteStr<br />
The base types of the slots can be anything as long as the total size does not<br />
exceed 20 bytes, which is the size remaining in DATA starting in position 3.<br />
In this example, instances do not contain a FORMAT code. The FORMAT is<br />
placed in the buffer starting at position 1. For each instance, The instance is<br />
placed in the buffer starting at position 3. Pointers are used to refer to the<br />
instances.<br />
Consider the following example that moves binary zeros into the string<br />
parameter LOW-VALUES:<br />
bin_zero = o<br />
writestr(low_values,1,bin_zero)<br />
The base type for the parameters are as follows:<br />
LOW-VALUES BIN_ZERO<br />
string integer(2, noattr)<br />
The WRITESTR command coerces the integer formatted as a binary 2-byte<br />
number into the LOW-VALUES string. The resulting value of LOW-VALUES is<br />
X'0000' (that is, 2 bytes of binary zeros).<br />
.........................................................................................................................................................................................................˝..........................................<br />
READSTR<br />
See also<br />
KDL Statement Syntax 4-245
XOR<br />
XOR<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
4-246 <strong>Language</strong> <strong>Reference</strong><br />
Use XOR to return the logical EXCLUSIVE OR of two Boolean expressions<br />
or bitwise EXCLUSIVE OR of two integer expressions.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr1 XOR expr2<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr1<br />
is an integer or Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr<br />
is an integer or Boolean expression.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ Both expressions must be the same type.<br />
■ If the expressions are integers, <strong>AionDS</strong> executes a bitwise comparison to<br />
test each bit of expr1 against the corresponding bit in expr2.<br />
.........................................................................................................................................................................................................˝..........................................<br />
value xor switch<br />
Example<br />
.........................................................................................................................................................................................................˝..........................................<br />
AND, BIN, HEX, OR<br />
See also
KDL syntax summary by data type<br />
KDL syntax summary by data type<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
The following sections summarize KDL statements by the data types or<br />
objects that you can use with the statements:<br />
■ Numeric, string, Boolean, date, and time data types<br />
■ Integers and reals<br />
■ Strings<br />
■ Booleans<br />
■ Dates and times<br />
■ Lists<br />
■ Sets<br />
■ Certainty sets<br />
KDL Statement Syntax 4-247
KDL syntax summary by data type<br />
Numeric, string, Boolean, date, and time data types<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
4-248 <strong>Language</strong> <strong>Reference</strong><br />
The following statements can be used with numeric, string, Boolean, date,<br />
and time data types.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr = expr<br />
Comparison<br />
operations<br />
expr IS expr<br />
expr expr<br />
expr IS NOT expr<br />
expr ARE NOT expr<br />
.........................................................................................................................................................................................................˝..........................................<br />
param = val_ref<br />
Assignment<br />
operations<br />
param IS val_ref<br />
param ARE val_ref<br />
.........................................................................................................................................................................................................˝..........................................<br />
param = UNKNOWN<br />
Test for unknown<br />
param IS UNKNOWN<br />
param ARE UNKNOWN<br />
param UNKNOWN<br />
param IS NOT UNKNOWN<br />
param ARE NOT UNKNOWN
Integers and reals<br />
KDL syntax summary by data type<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
The following statements can be used with numeric parameters or slots.<br />
.........................................................................................................................................................................................................˝..........................................<br />
param > nexpr<br />
Constraint<br />
operations<br />
param >= nexpr<br />
param < nexpr<br />
param nexpr<br />
More comparison<br />
operations<br />
nexpr >= nexpr<br />
nexpr < nexpr<br />
nexpr
KDL syntax summary by data type<br />
.........................................................................................................................................................................................................˝..........................................<br />
ABS (nexpr)<br />
Numeric functions<br />
4-250 <strong>Language</strong> <strong>Reference</strong><br />
ARCTAN (nexpr)<br />
COS (nexpr)<br />
DATE (INTEGER,day,month,year)<br />
EXP (nexpr)<br />
LN (nexpr)<br />
MAX (nexpr, nexpr [, nexpr ...])<br />
MIN (nexpr,nexpr [, nexpr ...])<br />
ROUND (nexpr)<br />
SIN (nexpr)<br />
SQR (nexpr)<br />
SQRT (nexpr)<br />
STR ([library::]number [:width [:right]])<br />
STR ([library::]number [:width [:base]])<br />
TRUNC (nexp)
Strings<br />
KDL syntax summary by data type<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
The following statements can be used with string parameters or slots.<br />
.........................................................................................................................................................................................................˝..........................................<br />
param IS FROM (stexpr, stexpr [,strexpr ...])<br />
Constraint<br />
operations<br />
param ARE FROM (stexpr, stexpr [,strexpr...])<br />
param IS NOT FROM (stexpr, stexpr [,strexpr...])<br />
param ARE NOT FROM (stexpr, stexpr [,strexpr...])<br />
.........................................................................................................................................................................................................˝..........................................<br />
strexpr > strexpr<br />
More comparison<br />
operations<br />
strexpr >= strexpr<br />
strexpr < strexpr<br />
strexpr
KDL syntax summary by data type<br />
Booleans<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
4-252 <strong>Language</strong> <strong>Reference</strong><br />
The following statements can be used with Boolean parameters and slots.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr > expr<br />
More comparison<br />
operations<br />
expr >= expr<br />
expr < expr<br />
expr
Dates and times<br />
KDL syntax summary by data type<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
The following statements can be used with dates and times.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr > expr<br />
More comparison<br />
operations<br />
expr >= expr<br />
expr < expr<br />
expr
KDL syntax summary by data type<br />
Lists<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
4-254 <strong>Language</strong> <strong>Reference</strong><br />
The following statements can be used with list parameters or slots.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr INCLUDES element<br />
More comparison<br />
operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
ADD item TO [library::]param<br />
More assignment<br />
operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
APPEND (target, lexpr [, lexpr ...])<br />
List operations<br />
ASORT (expr [ON key])<br />
DELETE (param,index)<br />
DSORT (expr [ON key])<br />
FIRST num OF lexpr<br />
INDEX (expr1 expr2 [, iexpr])<br />
LAST num OF lexpr<br />
SIZE (expr)<br />
param(nexpr) identifies an element in a list.
Sets<br />
KDL syntax summary by data type<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
The following statements can be used with set parameters.<br />
.........................................................................................................................................................................................................˝..........................................<br />
More comparison<br />
operations<br />
expr INCLUDES element<br />
.........................................................................................................................................................................................................˝..........................................<br />
ADD item TO [library::]param<br />
More assignment<br />
operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
ASORT (expr [ON key])<br />
Set operations<br />
DELETE (param,index)<br />
DIFFERENCE (set_expr, set_expr [, set_expr] ...)<br />
DSORT (expr [ON key])<br />
INDEX (expr1 expr2 [, iexpr])<br />
INTERSECTION (sexpr, sexpr [, sexpr])<br />
SIZE (expr)<br />
UNION (sexpr, sexpr [, sexpr])<br />
param(nexpr) identifies an element in a set.<br />
KDL Statement Syntax 4-255
KDL syntax summary by data type<br />
Certainty sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
4-256 <strong>Language</strong> <strong>Reference</strong><br />
The following statements can be used with certainty sets.<br />
.........................................................................................................................................................................................................˝..........................................<br />
expr INCLUDES element<br />
More comparison<br />
operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
ADD item TO param [WITH CF(val)]<br />
More assignment<br />
operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
CF([cert_no * ] AES_CF)<br />
Certainty operations<br />
CF(nexpr)<br />
CERTAINTY (bexpr)<br />
CSORT (csexpr)<br />
bexpr1 WITH bexpr2<br />
WITH bexpr2<br />
param(nexpr) identifies an element in a certainty set.
Summary of additional KDL statement syntax<br />
Summary of additional KDL statement syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
The following sections summarize the KDL syntax:<br />
■ Control statements<br />
■ Agenda statements<br />
■ Object processing statements<br />
■ Consultation monitor statements<br />
■ AES statements<br />
■ Other statements<br />
KDL Statement Syntax 4-257
Summary of additional KDL statement syntax<br />
Control statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Summary<br />
ASK ([library::]param | inst_ref | [inst_ref.]slot |<br />
CLASS([library::]classname) | CURRENTCLASS [,s_option])<br />
4-258 <strong>Language</strong> <strong>Reference</strong><br />
BESTVALUE (expr)<br />
BREAK<br />
BREAKIF bool_expr<br />
dest = source BYNAME<br />
CLEAR ([library::]param | inst_ref | [inst_ref.]slot [,<br />
CONSTRAINT | SOURCING])<br />
CURRENTVALUE (expr)<br />
EXITSTATE [(state)]<br />
FINALVALUE (expr)<br />
FOR param = low_val TO high_val stmts END<br />
FOR expr, param stmts END<br />
FOR expr stmts END<br />
FOR [CLASS ([library::]classname) | CURRENTCLASS], cl_param<br />
stmts END<br />
FORWARDCHAIN [([ORDERBY (sequence, ...)] [, STOPWHEN<br />
(condition)])]<br />
IF condition THEN stmts [ELSEIF condition THEN stmts ... ]<br />
[ELSE stmts] [END]<br />
LOOP stmts END<br />
RETURN [(arg)]<br />
SOURCEVALUE (expr)
Agenda statements<br />
Summary of additional KDL statement syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
FUNCTION (name [, option])<br />
Summary<br />
GRAPH (name [, option ...])<br />
GROUP (name [, option ...])<br />
MESSAGE (name [, option ...])<br />
PARAMETER ([library::]name [, option ...])<br />
PROCESS (name [, option ...])<br />
REPORT (name [, option ...])<br />
SLOT ([library::]name [, option ...])<br />
STATE [(name [, option])]<br />
KDL Statement Syntax 4-259
Summary of additional KDL statement syntax<br />
Object processing statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Summary<br />
ASORT (lexpr | CLASS([library::]classname) | CURRENTCLASS<br />
[ON prop [, prop ... ]])<br />
4-260 <strong>Language</strong> <strong>Reference</strong><br />
CREATE(CLASS([library::]classname) | CURRENTCLASS |<br />
[library::]classname [,instance [WITH assertion<br />
[, assertion ...]]])<br />
DELETE([library::]classname[(inst_id)] | pointer-> |<br />
CURRENT)<br />
DSORT (lexpr | CLASS([library::]classname) | CURRENTCLASS<br />
[ON prop [, prop ... ]])<br />
EXISTS (CLASS([library::]classname) | CURRENTCLASS |<br />
[library::]classname [WITH bool_expr])<br />
IFMATCH [library::]classname1 WITH boolexpr<br />
....<br />
[library::]classnameN WITH boolexpr<br />
[[library::]classname1, [...,] [library::]classnameN<br />
with boolexpr]<br />
[[NOT] EXISTS ([library::]classname |<br />
CLASS([library::]classname)<br />
WITH boolexpr)<br />
[ORDERBY (intexpr)]<br />
THEN<br />
actions<br />
[END]<br />
NAMEOF([library::]classname[(inst_id)] | pointer-> |<br />
CURRENT)<br />
SELECTALL (CLASS([library::]classname) | CURRENTCLASS<br />
[WITH bool_expr])<br />
SELECTONE (CLASS([library::]classname) | CURRENTCLASS<br />
[WITH bool_expr])<br />
SEND (method TO CLASS([library::]classname) | CURRENTCLASS<br />
[WITH valuelist])<br />
SEND (method TO [library::]classname[(inst_id)] | pointer-><br />
| CURRENT | inst_nm [WITH valuelist])<br />
SEND (method UP [WITH valuelist])
Consultation monitor statements<br />
Summary of additional KDL statement syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
CM(ADD, [library::]type(name) [, append])<br />
Summary<br />
CM(BEEP)<br />
CM(DELETE, [library::]type(name))<br />
CM(ERROR, handle, err_str, [beep])<br />
CM(GETCOORDINATES, row [, col])<br />
CM(GETCURSOR, handle [, row[, col]])<br />
CM(GETDIMENSIONS, handle, height, width)<br />
CM(GETINFO, handle, name [, window[, part]])<br />
CM(GETOUTLINECOLOR, handle, char [, cell [, bright<br />
[, blink]]])<br />
CM(GETPOSITION, handle, row, col)<br />
CM(GETSTATUS, handle, status, [err_str])<br />
CM(GETTEXT, handle, text)<br />
CM(GETTEXTCOLOR, handle, char [, cell [, bright [, blink]]])<br />
CM(GETTITLECOLOR, handle, char [, cell [, bright<br />
[, blink]]])<br />
CM(GETTITLEPOSITION, handle, row, col)<br />
CM(GETWINDOW, handle, type(name) [, window [, part]])<br />
CM(GETWINDOWLIST, handle_list [, window])<br />
CM(GETWORD, word)<br />
CM(POPUP, [library::]type(name))<br />
CM(SETCURSOR, handle [, row [, col]])<br />
CM(SETDIMENSIONS, handle, height, width)<br />
KDL Statement Syntax 4-261
Summary of additional KDL statement syntax<br />
4-262 <strong>Language</strong> <strong>Reference</strong><br />
CM(SETOUTLINECOLOR, handle, char [, cell [, bright<br />
[, blink]]])<br />
CM(SETPOSITION, handle, row, col)<br />
CM(SETTEXTCOLOR, handle, char [, cell [, bright [, blink]]])<br />
CM(SETTITLECOLOR, handle, char [, cell [, bright<br />
[, blink]]])<br />
CM(SETTITLEPOSITION, handle, row, col)<br />
CM(SYSTEM, function)
AES statements<br />
Summary of additional KDL statement syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
AES (ABORT [, bool_expr])<br />
Summary<br />
AES (BREAK [, bool_expr])<br />
AES (CHAIN, chain_var [, bool_expr])<br />
AES (ERROR, error_no [, bool_expr])<br />
AES (EXITCODE, exitcode [, bool_expr])<br />
AES (PROFILE, option, value [, bool_expr])<br />
AES (TITLE, title [, bool_expr])<br />
AES (TRACELEVEL [, trace_lev [, bool_expr]])<br />
AES (WRITELOG, ret_code, output_str [, bool_expr])<br />
AES (WRITETRACE, trace_str [, bool_expr])<br />
KDL Statement Syntax 4-263
Summary of additional KDL statement syntax<br />
Other statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
/* comment */<br />
Summary<br />
4-264 <strong>Language</strong> <strong>Reference</strong><br />
DBMS (option, CLASS([library::]classname) | CURRENTCLASS |<br />
[library::]classname)<br />
READSTR (buffer, [library::]index, [library::]dest<br />
[, [library::]dest])<br />
SET (obj_type([library::]obj_name),prop(value))<br />
WRITESTR (buffer, [library::]index, [library::]source<br />
[, [library::]source])
Chapter 5<br />
Text Substitution <strong>Language</strong><br />
.........................................................................................................................................................................................................˝..........................................<br />
Introduction<br />
Use the Text Substitution <strong>Language</strong> (TSL) to display text during a<br />
consultation. TSL provides formatting commands to control the appearance<br />
of text you display. For example, you can set margins and center text. TSL<br />
can also include parameter and slot values and instance names in your text.<br />
In character-based <strong>AionDS</strong>, you can use the PREVIEW command to see how<br />
your TSL text will look when it is presented to the user. This command<br />
generates sample TSL output which <strong>AionDS</strong> displays in the Preview Monitor.<br />
For more information: See the <strong>AionDS</strong> User’s <strong>Guide</strong> (Character-Based) for<br />
information on previewing TSL at edit time.<br />
.........................................................................................................................................................................................................˝..........................................<br />
In this chapter<br />
Topic Page<br />
Properties that accept TSL 5-2<br />
Displaying plain text 5-4<br />
Displaying simple parameter and slot values 5-5<br />
Displaying slot values 5-29<br />
Displaying values from multiple instances 5-31<br />
Displaying pointer values 5-34<br />
Displaying lists and sets 5-40<br />
Displaying records 5-49<br />
Using functions in TSL 5-52<br />
Sending messages to classes and instances from TSL 5-55<br />
Setting up uniform defaults and headers 5-60<br />
Summary of TSL substitution 5-62<br />
Text Substitution <strong>Language</strong> 5-1
Properties that accept TSL<br />
Properties that accept TSL<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of properties<br />
5-2 <strong>Language</strong> <strong>Reference</strong><br />
The following properties use the formatting and substitution capabilities of<br />
TSL.<br />
Property Found in<br />
Constraint Parameters and Slots<br />
Description Displays, Functions, Graphs, Groups, Messages,<br />
Parameters, Processes, Reports, Rules, Slots, and States<br />
Explain Messages, Parameters, and Slots<br />
Footer Reports<br />
Heading Graphs<br />
Message Text Messages<br />
Prompt Parameters and Slots<br />
Report Text Reports<br />
Sub-Heading Graphs<br />
Text Screen Editor, Window Properties Editor<br />
Title Reports, Window Properties Editor<br />
.........................................................................................................................................................................................................˝..........................................<br />
The WindowObject<br />
class hierarchy<br />
You can also use TSL in the titles and descriptive text for certain user<br />
interface objects in the WindowObject class hierarchy. The WindowObject<br />
class hierarchy is used to build graphical knowledge bases. The following<br />
table lists the classes and slots that accept TSL.<br />
Except for the TextWindow’s Text slot, you cannot specify TSL commands<br />
used to format multiple lines (such as &BR (line break) and &SK (skip lines))<br />
in these windows’ slots, because the text can be displayed only on a single<br />
line. To use TSL to format multiple lines in the TextWindow, you must<br />
select the Mult-Line style.
Class Slot<br />
CheckBox Text<br />
DialogBox Title<br />
GroupBox Title<br />
RadioButton Text<br />
StandardWindow Title<br />
TextWindow Text<br />
Properties that accept TSL<br />
Text Substitution <strong>Language</strong> 5-3
Displaying plain text<br />
Displaying plain text<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
5-4 <strong>Language</strong> <strong>Reference</strong><br />
If you do not use any TSL commands, <strong>AionDS</strong> formats text to appear exactly<br />
as it appears in the property of an object. For example, the following string<br />
in the Prompt property of a parameter displays exactly as it appears in the<br />
property window:<br />
What is the amount of the purchase?<br />
You can use TSL commands to specify formatting such as filled or justified<br />
paragraphs, margins, tabs, indents, tables, and page headers and footers.<br />
For more information: See Chapter 6, “TSL Commands,” regarding TSL<br />
commands.
Displaying simple parameter and slot values<br />
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Specifying object<br />
name<br />
In TSL, you specify substitution of a parameter or slot name with its value by<br />
placing a percent sign ( % ) in front of the name. For example, you can<br />
display the value of CREDIT_LIMIT in the following manner:<br />
The new credit limit is %credit_limit.<br />
The statement above uses the default format to display CREDIT_LIMIT. The<br />
default format for the value depends upon the data type of the parameter.<br />
For example, if the data type of the parameter is real, TSL displays the value<br />
with two places after the decimal point and a comma every three digits to the<br />
left of the decimal point as illustrated below:<br />
The new credit limit is 12,000.00.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Unknown values<br />
If CREDIT_LIMIT is UNKNOWN, TSL substitutes the word UNKNOWN,<br />
regardless of the data type for the parameter or slot:<br />
The new credit limit is Unknown.<br />
Tip: You can specify a different string for unknown values using the TSL<br />
command &UND.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default formatting<br />
In default substitution, all values are left justified, and all values except dates<br />
and times are displayed without any surrounding spaces. Dates and times<br />
have a single space on the left if the day or hour is only one digit (1-9).<br />
You can change the format of a value either by specifying a new default for its<br />
data type or by using specific formatting instructions for the individual value.<br />
See the following sections for specific information about the default formats<br />
for particular data types.<br />
Text Substitution <strong>Language</strong> 5-5
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying a colon<br />
5-6 <strong>Language</strong> <strong>Reference</strong><br />
TSL uses the colon ( : ) in formatted substitution. If you want to display a<br />
colon, you must precede it with the ampersand ( & ). The following example<br />
prints a colon after the value for CUST_NO:<br />
Credit limit for %cust_no&: %credit_limit<br />
.........................................................................................................................................................................................................˝..........................................<br />
Using predefined<br />
parameters<br />
Note that you can also display the values of <strong>AionDS</strong> predefined parameters,<br />
such as AES_TITLE. You display these parameters using the percent sign,<br />
exactly as you would display parameters you define in your knowledge base.<br />
For more information: For more information about predefined<br />
parameters, see the <strong>AionDS</strong> General <strong>Reference</strong>.
Associating text with parameters and slots<br />
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Using plain text<br />
You can associate text with a parameter or slot in two ways. One way is to<br />
surround the parameter or slot with the text that you want to associate with<br />
the parameter or slot. Consider the following TSL statements:<br />
Old credit limit: %old_limit:10:2 %last_update:11<br />
Amount of purchase: %new_purchase:10:2<br />
New credit limit: %credit_limit:10:2<br />
The statements result in the following message:<br />
Old credit limit: 10000.00 1-Jan-1990<br />
Amount of purchase: 500.00<br />
New credit limit: 12000.00<br />
.........................................................................................................................................................................................................˝..........................................<br />
Using angle brackets<br />
The other way is to identify the parameter or slot, enclose the text in angle<br />
brackets ( < > ), and use the percent sign ( % ) to indicate placement of the<br />
parameter or slot value. The following examples show this format:<br />
%old_limit %last_update<br />
<br />
%new_purchase <br />
%credit_limit <br />
The output is exactly the same as the first method. The percent sign ( % )<br />
inside the angle brackets causes substitution of the parameter to the left of the<br />
angle brackets. The number of spaces between the parameter or slot name<br />
and the opening angle bracket is irrelevant. The spacing inside a pair of angle<br />
brackets, however, controls positioning of the text.<br />
The formatting of a parameter or slot is associated with the percent sign<br />
inside the angle brackets. If no formatting commands are associated with the<br />
percent sign, TSL uses the default format for the data type.<br />
Text Substitution <strong>Language</strong> 5-7
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Nesting inside<br />
brackets<br />
5-8 <strong>Language</strong> <strong>Reference</strong><br />
The TSL inside the angle brackets can contain other parameters or slots. For<br />
example, you can use the following TSL text to display the values for<br />
OLD_LIMIT and LAST_UPDATE together.<br />
%old_limit<br />
If you want to display a parameter or slot value more than once, you can<br />
repeat the percent sign within the angle brackets. For example, the following<br />
TSL statement displays the date on the left and right sides of a message:<br />
%last_update<br />
The angle bracket format is especially useful with Boolean or structured<br />
parameters or slots.
String values<br />
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default format<br />
The default format for displaying string values is to display the string without<br />
formatting and without any surrounding spaces. For example, if<br />
CUST_NAME is a string parameter that contains the value MARGARET<br />
MCAFEE, the following statement:<br />
Account summary for %cust_name.<br />
produces the result:<br />
Account summary for Margaret McAfee.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Changing the format<br />
You may specify a different format using the following syntax.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions for the display.<br />
Text Substitution <strong>Language</strong> 5-9
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
5-10 <strong>Language</strong> <strong>Reference</strong><br />
■ The minus sign ( - ) in front of width specifies left justification of the<br />
parameter value. Right justification is the default.<br />
■ If the value can be displayed in less space than width positions, the value<br />
is padded with blanks. Padding occurs on the left when you use right<br />
justification, and on the right when you use left justification.<br />
■ If the value cannot be displayed in width positions, it is truncated on the<br />
right to display within width characters.<br />
■ If width is 0, TSL uses the default substitution format with no<br />
surrounding spaces.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In the following examples, the delta symbol ( ) represents a blank space.<br />
TSL Parameter value Display<br />
%cust_name:9 <strong>AionDS</strong> <strong>AionDS</strong><br />
%cust_name:-9 <strong>AionDS</strong> <strong>AionDS</strong><br />
%cust_name:9 Aion Development System Aion Deve
Integer values<br />
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default format<br />
For integer values, the default format is to display the number without<br />
formatting. For example, if CREDIT_LIMIT is an integer parameter with the<br />
value 12,000, the following statement:<br />
The new credit limit is %credit_limit.<br />
produces the result:<br />
The new credit limit is 12000.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Changing the format You can specify the format for an individual parameter using one of the two<br />
following syntaxes. You can change the default format for all integer values<br />
within a property by using the TSL command &IDF.<br />
For more information: See Chapter 6, “TSL Commands,” for information<br />
about this command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
Syntax 1<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions for the display.<br />
Text Substitution <strong>Language</strong> 5-11
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
5-12 <strong>Language</strong> <strong>Reference</strong><br />
■ The minus sign ( - ) in front of width specifies left justification of the<br />
parameter value. Right justification is the default.<br />
■ If the value can be displayed in less space than width positions, the value<br />
is padded with blanks. Padding occurs on the left when you use right<br />
justification, and on the right when you use left justification.<br />
■ If the value cannot be displayed in width positions, the number displays<br />
in as many positions as required for the display.<br />
■ If width is 0, TSL uses the default substitution format, specifically, left<br />
justified without any surrounding spaces.<br />
■ Because of the similar syntax for displaying integers in hexadecimal or<br />
binary format, if you want to display a colon after an integer substitution,<br />
you must use the &: command. For example, the following TSL<br />
statement prints the value of CUST_NO in the default format, followed by<br />
a colon and the number 16.<br />
%cust_no:0&:16<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In the following examples, the delta symbol ( ) represents a blank space.<br />
TSL Parameter value Display<br />
%cust_no:10 1000 1000<br />
%cust_no:-10 1000 1000<br />
%cust_no:10 -1000 -1000<br />
%cust_no:-10 -1000 -1000<br />
%cust_no:2 1000 1000<br />
%cust_no:4&:16 1000 1000:16<br />
.........................................................................................................................................................................................................˝..........................................<br />
%param:'mask'[:'mask']<br />
Syntax 2<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
mask<br />
is a valid mask for integers.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The first mask specifies the mask for positive numbers.<br />
■ The second, optional mask specifies the mask for negative numbers. If no<br />
second mask is specified, the negative mask defaults to be the same as the<br />
positive mask, except that a minus sign is substituted for the first<br />
character.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Displaying numbers in hexadecimal and binary<br />
The first example below shows a five-digit integer mask that displays a zero if<br />
there is no digit in the ones place and blank spaces if there are no digits in<br />
any other place. The second example uses the same mask for a negative<br />
number. The third example is a mask for hexadecimal digits. The delta<br />
symbol ( in the third column represents a blank space.<br />
TSL Parameter value Display<br />
%cust_no:'99990' 1000 1000<br />
%cust_no:'99990' -1000 -1000<br />
%acct_id:'HHHH' FFFFFABC hex FABC<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can display integer values in hexadecimal or binary format using either<br />
Syntax 2 above or the following syntax.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:width:nfmt<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
Text Substitution <strong>Language</strong> 5-13
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
5-14 <strong>Language</strong> <strong>Reference</strong><br />
is the name of the parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions for the display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
nfmt<br />
is one of the following constants:<br />
2 specifies a binary display.<br />
10 specifies a decimal display.<br />
16 specifies a hexadecimal display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you specify numeric base, including decimal, the display is right<br />
justified and filled with leading zeros.<br />
■ If you want to display a colon immediately after an integer parameter,<br />
you must precede the colon with an ampersand (&). For example, the<br />
following statement prints a colon after the value of the parameter INT.<br />
%int:0&:<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
TSL Parameter value Display<br />
%int:4:16 1961 07A9<br />
%int:0:2 1961 11110101001<br />
%int:4&:16 1961 1961:16
Real values<br />
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default format<br />
For real number values, the default format is to display the number with a<br />
decimal point, two digits to the right of the decimal point, and a comma<br />
every three digits to the left of the decimal point. For example, if<br />
CREDIT_LIMIT is a real parameter with the value 12,000, the following<br />
statement:<br />
The new credit limit is %credit_limit.<br />
produces the result:<br />
The new credit limit is 12,000.00.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Changing the format You can change the default format for all real values within a property of a<br />
display object. You do this with the TSL command &RDF.<br />
For more information: See Chapter 6, “TSL Commands,” about this<br />
command.<br />
You can specify the format for an individual parameter using one of the two<br />
following syntaxes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width[:precision]<br />
Syntax 1<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.<br />
Text Substitution <strong>Language</strong> 5-15
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
5-16 <strong>Language</strong> <strong>Reference</strong><br />
is the number of positions for the display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
precision<br />
is the number of digits to the right of the decimal point.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The minus sign ( - ) in front of width specifies left justification of the<br />
parameter value. Right justification is the default.<br />
■ If you specify precision, the number is formatted in fixed point notation<br />
without commas, such as 1000.00.<br />
■ If you do not specify precision, the number is formatted in exponential<br />
notation, in at least nine character positions, as shown in the following<br />
example:<br />
9.9E±999<br />
The delta ( ) is a blank that is reserved for the sign of a negative<br />
number. The exponent is always represented in three digits.<br />
■ If the value can be displayed in less space than width positions, the value<br />
is padded with blanks. Padding occurs on the left when you use right<br />
justification, and on the right when you use left justification.<br />
■ If the value cannot be displayed in width positions, the number displays<br />
in as many positions as required for the display.<br />
■ If width is 0, TSL uses the default substitution format: a decimal point,<br />
two digits to the right of the decimal point, and a comma every three<br />
digits to the left of the decimal point.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In the following examples, the delta symbol ( ) represents a blank space.<br />
TSL Parameter value Display<br />
%credit_limit:10 1000 1.00E+003<br />
%credit_limit:10 -1000 -1.00E+003<br />
%credit_limit:10:2 -1000 -1000.00<br />
%credit_limit:6:2 -1000 -1000.00
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:'mask'[:'mask']<br />
Syntax 2<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
mask<br />
is a valid mask for reals.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The first mask specifies the mask for positive numbers.<br />
■ The second, optional mask specifies the mask for negative numbers. If no<br />
second mask is specified, the negative mask defaults to be the same as the<br />
positive mask, except that a minus sign is substituted for the first<br />
character.<br />
Text Substitution <strong>Language</strong> 5-17
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
5-18 <strong>Language</strong> <strong>Reference</strong><br />
The following examples specify masks for both positive and negative<br />
numbers. In the first two examples, the N character causes the dollar sign to<br />
be displayed next to the first digit, regardless of how many digits are in the<br />
number. The zeros specify that a zero be displayed if there is no digit in that<br />
position. In the third and fourth examples, the dollar sign is always printed<br />
in the leftmost position. In the last example, if there are no digits right of the<br />
decimal point, no decimal point or trailing zeros are displayed.<br />
The delta symbol ( ) represents a blank space.<br />
TSL Parameter<br />
value<br />
Display<br />
%balance:'$NNNN0.00':'-$NNN0.00' 1000.0 $1000.00<br />
%balance:'$NNNN0.00':'-$NNN0.00' -1000.0 -$1000.00<br />
%balance:'$99990.00':'-$9990.00' 1000.0 $1000.00<br />
%balance:'$99990.00':'-$9990.00' -1000.0 -$1000.00<br />
%balance:'$NNNN.NN':'-$NNN.NN' 1000.0 $1000
Date values<br />
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default format<br />
For date values, the default display format shows the day, month, and year as<br />
in 1-Jan-91, where the delta ( ) is a blank.<br />
You can change the default format for all date values within a property of a<br />
display object. You do this with the TSL command &DDF.<br />
You can specify the format for an individual parameter using one of the two<br />
following syntaxes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
Syntax 1<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions for the display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The minus sign ( - ) in front of width specifies left justification of the<br />
parameter value. Right justification is the default.<br />
■ If the value can be displayed in less space than width positions, the value<br />
is padded with blanks. Padding occurs on the left when you use right<br />
justification, and on the right when you use left justification.<br />
■ If the value of cannot be displayed in width positions, it is truncated on<br />
the right to display within width characters.<br />
Text Substitution <strong>Language</strong> 5-19
Displaying simple parameter and slot values<br />
5-20 <strong>Language</strong> <strong>Reference</strong><br />
■ If width is 0, TSL uses the default substitution format specified by the<br />
&DDF command.<br />
For more information: For more information about this command,<br />
see Chapter 6, “TSL Commands.”
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In the following examples, the delta symbol ( ) represents a blank space.<br />
TSL Parameter value Display<br />
%last_update:-12 July 4, 1990 4-jul-1990<br />
%last_update:12 July 4, 1990 4-jul-1990<br />
%last_update:6 July 4, 1990 4-jul<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param[:dfmt]:'mask'<br />
Syntax 2<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
dfmt<br />
is one of the following options:<br />
D specifies use of a date mask to display dates.<br />
J specifies Julian date display, which is the number of days since the<br />
beginning of the year, inclusive.<br />
A specifies display of dates as the number of days since January 1, 1900,<br />
inclusive.<br />
.........................................................................................................................................................................................................˝..........................................<br />
mask<br />
is a valid mask for either dates or integers.<br />
Text Substitution <strong>Language</strong> 5-21
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
5-22 <strong>Language</strong> <strong>Reference</strong><br />
■ If you do not specify dfmt, the default is D.<br />
■ If you specify the D option or do not specify dfmt, you must use a date<br />
mask.<br />
■ If you specify either the J or A options, you must use an integer mask.<br />
For more information: See the &DDF and &IDF commands in Chapter 6,<br />
“TSL Commands,” for information about date and integer masks in TSL.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following example uses a date mask to print the full name of the month,<br />
a comma, a space, and then a four-digit year. The delta symbol ( ) in the<br />
third column represents a blank space.<br />
TSL Parameter<br />
value<br />
Display<br />
%last_update:d:'NN1, Z' 3-Sep-89 September,1989
Time values<br />
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default format<br />
For time values, the default display format is two digits for hours, a colon,<br />
two digits for minutes, and the string AM or PM, as in 9:30pm.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Changing the format You can change the default format for all time values within a property. You<br />
do this with the TSL command &TDF.<br />
For more information: See Chapter 6, “TSL Commands,” for information<br />
about the &TDF command.<br />
You can specify the format for an individual parameter using one of the two<br />
following syntaxes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
Syntax 1<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions for the display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The minus sign ( - ) in front of width specifies left justification of the<br />
parameter value. Right justification is the default.<br />
■ In addition to using the specified justification and width, TSL uses the<br />
following display format: HH:MM:SS.hh, as in 14:30:00.00.<br />
Text Substitution <strong>Language</strong> 5-23
Displaying simple parameter and slot values<br />
5-24 <strong>Language</strong> <strong>Reference</strong><br />
■ If the value can be displayed in less space than width positions, the value<br />
is padded with blanks. Padding occurs on the left when you use right<br />
justification, and on the right when you use left justification. In<br />
addition, if the hour is less than 10, a single zero (0) is printed<br />
immediately before the hour.<br />
■ If the value of cannot be displayed in width positions, it is truncated on<br />
the right to display within width characters.<br />
■ If width is 0, TSL uses the default substitution format, as in 12:30pm.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In the following examples, the delta symbol () represents a blank space.<br />
TSL Parameter value Display<br />
%trans_time:11 4:30pm 16:30:00.00<br />
%trans_time:8 4:30pm 16:30:00<br />
%trans_time:5 4:30pm 16:30<br />
%trans_time:11 2:30am 02:30:00.00<br />
%trans_time:5 2:30am 02:30<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param[:tfmt]:'mask'<br />
Syntax 2<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.
Displaying simple parameter and slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
tfmt<br />
is one of the following options:<br />
T specifies use of a time mask to display times.<br />
H specifies time in hours since midnight.<br />
M specifies time in minutes since midnight.<br />
S specifies time in seconds since midnight.<br />
.........................................................................................................................................................................................................˝..........................................<br />
mask<br />
is a valid mask for either times or reals.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you do not specify tfmt, the default is T.<br />
■ If you specify the T option or do not specify tfmt, you must use a time<br />
mask.<br />
■ If you specify either the H, M, or S options, you must use a real number<br />
mask.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The first example below uses a time mask to specify the hour in a 12-hour<br />
format, followed by a space and the string O’CLOCK. The second example<br />
uses a real number mask to display the time as the number of minutes since<br />
midnight, and allows five spaces for the display.<br />
TSL Parameter value Display<br />
%t:t:'H o''clock' 12:05pm 12o'clock<br />
%t:m:'99990' 12:05pm 725<br />
Text Substitution <strong>Language</strong> 5-25
Displaying simple parameter and slot values<br />
Boolean values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default format<br />
5-26 <strong>Language</strong> <strong>Reference</strong><br />
The default format for displaying Boolean values is either YES, NO, or<br />
UNKNOWN, without any surrounding spaces. For example, if CREDIT_OK is<br />
a Boolean parameter with the value TRUE, the following statement:<br />
Credit ok: %credit_ok.<br />
produces the result:<br />
Credit ok: Yes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Changing the format<br />
You may specify a different format using the following syntax.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
param<br />
is the name of the parameter.<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions for the display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The minus sign ( - ) in front of width specifies left justification of the<br />
parameter value. Right justification is the default.<br />
■ If the value can be displayed in less space than width positions, the value<br />
is padded with blanks. Padding occurs on the left when you use right<br />
justification, and on the right when you use left justification.
Displaying simple parameter and slot values<br />
■ If the value cannot be displayed in width positions, it is truncated on the<br />
right to display within width characters.<br />
■ If width is 0, TSL uses the default substitution format: YES, NO, or<br />
UNKNOWN.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Associating Text With Booleans<br />
In the following examples, the delta symbol ( ) represents a blank space.<br />
TSL Parameter value Display<br />
%credit_ok:1 true y<br />
%credit_ok:-10 false no<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
Up to three sets of text in angle brackets can be associated with a Boolean.<br />
The sets specify the text that <strong>AionDS</strong> displays when the Boolean is true,<br />
unknown, or false, respectively. For example, you can replace the default<br />
output from a Boolean with the following TSL statement:<br />
%credit_ok .<br />
When <strong>AionDS</strong> executes the statement, one of the three messages appears:<br />
is ok.<br />
is not known.<br />
was not ok as of 27-Aug-90.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
There are three formats for associating text with Booleans:<br />
%[library::]Boolean_param <br />
<br />
%[library::]Boolean_param <br />
%[library::]Boolean_param <br />
Text Substitution <strong>Language</strong> 5-27
Displaying simple parameter and slot values<br />
5-28 <strong>Language</strong> <strong>Reference</strong><br />
library is the name of the included library in which the parameter<br />
exists. The library name is only required when duplicate<br />
parameter names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
If the value of a Boolean is not specified, <strong>AionDS</strong> does not display anything.<br />
This is equivalent to the following formats:<br />
%[library::]Boolean_param <br />
%[library::]Boolean_param <br />
%[library::]Boolean_param <br />
.........................................................................................................................................................................................................˝..........................................<br />
Certainty factor<br />
You can display a Boolean in numeric format with the following TSL<br />
statement:<br />
%[library::]Boolean_param <br />
library is the name of the included library in which the parameter<br />
exists. The library name is only required when duplicate<br />
parameter names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
In this case, <strong>AionDS</strong> displays the certainty factor for the Boolean as a number<br />
between -1.00 and 1.00, inclusive.<br />
For more information: See Appendix A, “Certainty,” about certainty<br />
factors.
Displaying slot values<br />
Displaying slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can use TSL to display the values for any or all slots in an instance of a<br />
class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying all slot<br />
values<br />
You can display all slot values associated with an instance by specifying the<br />
instance name. If you do not include formatting specifications, <strong>AionDS</strong> uses<br />
the default format for each data value and for the instance as a whole.<br />
For more information: The default formats for individual data types are<br />
explained in the “Displaying simple parameter and slot values” section on<br />
page 5-5.<br />
The default format for an instance as a whole is to list each slot and value<br />
followed by a comma, except for the last slot and value. The last slot and<br />
value are preceded by the word AND.<br />
The following example uses the default substitution for the instance of<br />
ACCOUNTS specified in the INSTANCE_NAME parameter:<br />
%accounts(%instance_name)<br />
It displays in default format, giving the name and value for each slot.<br />
acct_no: 1000, name: John Doe, location: San Francisco,<br />
CA and acct_balance: 10,000.00<br />
To print the values in the slots of a static instance, you can specify the<br />
instance name directly. For example, if INSTANCE_NAME contained the<br />
string a1001, the following statement produces the same result:<br />
%accounts(a1001)<br />
Text Substitution <strong>Language</strong> 5-29
Displaying slot values<br />
5-30 <strong>Language</strong> <strong>Reference</strong><br />
You need not include the class name in your TSL statement if no other object<br />
in scope has the same name. For example, the following two TSL statements<br />
achieve the same result. They both print the values of the static instance<br />
named CH14205.<br />
%ch14205<br />
%accounts(ch14205)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying individual<br />
slot values<br />
If you do not want to print all slot values, or if you want to specify the format<br />
for individual slot values, you can use slot names in the TSL statement. For<br />
example, you can display the values of ACCT_NO, NAME, and<br />
ACCT_BALANCE with the following statement:<br />
%accounts(%instance_name)<br />
You can override the default format of a slot value by specifying the format<br />
after the slot name. In the following example, the Real Default Format<br />
statement controls the display of ACCT_BALANCE. The formats specified for<br />
ACCT_NO and NAME override the default integer and string formats.<br />
&rdf(10,2,c)<br />
%accounts(%instance_name)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying values in<br />
the current instance<br />
When a message object in a class executes, the instance to which the message<br />
was sent is the current instance. You can display the current instance with<br />
the %CURRENT statement, as follows:<br />
%current<br />
You can display the data for specific slots of the current instance without<br />
specifying the class or instance names, as follows:<br />
%acct_no %name
Displaying values from multiple instances<br />
Displaying values from multiple instances<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying a class<br />
You can display all values in all instances of a class with one TSL statement.<br />
To display an entire class in the default format, use the percent sign ( % )<br />
followed by the name of the class. For example, to display all slot values for<br />
all instances in the ACCOUNTS class, you can use the following TSL<br />
statement:<br />
%accounts<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying current<br />
class<br />
When a message is sent to a class or to an instance of a class, that class is<br />
called the current class. You can display the current class with the<br />
%CURRENTCLASS operator, as follows:<br />
%currentclass<br />
.........................................................................................................................................................................................................˝..........................................<br />
Specifying slots<br />
If you do not want to print all slot values, or if you want to specify the format<br />
for individual slots, you can use slot names in the TSL statement. The<br />
following example displays the values of the slots ACCT_NO and NAME for<br />
every instance in the class ACCOUNTS. Each instance is displayed on a<br />
separate line.<br />
%accounts<br />
The following list explains each part of the statement above, from outer<br />
sections inward and from left to right:<br />
■ %ACCOUNTS < ... > prints all instances of the class ACCOUNTS according<br />
to the format specified in the brackets.<br />
■ % < ... > prints each instance according to the format specified in the<br />
angle brackets.<br />
■ %ACCT_NO prints the value of the slot ACCT_NO in the default format.<br />
The blank space following %ACCT_NO prints a blank space after the<br />
value.<br />
Text Substitution <strong>Language</strong> 5-31
Displaying values from multiple instances<br />
5-32 <strong>Language</strong> <strong>Reference</strong><br />
■ %NAME prints the value of the slot NAME.<br />
■ &BR starts a new line after each instance.<br />
You can print slot values throughout a class in the default format with the<br />
syntax %classname.slotname. This format displays all values of the specified<br />
slot, separated by commas. Before the last value, <strong>AionDS</strong> inserts the word<br />
AND, rather than a comma. For example, the following statement displays all<br />
values for the NAME slot:<br />
%accounts.name<br />
.........................................................................................................................................................................................................˝..........................................<br />
Formatting<br />
You can use colon formatting or angle brackets to format individual values.<br />
Even if you format the individual values, this syntax always separates the<br />
values with commas and the word AND, except within the &TBL command.<br />
This syntax is specialized within the &TBL command to print slot values in a<br />
table.<br />
For more information: See “&TBL” in Chapter 6, “TSL Commands.”
Using Boolean criteria to display instances<br />
Displaying values from multiple instances<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
If a class contains a Boolean slot, you can use this Boolean value to select<br />
which instances are displayed. The TSL statement to accomplish this is called<br />
a constrained class reference.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following slots in the ACCOUNT class:<br />
acct_no<br />
name<br />
location<br />
acct_balance<br />
overdue<br />
The OVERDUE slot is a Boolean. You can use the following TSL statement to<br />
display the instances in ACCOUNTS in which OVERDUE is true, printing one<br />
instance per line:<br />
%accounts(with overdue)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Multiple Booleans<br />
You can use multiple Booleans. For example, if the ACCOUNTS class contains<br />
another Boolean, LARGELOAN, you can use both slots to limit which accounts<br />
are displayed. The following statement displays accounts that have large<br />
loans and are overdue:<br />
%accounts(with overdue)(with largeloan)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Specifying slots<br />
The above examples display all slot values for each instance shown. You can<br />
limit both the instances and slots displayed by using the Booleans and by<br />
specifying the slot names in the TSL statement. The following statement<br />
displays the name and balance for overdue accounts:<br />
%accounts(with overdue)<br />
Text Substitution <strong>Language</strong> 5-33
Displaying pointer values<br />
Displaying pointer values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
5-34 <strong>Language</strong> <strong>Reference</strong><br />
You can use TSL to display parameter and slot values whose base type is<br />
POINTER. A pointer identifies an instance. You can use pointers to display<br />
the names of instances and to print their slot values.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying an<br />
instance name<br />
You can print the full name of an instance by referring to the name of the<br />
parameter or slot. For example, the value of the parameter PTR is a pointer to<br />
an instance of the class TRUCK. The following TSL text prints the name of<br />
the instance of TRUCK to which PTR refers:<br />
%ptr<br />
.........................................................................................................................................................................................................˝..........................................<br />
Specifying text<br />
The following statement prints the instance name surrounded by text:<br />
Truck %ptr has been selected.<br />
The following statement uses a different syntax than the example above, but<br />
produces the same result:<br />
%ptr
Displaying slot values using pointers<br />
Displaying pointer values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
It is important to remember that a pointer is not an instance, but something<br />
that refers to an instance. You can work with a pointer itself, as a reference to<br />
an instance, or you can use the pointer to work with the instance. If you<br />
want to work with the instance itself, you must dereference the pointer.<br />
Dereferencing a pointer means using the pointer to find the instance, and<br />
then working with the instance directly.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying slot values<br />
To display slot values by means of pointers, you must dereference the pointer.<br />
In TSL, you dereference a pointer with the asterisk ( * ) character.<br />
The following example prints all the slot names and values of the instance<br />
referred to by PTR, using the default format:<br />
%ptr*<br />
.........................................................................................................................................................................................................˝..........................................<br />
Specifying slots<br />
The following example prints the value of the DESTINATION slot:<br />
%ptr*.destination<br />
The following example prints slot values of DESTINATION and DRIVER of the<br />
instance referred to by PTR:<br />
%ptr*<br />
Text Substitution <strong>Language</strong> 5-35
Displaying pointer values<br />
Displaying lists or sets of pointers<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying instance<br />
names<br />
5-36 <strong>Language</strong> <strong>Reference</strong><br />
If a parameter or slot contains a list or set of pointers, you can display the full<br />
names of all instances in the following manner:<br />
%ptr_list<br />
In the above example, PTR_LIST is the name of a parameter whose type is a<br />
list of pointers. This prints the full names of all instances referred to by the<br />
values of PTR_LIST.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying slot values<br />
To display slot values for the instances of a pointer list, you must dereference<br />
the pointers using the asterisk ( * ) character. The following example displays<br />
all slot values for every instance to which PTR_LIST points. <strong>AionDS</strong> uses the<br />
default format for the entire list and for each slot because no other formats are<br />
specified.<br />
%ptr_list*<br />
.........................................................................................................................................................................................................˝..........................................<br />
Specifying a slot<br />
To print specific slot values, you must dereference the pointers and specify<br />
which slots to display. The following example prints the values of SLOT1 for<br />
every instance. The &BR command specifies that each value of SLOT1 be<br />
printed on a separate line.<br />
%ptr_list<br />
You can use this syntax to print the values from one slot for every instance.<br />
This syntax is not appropriate for displaying the values from more than one<br />
slot because the index counter of the list is incremented as the last step of the<br />
%*.SLOT1 statement.
Displaying pointer values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Specifying multiple<br />
slots<br />
To display more than one slot, use bracket formatting after the %*, as shown<br />
in the following example:<br />
%ptr_list<br />
The above example prints SLOT1 and SLOT2 values for each instance pointed<br />
to by PTR_LIST. The values for each instance are on a separate line.<br />
Text Substitution <strong>Language</strong> 5-37
Displaying pointer values<br />
Displaying instances from multiple classes<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
5-38 <strong>Language</strong> <strong>Reference</strong><br />
You can display instances from multiple classes if an instance pointer is part<br />
of one of the classes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following classes:<br />
Accounts Transaction<br />
acct_no trans_id<br />
name acct_instance<br />
location amount<br />
acct_balance<br />
The ACCT_INSTANCE slot in the TRANSACTION class is a pointer to an<br />
instance in ACCOUNTS. You can use the pointer to identify the instance in<br />
ACCOUNTS.<br />
For example, you can use the following statement to display the account<br />
number and name for the ACCOUNTS instance identified in the<br />
TRANSACTION instance, as well as the amount from the TRANSACTION<br />
instance:<br />
%transaction(%trans_instance)<br />
.........................................................................................................................................................................................................˝..........................................<br />
TSL in method’s<br />
attached object<br />
If the TSL text is in the attached object of a method in the TRANSACTION<br />
class, you can display the same information using the current instance of<br />
TRANSACTION.<br />
%acct_instance*<br />
<br />
%amount
Displaying unknown pointers<br />
Displaying pointer values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default display<br />
If <strong>AionDS</strong> tries to print a pointer value when it is unknown, <strong>AionDS</strong> prints<br />
the following string instead of a value:<br />
NUL<br />
.........................................................................................................................................................................................................˝..........................................<br />
Changing the default<br />
You can change this string with the &UNDPTR command.<br />
For more information: See Chapter 6, “TSL Commands,” for more<br />
information about this command.<br />
Text Substitution <strong>Language</strong> 5-39
Displaying lists and sets<br />
Displaying lists and sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
5-40 <strong>Language</strong> <strong>Reference</strong><br />
To display a list or set you must consider both the format for the list or set as<br />
a whole and the format for the individual elements. In addition you must<br />
consider which elements you want to display.<br />
This section first discusses how to display an entire list or set in the default<br />
format. Then it explains how to specify and format an individual element of<br />
a list or set. From this point it describes how to display multiple elements<br />
and how to format a list or set of lists, sets, or records.
Displaying entire lists and sets in default format<br />
Displaying lists and sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
To display an entire list or set in the default format, you can use the standard<br />
syntax for displaying a parameter or slot.<br />
For more information: See the sections “Displaying simple parameter and<br />
slot values” on page 5-5 and “Displaying slot values” on page 5-29 for syntax.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default format<br />
In the default format for a list, set, or record, TSL places a comma after each<br />
element or field, except the last two elements or fields. The last two elements<br />
or fields are separated by the word AND.<br />
For example, consider the parameter SP_CUST, an integer list that contains<br />
the following customer numbers:<br />
1000, 1001, 2099, 3000<br />
The following TSL statement uses the default format to display the elements<br />
of the list:<br />
Special customers: %sp_cust.<br />
TSL displays the following text:<br />
Special customers: 1000, 1001, 2099 and 3000.<br />
You can achieve the same result with angle brackets and the %IS operator, as<br />
shown in the following example. %IS specifies the display of all of the<br />
elements in a list or set.<br />
%sp_cust <br />
.........................................................................................................................................................................................................˝..........................................<br />
Display of elements<br />
The display of individual elements depends on the basic data type of the<br />
element or field. For example, the following list of dates is in the default<br />
format:<br />
12-Jan-91, 2-Feb-91 and 31-Jan-91<br />
Text Substitution <strong>Language</strong> 5-41
Displaying lists and sets<br />
5-42 <strong>Language</strong> <strong>Reference</strong><br />
Lists or sets of lists, sets, and records display in the same format as individual<br />
lists, sets, or records. Consider the following set of lists:<br />
set_val(1) contains ( 1, 3, 5)<br />
set_val(2) contains ( 2, 4, 6)<br />
set_val(3) contains (10,20,30)<br />
In default substitution format, %SET_VAL is displayed in the following<br />
manner:<br />
1, 3 and 5, 2, 4 and 6 and 10, 20 and 30
Individual elements of lists and sets<br />
Displaying lists and sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can display an individual element of a list or set by specifying its position<br />
in the list or set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]name(element)[(element) ...]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter or slot exists. The<br />
library name is only required when duplicate parameter or slot names exist in<br />
any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
name<br />
is the name of a parameter or slot whose type is list or set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
element<br />
is an integer parameter, constant, or field name in a record.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you specify an element that is out of the range of the list or set, TSL<br />
substitutes the value UNKNOWN.<br />
■ You can use this syntax within a record display. See the “Displaying<br />
records” section on page 5-49 for more information.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the integer parameter IVAL with a value of 3, and the list of real<br />
numbers RLIST that contain the following elements:<br />
10.2, 20.1, 30.3, 40.0, 50.5<br />
Text Substitution <strong>Language</strong> 5-43
Displaying lists and sets<br />
5-44 <strong>Language</strong> <strong>Reference</strong><br />
The following TSL statements use the values of the parameters:<br />
TSL statement Display<br />
%rlist(1) 10.20<br />
%rlist(2):5:1 20.1<br />
%rlist(%ival):5:2 30.30<br />
%rlist(5):3:0 51<br />
%rlist(6) Unknown<br />
Consider the following set of integer lists IMATRIX, which corresponds to an<br />
integer matrix:<br />
IMATRIX(1) contains (10,20,30,40)<br />
IMATRIX(2) contains ( 1, 2, 3, 4)<br />
IMATRIX(3) contains (11,22,33,44)<br />
The integer IVAL contains the value of 3. The following TSL statements use<br />
the value of the parameters:<br />
TSL statement Display<br />
%imatrix(1)(2) 20<br />
%imatrix(2)(%ival) 3<br />
%imatrix(%ival)(%ival) 33<br />
%imatrix(3)(4) 44<br />
%imatrix(4)(3) Unknown
Multiple elements of lists and sets<br />
Displaying lists and sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can use angle brackets and a percent sign ( % ) to print elements of a list<br />
or set. The following three rules apply in this case:<br />
■ The percent sign ( % ) inside the angle brackets represents the next<br />
element to be displayed for the current list or set.<br />
■ If the number of percent signs inside the angle brackets does not match<br />
the number of elements in the list or set, TSL reuses the percent signs in<br />
the command to format the remaining elements in the list or set.<br />
■ After the last element is displayed, TSL ignores all other text within the<br />
angle brackets, including percent sign operators.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
In the following example, one percent sign is inside the angle brackets and<br />
four elements are in the list.<br />
%ilist <br />
TSL uses the only percent sign to format each number. Since the default<br />
format for integers is used in the example, all of the numbers display without<br />
any surrounding blanks. In this case, TSL produces the following output:<br />
10203040<br />
.........................................................................................................................................................................................................˝..........................................<br />
Formatting<br />
You can take advantage of the above rules by specifying an appropriate format<br />
inside the angle brackets. The following example shows one way to format<br />
ILIST:<br />
The list contains: %ilist<br />
which results in the following display:<br />
The list contains: 10, 20, 30, 40<br />
Text Substitution <strong>Language</strong> 5-45
Displaying lists and sets<br />
5-46 <strong>Language</strong> <strong>Reference</strong><br />
In the example, each element is followed by a comma ( , ) and a space. The<br />
comma and the space are not present after the last element of the list. TSL<br />
ignores any text after the last element in a list or set. If you want additional<br />
text to display after the last element, you must place the text after the closing<br />
angle bracket.<br />
The following TSL statement uses the percent sign three times to specify the<br />
format. To format the fourth element of ILIST, <strong>AionDS</strong> reuses the first<br />
percent sign.<br />
%ilist<br />
This results in the following display:<br />
10 20 30<br />
40
Lists or sets of lists, sets, and records<br />
Displaying lists and sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can display lists or sets of lists, sets, and records. Consider the following<br />
examples that use the set of integer lists IMATRIX:<br />
IMATRIX(1) contains (10,20,30,40)<br />
IMATRIX(2) contains ( 1, 2, 3, 4)<br />
IMATRIX(3) contains (11,22,33,44)<br />
You can format each element of the set using nested angle brackets. The<br />
outside pair of angle brackets controls the list or set, while the inside pair<br />
controls the list, set, or record that is contained within each element of the list<br />
or set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following TSL statement:<br />
%imatrix <br />
The following list explains each part of this statement, from the outer sections<br />
inward and from left to right:<br />
■ %IMATRIX < ... > prints the value of the parameter IMATRIX according to<br />
the format in the brackets. IMATRIX is a set of lists.<br />
■ % < ... > steps through each element of IMATRIX and formats it<br />
according to the format in the brackets. Each element is a list.<br />
■ %:3 formats each subelement of the current element of IMATRIX. Each<br />
subelement is an integer and is formatted to display in three positions.<br />
Since there is only one percent sign, its format is reused for each<br />
subelement.<br />
■ &BR goes to the next line before printing the next element of IMATRIX.<br />
For more information: See Chapter 6, “TSL Commands,” about the<br />
&BR command.<br />
The TSL statement produces the following output:<br />
10 20 30 40<br />
1 2 3 4<br />
11 22 33 44<br />
Text Substitution <strong>Language</strong> 5-47
Displaying lists and sets<br />
5-48 <strong>Language</strong> <strong>Reference</strong><br />
You can display a list or set of records in the same way. The outside pair of<br />
angle brackets controls the list or set, while the inside pair of angle brackets<br />
controls formatting for the record. The following TSL statement displays the<br />
second element of the list of records, CUST_LIST:<br />
%cust_list(2)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Nesting angle<br />
brackets<br />
You can nest angle brackets to the level that matches your structure. For<br />
example, if COMPLEX_STRUC is a list of sets of records, you can display each<br />
record with the following TSL statement:<br />
%complex_struc <br />
The outermost pair of angle brackets controls the format of the list, the<br />
middle pair controls each set, and the innermost pair controls each record.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying fields<br />
You can display a field in a list or set of records. For example, if CUST_NO is<br />
a field in the list CUSTOMER_LIST, you can display the customer of each<br />
record with the following statement:<br />
%customer_list.cust_no<br />
The numbers appear in default format separated by commas. The last two<br />
fields are separated by the word AND. If you include a formatting command,<br />
such as :3, TSL formats each field but does not remove the commas or the<br />
AND.
Displaying records<br />
Displaying records<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default format<br />
Each field in a record displays in the default substitution format of the field.<br />
The contents of each field are displayed after the field name. Consider the<br />
following record:<br />
record<br />
cust_no is integer<br />
cust_name is string<br />
payment_hist is string<br />
credit_limit is real<br />
last_update is date<br />
end<br />
The record shows the default format:<br />
cust_no: 1000, cust_name: Xyz Corp, payment_hist: under<br />
30 days, credit_limit: 9,500.00 and last_update: 1-Sep-<br />
90<br />
Although the display is two lines in this example, the record actually displays<br />
on one line, unless you use additional formatting commands.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying fields<br />
You can display a field in a record by specifying the record name, a dot ( . ),<br />
and the field name. The following statement displays the field<br />
CREDIT_LIMIT in the record CUSTOMER.<br />
%customer.credit_limit<br />
.........................................................................................................................................................................................................˝..........................................<br />
Formatting<br />
You can specify any format commands that are appropriate for the type of the<br />
field. For example, the following command displays the field in ten positions,<br />
with two digits to the right of the decimal point:<br />
%customer.credit_limit:10:2<br />
Text Substitution <strong>Language</strong> 5-49
Displaying records<br />
5-50 <strong>Language</strong> <strong>Reference</strong><br />
For records, the percent sign ( % ) and %IS commands are the same. The<br />
entire record displays in default format when you use either of the following<br />
commands:<br />
%customer <br />
%customer <br />
You can specify display of selected fields within a record. The following<br />
statement displays the customer number, credit limit, and payment history<br />
for a customer:<br />
%customer
Using a record field to index into a list or set<br />
Displaying records<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can use the contents of a field as an index into a list or set. Consider the<br />
list PAYMENT_HIST_TABLE that contains the following elements:<br />
'under 30 days','not under 30 days'<br />
Rather than keep the payment history as a string in a record, you can keep<br />
the index into PAYMENT_HIST_TABLE in an integer field in a record. For<br />
example, if PAYMENT_HIST_FIELD is an integer field in the CUSTOMER<br />
record, you can store 1 in the field to represent under 30 days and 2 to<br />
represent not under 30 days.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement displays the string in the list element using the<br />
record field:<br />
%customer <br />
Text Substitution <strong>Language</strong> 5-51
Using functions in TSL<br />
Using functions in TSL<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
5-52 <strong>Language</strong> <strong>Reference</strong><br />
You can write functions to be called when <strong>AionDS</strong> executes TSL statements.<br />
The purpose of a function in TSL is to display the return value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following TSL statement:<br />
Annual Sales: %sum(%monthly_sales)<br />
The function SUM totals the values in the MONTHLY_SALES list.<br />
MONTHLY_SALES is an input argument to the function. The function is<br />
defined in the following manner:<br />
Input Arguments:<br />
values is real_list<br />
Local Variables:<br />
total is real<br />
Function Body:<br />
total = 0<br />
for values<br />
total = total + values(i)<br />
end<br />
return(total)<br />
When <strong>AionDS</strong> displays the TSL statement, the function SUM executes. You<br />
can use a function in TSL whenever you want to cause actions to occur before<br />
displaying the result.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Calling functions<br />
When you use functions in TSL, consider the following points:<br />
■ You must precede the function name and each input argument with a<br />
percent sign ( % ), except where input arguments are constants.<br />
■ The function must return a value.<br />
■ The function cannot have output arguments.
Using functions in TSL<br />
■ If the function does not have input arguments, you can include or omit<br />
the parentheses after the function name. The following statements are<br />
equivalent:<br />
%generate_random_no()<br />
%generate_random_no<br />
■ You cannot pass records or record fields as input parameters.<br />
■ In addition to parameter and slot values, the following items are valid<br />
input arguments:<br />
Input argument Description<br />
% Substitution operator<br />
%AES_PAGENUM Current page number<br />
%CERTAINTY Certainty value<br />
%CURRENT Current instance<br />
%CURRENTDATE Date<br />
%CURRENTTIME Time<br />
%INDEX Element number<br />
%instance Instance reference<br />
%IS Substitution operator<br />
■ To pass an instance as an input argument, you can use a parameter or<br />
slot whose base type is pointer. You must dereference the pointer by<br />
using a asterisk ( * ) after the parameter or slot name. The following<br />
statement sends an instance as an input argument to the function FUNC.<br />
The parameter PTR holds a pointer to the instance.<br />
%ptr*<br />
Text Substitution <strong>Language</strong> 5-53
Using functions in TSL<br />
5-54 <strong>Language</strong> <strong>Reference</strong><br />
■ If you pass an instance or pointer as an argument to a function, <strong>AionDS</strong><br />
does not automatically source the slots of the instance before executing<br />
the function. If you want <strong>AionDS</strong> to source the slots, set the Backward<br />
Chain property of the function to TRUE. When the Backward Chain<br />
property is true, <strong>AionDS</strong> sources all slots used in the function.<br />
■ You can format the result of a function as you would format an<br />
individual parameter value. The kind of formatting must correspond to<br />
the kind of return value. The following shows formatting for the SUM<br />
function that returns a real number:<br />
%sum(%monthly_sales):10:2
Sending messages to classes and instances from TSL<br />
Sending messages to classes and instances from TSL<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can send messages to classes and instances from within any object<br />
property that takes TSL text. These messages invoke methods that contribute<br />
to the text. The attached objects of the methods must be messages or<br />
functions.<br />
You might invoke methods from TSL for several reasons:<br />
■ To include instance-specific information within a prompt<br />
■ To print information from many instances in a report<br />
■ To tailor general messages, text windows, prompts, or reports according<br />
to the data available<br />
To accomplish these goals you might use message passing in the following<br />
ways:<br />
■ Embedding a message from a parent class within the message of a<br />
subclass<br />
■ Sending a message to a class to print information for each instance<br />
■ Embedding a slot value in the prompt for another slot value<br />
■ Sending a message whose attached object is a function that returns a<br />
value<br />
.........................................................................................................................................................................................................˝..........................................<br />
Syntax<br />
You can invoke methods with one of the following formats:<br />
.............................................................................................................................................................................<br />
Format 1<br />
Use this format to send a message to a class. This format is used when the<br />
method is associated with the class itself, rather than with specific instances of<br />
the class.<br />
&SEND (method TO %classref [WITH arg1 [, arg2...]]) [format]<br />
Text Substitution <strong>Language</strong> 5-55
Sending messages to classes and instances from TSL<br />
5-56 <strong>Language</strong> <strong>Reference</strong><br />
.............................................................................................................................................................................<br />
Format 2<br />
Use this format to send a message to an instance. This format is used when a<br />
method is intended to operate upon a particular instance.<br />
&SEND (method TO %instanceref [WITH arg1 [, arg2...]])<br />
[format]<br />
.............................................................................................................................................................................<br />
Format 3<br />
Use this format to send a message which resides in the parent of the current<br />
class to the current instance. The command causes the parent message to be<br />
embedded in the current message.<br />
&SEND (method UP [WITH arg1 [, arg2...]]) [format]<br />
.............................................................................................................................................................................<br />
Format 4<br />
Use this format to send a message to an instance. This format is used when a<br />
method is intended to operate upon a particular instance.<br />
%instanceref.method[(arg1 [, arg2 ...])] [format]<br />
.............................................................................................................................................................................<br />
Format 5<br />
Use this format to send a message which resides in the parent of the current<br />
class to the current instance. The command causes the parent message to be<br />
embedded in the current message.<br />
%UP.method[(arg1 [, arg2 ...])] [format]<br />
.............................................................................................................................................................................<br />
Format 6<br />
Use this format to send a message to the current instance or within a nested<br />
instance reference.<br />
%method[(arg1 [, arg2 ...])] [format]
Sending messages to classes and instances from TSL<br />
.............................................................................................................................................................................<br />
Format 7<br />
Use this format to send a method to every instance of a class. TSL displays<br />
the text returned from each instance in default format, separated by commas.<br />
A specialized use of this syntax is available within the &TBL command.<br />
For more information: See the section “&TBL” in Chapter 6, “TSL<br />
Commands.”<br />
%classref.method[(arg1 [, arg2 ...])] [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
method<br />
is the name of the method to be invoked.<br />
.........................................................................................................................................................................................................˝..........................................<br />
classref<br />
is a class. %classref can have one of the following forms:<br />
%[library::]class<br />
%currentclass<br />
class is the name of a class<br />
library is the name of the included library in which the parameter<br />
exists. The library name is only required when duplicate<br />
parameter names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
instanceref<br />
is the instance to which the message is sent. %instanceref can have one of the<br />
following forms:<br />
%<br />
%classref(static)<br />
%classref(%str_param)<br />
%current<br />
%is<br />
%ptr*<br />
%[library::]static<br />
ptr is the name of a slot or parameter whose type is pointer.<br />
Text Substitution <strong>Language</strong> 5-57
Sending messages to classes and instances from TSL<br />
5-58 <strong>Language</strong> <strong>Reference</strong><br />
static is the name of a static instance.<br />
str_param is the name of a parameter or slot whose type is string and<br />
whose value is the name of an instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
arg#<br />
is an argument to be passed to the attached function.<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to the type of value returned by the attached<br />
function.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The object attached to the method must be a message or a function. The<br />
message or return value is embedded exactly as it would be using the<br />
&MSG statement or a function call.<br />
■ To specify arguments with the &SEND command, place arguments after<br />
the word WITH and separate the arguments with commas. For example,<br />
the following statement sends a message to the static instance FORD. The<br />
method name is SPECS. The first argument is the value of ENGINE,<br />
which is a slot of the current instance. The second argument is the string<br />
THROTTLE.<br />
&send (specs to %ford with %engine, 'throttle')<br />
■ If you do not use the &SEND command, place arguments in parentheses,<br />
separated by commas. The following statement produces the same result<br />
as the previous example:<br />
%ford.specs (%engine, 'throttle')<br />
■ You can format the return value of a function with TSL formatting<br />
commands such as colon formatting, masks, brackets, and so on.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statement displays text as a result of sending a message to the<br />
class CUSTOMERS:<br />
&send(SalesTotal to %Customers)<br />
The following statements each send a message to the current instance. The<br />
second and third statements format the value (in this case it is a real number)<br />
with a width of 10 and precision of 2.
&send(OrderTotal to %Current)<br />
Sending messages to classes and instances from TSL<br />
&send(OrderTotal to %Current):10:2<br />
%OrderTotal:10:2<br />
The following statements both send a message to the instance referred to by<br />
the pointer CUSTPOINTER:<br />
&send(OrderTotal to %CustPointer*)<br />
%CustPointer*.OrderTotal<br />
The following statement uses Format 6 within a nested instance reference.<br />
This statement sends two messages to the instance pointed to by<br />
CUSTPOINTER.<br />
%CustPointer* <br />
The following statements both send a message to an instance of the class<br />
CUSTOMERS. The instance name is the value of the parameter BIGGEST.<br />
&send(OrderTotal to %Customers(%Biggest))<br />
%Customers(%Biggest).OrderTotal<br />
The following statements both send a message to the current instance or class.<br />
The method ORDERTOTAL is defined in the parent of the current class. The<br />
second statement formats the value returned by the function attached to<br />
ORDERTOTAL.<br />
&send(OrderTotal up)<br />
%up.OrderTotal:10:2<br />
Text Substitution <strong>Language</strong> 5-59
Setting up uniform defaults and headers<br />
Setting up uniform defaults and headers<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
5-60 <strong>Language</strong> <strong>Reference</strong><br />
You can specify headers or TSL defaults that are consistent among all<br />
messages, reports, text windows, or prompts in your knowledge base.<br />
You can specify these defaults and headers by defining message objects with<br />
these names:<br />
■ AES_TSLMESSAGE<br />
■ AES_TSLREPORT<br />
■ AES_TSLTEXT<br />
■ AES_TSLPROMPT<br />
.........................................................................................................................................................................................................˝..........................................<br />
Scope of messages<br />
You can create these special messages in more than one place in a knowledge<br />
base, including in vocabularies. Whenever one is needed, <strong>AionDS</strong> uses the<br />
one in scope.<br />
When you define one of these objects, <strong>AionDS</strong> includes the contents of its<br />
Message Text property in every message, report, text window, or prompt that<br />
it displays in scope. To create uniform messages, define AES_TSLMESSAGE,<br />
for reports you need to define AES_TSLREPORT, and so forth.<br />
The message you define is included before any other TSL text, so you can use<br />
these objects to set up defaults and headers. Each message, report, text<br />
window, or prompt will follow the defaults and header.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
For example, you can set the default format for date and time in a message<br />
you name AES_TSLMESSAGE. When <strong>AionDS</strong> displays any message object in<br />
the knowledge base, it uses the default in the AES_TSLMESSAGE that is in<br />
scope.
Setting up uniform defaults and headers<br />
You can define a message called AES_TSLREPORT. In this message you might<br />
have the following TSL text:<br />
&tm 8<br />
&footer <br />
&cPLATINUM technology&c555 Twin Dolphin Drive, Suite<br />
400&cRedwood City, CA&br<br />
<strong>AionDS</strong> uses this text at the top of every report the system creates. Every<br />
report has a top margin of 8, prints the page number in the footer, and prints<br />
the following text at the beginning of the report:<br />
PLATINUM technology<br />
555 Twin Dolphin Drive, Suite 400<br />
Redwood City, CA<br />
.........................................................................................................................................................................................................˝..........................................<br />
Calling one message<br />
from another<br />
If you want to specify the same header or default for more than one type of<br />
object, you can reference one message in the definition of another. For<br />
example, if you want to specify the same header for prompts and messages,<br />
you could define the header in AES_TSLPROMPT, and place the following<br />
TSL statement in the Message Text property of AES_TSLMESSAGE:<br />
&msg aes_tslprompt<br />
.........................................................................................................................................................................................................˝..........................................<br />
Reports with<br />
Continue = TRUE<br />
Note that if you are using reports whose Continue property is TRUE, your<br />
AES_TSLREPORT message in that scope should not print anything such as a<br />
header or blank lines, since the message will be included every time a report is<br />
executed. The result would be an output file with unwanted text in the<br />
middle, text that was meant to be included only at the top of the report.<br />
Text Substitution <strong>Language</strong> 5-61
Summary of TSL substitution<br />
Summary of TSL substitution<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
5-62 <strong>Language</strong> <strong>Reference</strong><br />
This section gives a summary of the TSL substitution syntax described in this<br />
chapter. You can use this summary as a quick syntax guide.<br />
Any text following the word param in the “Simple parameter values” section<br />
on page 5-63 can be substituted for the word [format] in later sections of the<br />
summary. For example,<br />
:[-]width<br />
is a valid [format] specification for string values of any parameter or slot.
Simple parameter values<br />
Summary of TSL substitution<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param<br />
Default substitution<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param <br />
Associating text with<br />
parameters<br />
String values<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
Integer values<br />
%[library::]param:'mask'[:'mask']<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:width:nfmt<br />
Integers in hex or<br />
binary<br />
%[library::]param:'mask'[:'mask']<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width[:precision]<br />
Real values<br />
%[library::]param:'mask'[:'mask']<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
Date values<br />
%[library::]param:[dfmt:]'mask'<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
Time values<br />
%[library::]param:[tfmt:]'mask'<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]param:[-]width<br />
Boolean values<br />
.........................................................................................................................................................................................................˝..........................................<br />
Associating text with<br />
Boolean values<br />
%[library::]Boolean_param <br />
<br />
%[library::]Boolean_param <br />
%[library::]Boolean_param <br />
Text Substitution <strong>Language</strong> 5-63
Summary of TSL substitution<br />
Slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
%class(%string_param)<br />
All slots of an<br />
instance<br />
5-64 <strong>Language</strong> <strong>Reference</strong><br />
%class(static_instance)<br />
%static_instance<br />
.........................................................................................................................................................................................................˝..........................................<br />
%instanceref.slot [format]<br />
One individual slot<br />
.........................................................................................................................................................................................................˝..........................................<br />
%instanceref <br />
Individual slots<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CURRENT [format]<br />
Slots of the current<br />
instance<br />
% [format]<br />
%IS [format]<br />
%slot [format]<br />
%CURRENT.slot [format]
Values from more than one instance<br />
Summary of TSL substitution<br />
.........................................................................................................................................................................................................˝..........................................<br />
%class %CURRENTCLASS<br />
All slots of all<br />
instances<br />
.........................................................................................................................................................................................................˝..........................................<br />
%classref.slot [format]<br />
One slot of all<br />
instances<br />
.........................................................................................................................................................................................................˝..........................................<br />
%classref
Summary of TSL substitution<br />
Pointer values<br />
.........................................................................................................................................................................................................˝..........................................<br />
%pointer [format]<br />
Instance name<br />
.........................................................................................................................................................................................................˝..........................................<br />
%pointer*<br />
All slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
%pointer* <br />
Some slot values<br />
.........................................................................................................................................................................................................˝..........................................<br />
%pointer_list [format]<br />
Instance names in list<br />
or set<br />
.........................................................................................................................................................................................................˝..........................................<br />
%pointer_list*<br />
All slots of all<br />
instances in list or set<br />
.........................................................................................................................................................................................................˝..........................................<br />
%pointer_list <br />
One slot of all<br />
instances in list or set<br />
.........................................................................................................................................................................................................˝..........................................<br />
%pointer_list <br />
Some slots of all<br />
instances in list or set<br />
5-66 <strong>Language</strong> <strong>Reference</strong>
Instances from multiple classes<br />
Summary of TSL substitution<br />
.........................................................................................................................................................................................................˝..........................................<br />
Using a class and its<br />
pointer slot<br />
%cl1 <br />
.........................................................................................................................................................................................................˝..........................................<br />
Using current class<br />
and its pointer slot<br />
%ptr_to_class2* %class1_slot<br />
[format]<br />
Text Substitution <strong>Language</strong> 5-67
Summary of TSL substitution<br />
Lists and sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]list_param<br />
All elements<br />
5-68 <strong>Language</strong> <strong>Reference</strong><br />
%[library::]list_param <br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]list_param(element)[(element)...] [format]<br />
Individual element<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]list_param <br />
Next element<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]list_param <br />
Element number
Records<br />
Summary of TSL substitution<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]record_param.field [format]<br />
One individual field<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]record_param <br />
Individual fields<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]record_param<br />
All fields<br />
%[library::]record_param <br />
%[library::]record_param <br />
Text Substitution <strong>Language</strong> 5-69
Summary of TSL substitution<br />
Using functions<br />
.........................................................................................................................................................................................................˝..........................................<br />
%funct (arg1 [, arg2...]) [format]<br />
Calling a function<br />
.........................................................................................................................................................................................................˝..........................................<br />
%funct [format]<br />
With no arguments<br />
5-70 <strong>Language</strong> <strong>Reference</strong><br />
%funct() [format]
Sending messages<br />
Summary of TSL substitution<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SEND(method TO %classref [WITH arg1 [, arg2...]]) [format]<br />
Send to a class<br />
.........................................................................................................................................................................................................˝..........................................<br />
Send to an instance &SEND(method TO %instanceref [WITH arg1 [, arg2...]])<br />
[format]<br />
%instanceref.method[(arg1 [, arg2 ...])] [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SEND(method UP [WITH arg1 [, arg2...]]) [format]<br />
Send message which<br />
resides in parent<br />
%UP.method[(arg1 [, arg2 ...])] [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
%method[(arg1 [, arg2 ...])] [format]<br />
Send to current or<br />
nested instance<br />
reference<br />
.........................................................................................................................................................................................................˝..........................................<br />
%classref.method[(arg1 [, arg2 ...])] [format]<br />
Send to every<br />
instance<br />
Text Substitution <strong>Language</strong> 5-71
Summary of TSL substitution<br />
5-72 <strong>Language</strong> <strong>Reference</strong>
Chapter 6<br />
TSL Commands<br />
.........................................................................................................................................................................................................˝..........................................<br />
Introduction<br />
This chapter describes the syntax of all TSL commands except those related to<br />
certainty. See Appendix A, “Certainty,” for TSL commands for certainty sets.<br />
This chapter provides syntax, explanation, and examples of each command.<br />
At the end of the chapter is a summary of TSL commands.<br />
The following types of commands are described in this chapter:<br />
■ Predefined functions<br />
■ Special characters<br />
■ Text modes<br />
■ White space<br />
■ Margins<br />
■ Formatting tables<br />
■ Developer-definable strings<br />
■ Embedded text<br />
■ Message passing<br />
■ Default formats/masks<br />
■ Comments<br />
■ Report commands<br />
This chapter lists the commands alphabetically, not by category.<br />
TSL Commands 6-1
TSL command syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
In this chapter<br />
6-2 <strong>Language</strong> <strong>Reference</strong><br />
Topic Page<br />
TSL command syntax 6-5<br />
% (percent substitution operator) 6-9<br />
%AES_PAGENUM (current page number) 6-10<br />
%CURRENT (current instance) 6-11<br />
%CURRENTCLASS (current class) 6-12<br />
%CURRENTDATE (current date) 6-14<br />
%CURRENTTIME (current time) 6-15<br />
%INDEX (element number in a list or set) 6-16<br />
%IS (substitution operator) 6-20<br />
%NAMEOF (name of an instance) 6-22<br />
%UP (method in parent class) 6-24<br />
&% (display percent sign) 6-26<br />
&& (display ampersand) 6-27<br />
&( (display opening parenthesis) 6-28<br />
&) (display closing parenthesis) 6-29<br />
&/* (begin comment) 6-32<br />
&. (display period) 6-31<br />
&/* (begin comment) 6-32<br />
&: (display colon) 6-33<br />
&< (display opening angle bracket) 6-34<br />
&> (display closing angle bracket) 6-35<br />
& BLK (mark a block of text) 6-36<br />
&BM (bottom margin) 6-37<br />
&BR (line break) 6-39<br />
continued
TSL command syntax<br />
continued<br />
Topic Page<br />
&C (center line) 6-40<br />
&DDF (date default format) 6-41<br />
&EMP (empty lists, sets, or classes) 6-44<br />
&EMPTBL (empty table) 6-45<br />
&ESC (send escape sequence) 6-46<br />
&FI (fill mode) 6-47<br />
&FOOTER (set footer) 6-49<br />
&IDF (integer default format) 6-51<br />
&INCLUDE (insert text from a file) 6-54<br />
&J (justify mode) 6-56<br />
&LI (left indent) 6-58<br />
&LM (left margin) 6-60<br />
&LN (line numbers) 6-61<br />
< (text in the left margin) 6-63<br />
&MSG (substitute a message) 6-65<br />
&N (number pages) 6-66<br />
&PG (eject page) 6-67<br />
&RDF (real default format) 6-68<br />
&RI (right indent) 6-73<br />
&RM (right margin) 6-74<br />
&RT (text in right margin) 6-75<br />
&SEND (send a message to an object) 6-77<br />
&SK (skip lines) 6-81<br />
&SPC (insert spaces) 6-82<br />
continued<br />
TSL Commands 6-3
TSL command syntax<br />
6-4 <strong>Language</strong> <strong>Reference</strong><br />
continued<br />
Topic Page<br />
&SSPC (set spaces in fill, justify, and table modes) 6-83<br />
&STAB (set tabs) 6-84<br />
&TAB (Move to next tab) 6-85<br />
&TB (table mode) 6-86<br />
&TBL (table) 6-88<br />
&TDF (time default format) 6-96<br />
&TITLE (set title) 6-99<br />
&TM (top margin) 6-101<br />
&UND (unknown values) 6-103<br />
&UNDPTR (unknown pointer) 6-105<br />
Summary of TSL commands 6-106
TSL command syntax<br />
TSL command syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
This section describes the syntax of each TSL command. Following the<br />
syntax you will find remarks and examples to guide you in your use of the<br />
command. The commands are listed in alphabetical order.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Predefined functions<br />
% Display parameter or list element.<br />
%AES_PAGENUM Display the current page number.<br />
%CURRENT Display the current instance.<br />
%CURRENTCLASS Display the current class.<br />
%CURRENTDATE Display the current date.<br />
%CURRENTTIME Display the current time.<br />
%INDEX Display index of current list element, or use one list to<br />
index into other lists.<br />
%IS Display entire list.<br />
%NAMEOF Display the name of an instance.<br />
%UP Send a message up.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Special characters<br />
&% Display '%' character.<br />
&& Display '&' character.<br />
&( Display '(' character.<br />
&) Display ')' character.<br />
&. Display '.' character.<br />
&: Display ':' character.<br />
&< Display '' character.<br />
&ESC Transmit printer control sequences or display graphics<br />
characters.<br />
TSL Commands 6-5
TSL command syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Text modes<br />
6-6 <strong>Language</strong> <strong>Reference</strong><br />
&C Center a line.<br />
&FI Set fill mode.<br />
&J Set justify mode.<br />
&TB Set table mode.<br />
.........................................................................................................................................................................................................˝..........................................<br />
White space<br />
&BR Force a line break.<br />
&SK Skip lines.<br />
&SPC Insert spaces.<br />
&SSPC Set the number of spaces to insert.<br />
&STAB Set tabs stops.<br />
&TAB Position at next tab stop.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Margins<br />
&LI Set left indent for current line.<br />
&LM Set left margin.<br />
&LN Display line numbers in the left margin.<br />
< Set text to display in the left margin.<br />
&RI Set right indent for current line.<br />
&RM Set right margin.<br />
&RT Set text to display in the right margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Formatting tables<br />
&TBL Display a columnar table.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Developer-definable<br />
strings<br />
&EMP Set string to display for empty list/set/class.<br />
&EMPTBL Set string to display for empty table.<br />
&UND Set string to display for unknown value.<br />
&UNDPTR Set string to display for unknown or deleted pointer.
TSL command syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Embedded text<br />
&INCLUDE Insert file into text.<br />
&MSG Insert message into text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Message passing<br />
&SEND Insert message or function return value into text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default<br />
formats/masks<br />
&DDF Set the default format for display of dates.<br />
&IDF Set the default format for display of integers.<br />
&RDF Set the default format for display of real numbers.<br />
&TDF Set the default format for display of times.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Comments<br />
&/* Begin comment.<br />
&*/ End comment.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Report commands<br />
&BLK Keep a block on one page.<br />
&BM Set bottom margin.<br />
&FOOTER Specify report footer.<br />
&N Turn page numbering on or off.<br />
&PG Cause page eject.<br />
&TITLE Specify report title.<br />
&TM Set top margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default and mode<br />
commands<br />
Commands that specify defaults or modes, such as &DDF or &FI, apply until<br />
a new default or mode is specified or until the end of the property in which<br />
they are specified. For example, if you specify a left margin at the beginning<br />
of a message, that margin continues to apply throughout the message until<br />
you change it. After the end of the message, <strong>AionDS</strong> returns to the default<br />
margin.<br />
TSL Commands 6-7
TSL command syntax<br />
6-8 <strong>Language</strong> <strong>Reference</strong><br />
These commands are listed as follows.<br />
&BM &IDF &RDF &TDF<br />
&DDF &J &RM &TITLE<br />
&EMP &LM &RT &TM<br />
&EMPTBL &LN &SSPC &UND<br />
&FI < &STAB &UNDPTR<br />
&FOOTER &N &TB<br />
If the contents of one TSL property are included within another TSL<br />
property, the defaults and modes defined in one property continue to apply in<br />
the other. For example, if you use &UNDPTR in a TSL property and later in<br />
the property you use the &MSG command, the default will continue to apply<br />
in the included message. Likewise, if you include a message with &MSG and<br />
the included message contains the &UNDPTR command, the default will<br />
continue to apply when <strong>AionDS</strong> returns to the first property.
% (percent substitution operator)<br />
% (percent substitution operator)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the percent sign ( % ) to substitute a class, instance, parameter or slot<br />
value, or the next element of a list or set. You may follow the percent sign<br />
with formatting instructions.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]object[format]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the class, instance, parameter, or<br />
slot exists. The library name is only required when duplicate class, instance,<br />
parameter, or slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
object<br />
is the name of a class, instance, parameter, slot, list element, or set element.<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to the type of value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remark<br />
The formatting instructions in format must be appropriate to the type of<br />
substitution. For example, if % represents an integer value, format can be a<br />
colon format for integers or an integer mask.<br />
For more information: See Chapter 5, “Text Substitution <strong>Language</strong>,”<br />
about formatting each type of value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
SLOT1 is a slot of the current instance, and SLOT1 is not a list or set. The<br />
percent sign in the following statement displays the value of SLOT1.<br />
%slot1<br />
TSL Commands 6-9
%AES_PAGENUM (current page number)<br />
%AES_PAGENUM (current page number)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-10 <strong>Language</strong> <strong>Reference</strong><br />
Use %AES_PAGENUM to display the current page number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%AES_PAGENUM[format]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to integer values.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ %AES_PAGENUM displays the current page number according to the<br />
format specified. You can use this command wherever you can use<br />
parameter substitution.<br />
■ The formatting instructions in format must be appropriate to integer<br />
values.<br />
For more information: See the “Integer values” section in Chapter 5,<br />
“Text Substitution <strong>Language</strong>,” about appropriate formatting.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement centers the word Page plus the current page<br />
number.<br />
&cPage %aes_PageNum
%CURRENT (current instance)<br />
%CURRENT (current instance)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use %CURRENT to display the current instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CURRENT[format]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to instances.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ %CURRENT is equivalent to the KDL function CURRENT.<br />
Remarks<br />
■ You can only use %CURRENT when the current instance is known within<br />
a class. For example, you can use %CURRENT in a report that is printed<br />
as a result of a message being sent to an instance. Note that you cannot<br />
use it if the message is sent to a class rather than an instance.<br />
■ You can use %CURRENT in any syntax where instance substitution is<br />
allowed.<br />
■ The formatting instructions in format must be appropriate to instances.<br />
For more information: See the “Displaying slot values” section in<br />
Chapter 5, “Text Substitution <strong>Language</strong>,” about appropriate formatting.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following example displays all slot names and values for the current<br />
instance in the default format:<br />
%current<br />
If the instance in the example above has slots SIZE, WEIGHT, and COLOR,<br />
with the values medium, 3.5, and green, the following output will be<br />
produced:<br />
size: medium, weight: 3.50 and color: green<br />
The following TSL text sends a message to the current instance to execute the<br />
method PRINT_SUMMARY:<br />
&send(print_summary to %current)<br />
TSL Commands 6-11
%CURRENTCLASS (current class)<br />
%CURRENTCLASS (current class)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-12 <strong>Language</strong> <strong>Reference</strong><br />
Use %CURRENTCLASS function to display the current class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CURRENTCLASS[format]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to classes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ %CURRENTCLASS is equivalent to the KDL function CURRENTCLASS.<br />
Remarks<br />
■ You can only use %CURRENTCLASS when the current class is known.<br />
For example, you can use %CURRENTCLASS in a report that is printed as<br />
a result of a message being sent to an instance or a class.<br />
■ You can use %CURRENTCLASS in place of any class substitution, with<br />
the following exceptions. You cannot substitute %CURRENTCLASS for<br />
class_name in the following two types of syntax:<br />
%class_name(instance_name)<br />
%class_name(%string_subst)<br />
In the above syntax, instance_name is the name of a static instance, and<br />
string_subst is a parameter or slot whose type is string and whose value is<br />
the name of an instance.<br />
■ The formatting instructions in format must be appropriate to classes.<br />
For more information: See the “Displaying values from multiple<br />
instances” section in Chapter 5, “Text Substitution <strong>Language</strong>,” about<br />
appropriate formatting.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following example displays out all slot values of all instances of the<br />
current class in the default format.<br />
%currentclass<br />
The following example refers to the class STUDENTS and its subclasses:<br />
FRESHMEN, SOPHOMORES, JUNIORS, and SENIORS. The TSL text displays
%CURRENTCLASS (current class)<br />
the name and grade point average for all students in a certain grade. This one<br />
statement displays slot values for instances of any subclass.<br />
&tbl < %currentclass.name %currentclass.gpa ><br />
The following example sends a message to the current class. You can use this<br />
syntax when the current object is either a class or an instance.<br />
%send (print_summary to %currentclass)<br />
Tip: This is the only syntax that sends a message to a class. If you use<br />
another syntax, such as %CURRENTCLASS.PRINT_SUMMARY, <strong>AionDS</strong> sends<br />
the message to every instance in the class, not to the class as a whole.<br />
TSL Commands 6-13
%CURRENTDATE (current date)<br />
%CURRENTDATE (current date)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-14 <strong>Language</strong> <strong>Reference</strong><br />
Use the function %CURRENTDATE to display the current date.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CURRENTDATE[format]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to date values.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ %CURRENTDATE is equivalent to the KDL function CURRENTDATE.<br />
Remarks<br />
■ %CURRENTDATE displays the current date according to the format<br />
specified. You can use this command wherever you can use parameter<br />
substitution.<br />
■ The formatting instructions in format must be appropriate to date values.<br />
For more information: See the “Date values” section in Chapter 5,<br />
“Text Substitution <strong>Language</strong>,” for information about appropriate<br />
formatting.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following line in the Report Body property of a report object displays the<br />
current date in the report.<br />
%currentdate
%CURRENTTIME (current time)<br />
%CURRENTTIME (current time)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the function %CURRENTTIME to display the current time. You can use<br />
it wherever you can use parameter substitution.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CURRENTTIME[format]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to time values.<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ %CURRENTTIME is equivalent to the KDL function CURRENTTIME.<br />
Remarks<br />
■ %CURRENTTIME displays the current time according to the format<br />
specified. You can use this command wherever you can use parameter<br />
substitution.<br />
■ The formatting instructions in format must be appropriate to time values.<br />
For more information: See the “Time values” section in Chapter 5,<br />
“Text Substitution <strong>Language</strong>,” for information about appropriate<br />
formatting.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following line in the Report Body property of a report object displays the<br />
current time in the report.<br />
Incident reported: %currenttime<br />
TSL Commands 6-15
%INDEX (element number in a list or set)<br />
%INDEX (element number in a list or set)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-16 <strong>Language</strong> <strong>Reference</strong><br />
Use the %INDEX command to display the element number for a set or list.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%INDEX[:[-]width]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions for display of the element number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If width is not used, or is zero, the element number is displayed without<br />
surrounding spaces.<br />
■ If the minus sign ( - ) is present, the element number is left-justified;<br />
otherwise it is right-justified.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The parameter CITIES holds a list of strings. Its value includes the following<br />
items as elements 8 through 10:<br />
'San Francisco', 'Chicago', 'Baltimore'<br />
The following TSL command uses %INDEX to display the number of each<br />
element before the element:<br />
%cities<br />
The following lines are a portion of the output:<br />
8 San Francisco<br />
9 Chicago<br />
10 Baltimore<br />
The following TSL statement allows two spaces for the number of each<br />
element:<br />
%cities
The following lines are a portion of the output:<br />
8 San Francisco<br />
9 Chicago<br />
10 Baltimore<br />
%INDEX (element number in a list or set)<br />
The following TSL statement left justifies the number of each element within<br />
four spaces:<br />
%cities<br />
The following lines are a portion of the output:<br />
8 San Francisco<br />
9 Chicago<br />
10 Baltimore<br />
The following example displays a period after the index numbers:<br />
%cities<br />
The following lines are a portion of the output:<br />
8. San Francisco<br />
9. Chicago<br />
10. Baltimore<br />
Side-by-side display of list or set elements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can display the contents of two or more lists or sets side-by-side using the<br />
%INDEX function. To do this, you write a TSL statement that uses the index<br />
values of one list to control the values printed from other lists.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
Consider the following example. Three parameters, LIST1, LIST2, and LIST3,<br />
have the base type of INTEGER_LIST. These parameters have the following<br />
values:<br />
list1 contains (10,20,30,40)<br />
list2 contains (21,22,23,24)<br />
list3 contains (11,22,33,44)<br />
TSL Commands 6-17
%INDEX (element number in a list or set)<br />
6-18 <strong>Language</strong> <strong>Reference</strong><br />
The following TSL statement displays the three lists in a three-column<br />
format.<br />
%list1 < % < % &tab %list2(%index) &tab %list3(%index) ><br />
&br ><br />
.........................................................................................................................................................................................................˝..........................................<br />
Explanation<br />
The following list explains each part of this statement, from the outer sections<br />
inward and from left to right:<br />
■ %LIST1 < ... > initializes the index number to 1 and displays the value of<br />
the parameter list1 according to the format in the brackets.<br />
■ % < ... > displays the element that corresponds to the index number,<br />
according to the format in the brackets. When finished, it increments<br />
the index.<br />
■ % displays the element.<br />
■ &TAB goes to the next tab stop.<br />
■ %LIST2(%INDEX) displays the element of LIST2 that has the same index<br />
number as the current LIST1 index.<br />
■ &TAB goes to the next tab stop.<br />
■ %LIST3(%INDEX) displays the element of LIST3 that has the same index<br />
number as the current LIST1 index.<br />
■ &BR goes to the next line before displaying the next element of LIST1.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Incrementing the<br />
index counter<br />
Because of the use of % < ... > within this statement, <strong>AionDS</strong> displays values<br />
from each element of the list before incrementing the index counter. If you<br />
do not use this syntax, you must make sure that the index counter is<br />
incremented at the proper time.<br />
<strong>AionDS</strong> increments the index counter after displaying the indexed value.<br />
Thus, when you want to display several values according to the index<br />
counter, you must display the indexed value last.
%INDEX (element number in a list or set)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Alternative<br />
The following statement produces the same result as the example above.<br />
Note that this statement uses the index counter on LIST3 in order to<br />
increment the counter after values from each list have been displayed.<br />
%list3 <br />
TSL Commands 6-19
%IS (substitution operator)<br />
%IS (substitution operator)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-20 <strong>Language</strong> <strong>Reference</strong><br />
You can display the current instance with the %IS operator.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%IS[format]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to the type of value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ When %IS is not inside angle brackets ( < > ), it represents the current<br />
instance. You can use it exactly as you would %CURRENT or %. You<br />
should always use %CURRENT to refer to the current instance.<br />
■ When %IS is within angle brackets, it represents the value of the object<br />
to the left of the brackets.<br />
■ The formatting instructions in format must be appropriate to the type of<br />
substitution. For example, if %IS represents an integer value, format can<br />
be a colon format for integers or an integer mask.<br />
For more information: See Chapter 5, “Text Substitution <strong>Language</strong>,”<br />
for information about formatting each type of value.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
SLOT1 is a slot of the current instance. The following statement displays the<br />
value of SLOT1.<br />
%slot1<br />
The following message formats and displays the values of the parameters<br />
OLD_LIMIT, LAST_UPDATE, NEW_PURCHASE, and CREDIT_LIMIT:<br />
%old_limit %last_update<br />
<br />
%new_purchase <br />
%credit_limit
The statements result in the following message:<br />
Old credit limit: 10000.00 1-Jan-1990<br />
Amount of purchase: 500.00<br />
New credit limit: 12000.00<br />
%IS (substitution operator)<br />
TSL Commands 6-21
%NAMEOF (name of an instance)<br />
%NAMEOF (name of an instance)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-22 <strong>Language</strong> <strong>Reference</strong><br />
Use the NAMEOF statement to display the name of an instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%NAMEOF(instance)[format]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
instance<br />
is TSL text that evaluates to an instance or a pointer. The following list<br />
shows valid TSL text that you can use for instance:<br />
%<br />
%current<br />
%is<br />
%[library::]ptr<br />
%[library::]ptr*<br />
library is the name of the included library in which the parameter or<br />
slot exists. The library name is only required when duplicate<br />
parameter or slot names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
ptr is the name of a parameter or slot whose type evaluates to<br />
pointer.<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to string values.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ %NAMEOF displays the name of an instance in output text.<br />
■ You can only use %CURRENT within a class when the current instance is<br />
known. For example, you can use %CURRENT in a report that is printed<br />
as a result of a message being sent to an instance. Note that you cannot<br />
use it if the message is sent to a class.<br />
■ %NAMEOF(%ptr) displays the instance name only. Use %ptr to display<br />
the full instance name including the owning class.
%NAMEOF (name of an instance)<br />
■ %ptr* dereferences the pointer, using the instance itself rather than the<br />
pointer to the instance. The %NAMEOF function produces the same<br />
result for %ptr* as for %ptr.<br />
■ If the value of ptr is unknown, <strong>AionDS</strong> displays the string defined in the<br />
&UNDPTR command, if available, or the following string:<br />
NUL<br />
■ The formatting instructions in format must be appropriate to string<br />
values.<br />
For more information: See “String values” in Chapter 5, “Text<br />
Substitution <strong>Language</strong>,” for information about formatting strings.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The two following TSL statements are equivalent. Each displays the name of<br />
every instance of truck, with each name on a separate line.<br />
%truck<br />
%truck<br />
The following text displays the text INSTANCE NAME = followed by the name<br />
of the current instance.<br />
instance name = %nameof(%current)<br />
In the following example, TRUCKPTR is the name of a parameter whose type<br />
is pointer. TRUCKPTR points to an instance of the class TRUCK. The two<br />
TSL statements are equivalent. Each displays the name of the instance<br />
referenced by the pointer.<br />
%nameof(%truckptr)<br />
%nameof(%truckptr*)<br />
TSL Commands 6-23
%UP (method in parent class)<br />
%UP (method in parent class)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-24 <strong>Language</strong> <strong>Reference</strong><br />
Use %UP to execute a method which resides in the parent of the current class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%up.method[(arg [, arg ...])] [format]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
method<br />
is the name of a method.<br />
.........................................................................................................................................................................................................˝..........................................<br />
arg<br />
is an argument to the function attached to the method.<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to the type of value returned.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ %UP sends a message to the current instance. The method associated<br />
with the message must be defined in the parent of the current class.<br />
■ The object attached to the method must be a message or a function. The<br />
message or return value is embedded exactly as it would be using the<br />
&MSG statement or a function call.<br />
■ The use of arg or format with %UP is only appropriate when the attached<br />
object of the method is a function.<br />
■ TSL uses the formatting instructions in format to display the value<br />
returned from the function attached to the method. For this reason,<br />
format must be appropriate to the type of value returned. For example, if<br />
the function attached to method returns an integer, format can be a colon<br />
format for integers or an integer mask.<br />
For more information: See Chapter 5, “Text Substitution <strong>Language</strong>,”<br />
about formatting each type of value.<br />
■ Refer to &SEND in this chapter for another way to execute a method.
%UP (method in parent class)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement sends a message to the current instance. The<br />
ORDERTOTAL method is defined in the parent of the current class. The<br />
method returns a real number, which is formatted with a width of 10 and<br />
precision of 2.<br />
%up.OrderTotal:10:2<br />
TSL Commands 6-25
&% (display percent sign)<br />
&% (display percent sign)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-26 <strong>Language</strong> <strong>Reference</strong><br />
Use &% to display the percent character ( % ) in TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&%<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
The percent character is a special character in TSL because it is used in TSL<br />
commands. To display the character itself in TSL text, use the &%<br />
command. This command is required any time you display a percent<br />
character with TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement displays the percent character after the value of<br />
PCT_INCREASE:<br />
Increase in value %pct_increase&%
&& (display ampersand)<br />
&& (display ampersand)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use && to display the ampersand character ( & ) in TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&&<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
The ampersand character is a special character in TSL because it is used in<br />
TSL commands. To display the character itself in TSL text, use the &&<br />
command. This command is required any time you display an ampersand<br />
character in TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement displays the ampersand character in the title of a<br />
report:<br />
&cAnalysis && Results<br />
TSL Commands 6-27
&( (display opening parenthesis)<br />
&( (display opening parenthesis)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-28 <strong>Language</strong> <strong>Reference</strong><br />
Use &( to display an opening parenthesis in TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&(<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The opening parenthesis is a special character in TSL because it is used in<br />
TSL substitution and command syntax. To display an opening<br />
parenthesis immediately after a TSL substitution, use the &( command.<br />
■ The &( command is not required to display parentheses that are not<br />
immediately following a TSL value substitution.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statement displays (BEST TO WORST) after displaying all<br />
elements of the list parameter WINNERS. The &( command is required<br />
because a parenthesis character in that location would indicate the display of<br />
a particular element of WINNERS.<br />
Winners: %winners &(Best to Worst&)<br />
The following statement displays parentheses around the word DRAFT in the<br />
title of a report. The &( command is not required because the parenthesis<br />
does not immediately follow a TSL value substitution or a command.<br />
&cRecommendations (Draft)
&) (display closing parenthesis)<br />
&) (display closing parenthesis)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &) to display a closing parenthesis in TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&)<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The closing parenthesis is a special character in TSL because it is used in<br />
TSL substitution. Use &) to display the character.<br />
■ The &) command is never required. You might use it for clarity when<br />
you display parentheses that are immediately following a TSL value<br />
substitution.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement displays (BEST TO WORST) after displaying all<br />
elements of the list parameter WINNERS. The &) command, though not<br />
required, clearly identifies that the closing parenthesis is part of the text to be<br />
displayed rather than part of a TSL substitution.<br />
Winners: %winners &(Best to Worst&)<br />
TSL Commands 6-29
&*/ (close comment)<br />
&*/ (close comment)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-30 <strong>Language</strong> <strong>Reference</strong><br />
Use the &*/ command to indicate the end of a block of comments.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&/* comment &*/<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
comment<br />
is a comment.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &*/ closes a comment block. All characters in the comment block<br />
are ignored by <strong>AionDS</strong>.<br />
■ The comment can be longer than one line and include carriage returns,<br />
line feeds, or other special characters.<br />
■ A carriage return immediately after the end of a comment is part of the<br />
display text, not part of the comment.<br />
■ You can nest comments.<br />
■ You can override carriage returns in the text by placing a &/* at the end<br />
of the line and a &*/ and the beginning of the next line.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement uses comments to cancel the effect of a line break<br />
and to include a note in the text.<br />
This is a single line &/*<br />
&*/of display text. &/* Sample Line &*/
&. (display period)<br />
&. (display period)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &. to display a period in TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&.<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The period character is a special character in TSL because it is used in<br />
TSL substitution. Use &. to display the period character.<br />
■ The &. command is not required to display a period that is not<br />
immediately following a TSL value substitution.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement displays all slots of the current instance, followed by<br />
a period.<br />
The values of the current instance are %current&.<br />
TSL Commands 6-31
&/* (begin comment)<br />
&/* (begin comment)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-32 <strong>Language</strong> <strong>Reference</strong><br />
Use the &/* and &*/ commands to create blocks of comments.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&/* comment &*/<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
comment<br />
is a comment.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &/* opens a comment block. The &*/ closes a comment block. All<br />
characters in the comment block are ignored by <strong>AionDS</strong>.<br />
■ The comment can be longer than one line and include carriage returns,<br />
line feeds, or other special characters.<br />
■ A carriage return immediately after the end of a comment is part of the<br />
display text, not part of the comment.<br />
■ You can nest comments.<br />
■ You can override carriage returns in the text by placing a &/* at the end<br />
of the line and a &*/ and the beginning of the next line.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
This is a single line &/*<br />
&*/of display text. &/* Sample Line &*/
&: (display colon)<br />
&: (display colon)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &: to display a colon in TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&:<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The colon ( : ) is a special character in TSL because it is used in TSL<br />
substitution syntax. To display a colon immediately after a TSL<br />
substitution, use the &: command.<br />
■ The &: command is not required to display a colon that is not<br />
immediately following a TSL value substitution.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
In the following TSL statement, &: is required after the value of CUST_NO.<br />
Without the ampersand, the colon would be interpreted as an illegal<br />
formatting command:<br />
Credit limit for %customer.cust_no&: %old_limit:10:2<br />
TSL Commands 6-33
&< (display opening angle bracket)<br />
&< (display opening angle bracket)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-34 <strong>Language</strong> <strong>Reference</strong><br />
Use &< to display an opening angle bracket in TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&<<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The opening angle bracket ( < ) is a special character in TSL because it is<br />
used in TSL substitution syntax. To display an opening bracket, use the<br />
&< command.<br />
■ The &< command is always required to display an opening angle bracket<br />
in TSL.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement displays an opening angle bracket in TSL text:<br />
Hit F1 if age &< 21<br />
This statement produces the following message:<br />
Hit F1 if age < 21
&> (display closing angle bracket)<br />
&> (display closing angle bracket)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &> to display a closing angle bracket in TSL text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&><br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The closing angle bracket ( > ) is a special character in TSL because it is<br />
used in TSL substitution syntax. To display a closing bracket, use the<br />
&> command.<br />
■ The &> command is always required to display a closing angle bracket in<br />
TSL.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement displays a closing angle bracket in TSL text:<br />
Hit F1 if age &>= 21<br />
This statement produces the following message:<br />
Hit F1 if age >= 21<br />
TSL Commands 6-35
& BLK (mark a block of text)<br />
& BLK (mark a block of text)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-36 <strong>Language</strong> <strong>Reference</strong><br />
Use the &BLK command to mark a block of text in a report.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&BLK{ + | - }<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &BLK command is useful for setting up a block of text that you do<br />
not want divided between two pages. For example, you can define the<br />
heading and body of a table as a block. This action prevents <strong>AionDS</strong><br />
from displaying the heading on one page and the body on the next page.<br />
■ The &BLK+ command specifies the beginning of a block. The &BLKcommand<br />
terminates the block.<br />
■ If <strong>AionDS</strong> cannot display the entire block on the remainder of the page,<br />
<strong>AionDS</strong> displays the block starting at the top of the next page.<br />
■ You do not need a &BLK- command after each &BLK+ command. For<br />
example, if you specify two &BLK+ commands without an intervening<br />
&BLK- command, <strong>AionDS</strong> operates as if a &BLK- command comes<br />
immediately prior to the second &BLK+ command. A BLK- command by<br />
itself has no effect.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following report forces the table heading and body to be displayed on the<br />
same page:<br />
&blk+<br />
Customer No. Credit Limit Payment History Credit Status<br />
------------ ------------ --------------- - ------------<br />
%customer_list <br />
&blk-
&BM (bottom margin)<br />
&BM (bottom margin)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &BM command to set the bottom margin of a report.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&BM[ + | - ] number<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is either the relative or absolute position of the margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The plus ( + ) and minus ( - ) sign options move the margin up and<br />
down, respectively, in relation to the current margin.<br />
■ If you do not specify relative positioning using the plus or minus sign,<br />
number represents the absolute position for the margin.<br />
■ Absolute margins are measured in lines from the bottom of the report.<br />
Thus, the following command sets the margin five lines from the bottom<br />
of the page:<br />
&bm 5<br />
■ The default margin is specified in the Bottom Margin property of the<br />
report object.<br />
■ If you want to use a footer or page numbers, you must specify at least one<br />
line for the bottom margin.<br />
■ If the top and bottom margins are both zero, printing is continuous.<br />
Page eject commands are ignored.<br />
■ This command works in reports and in messages that are included in<br />
reports. If you put it in any other TSL property, <strong>AionDS</strong> ignores the<br />
command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statement sets the bottom margin two lines higher on the page<br />
than the current margin.<br />
&bm+2<br />
TSL Commands 6-37
&BM (bottom margin)<br />
6-38 <strong>Language</strong> <strong>Reference</strong><br />
The following statement lowers the bottom margin three lines from its<br />
current position.<br />
&bm-3<br />
The following statement sets the bottom margin at six lines from the bottom<br />
of the page.<br />
&bm6
&BR (line break)<br />
&BR (line break)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &BR to force a line break.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&BR<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
In fill, justify, or table modes, you must use this command to cause a line<br />
break. In default formatting, you can either use this command or enter a line<br />
break directly in the text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statements use the &BR command to insert a blank line<br />
between the first and second lines of text, and to cause line breaks after the<br />
values of the slots OLD_LIMIT and PAYMENT_HIST.<br />
Credit information for Customer No. %customer.cust_no &br<br />
&br<br />
Credit Limit: %customer.old_limit &br<br />
Payment History: %customer.payment_hist &br<br />
The following statement displays the values of the slots ACCT_NO and NAME<br />
for every instance of the class ACCOUNTS. The &BR command causes the<br />
values for each instance to be displayed on a separate line.<br />
%accounts<br />
TSL Commands 6-39
&C (center line)<br />
&C (center line)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-40 <strong>Language</strong> <strong>Reference</strong><br />
Use &C to center a line.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&C<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ When this command appears at the beginning of a line, it centers the<br />
entire line of text.<br />
■ When this command appears within a line of text, it causes a line break<br />
and then centers the text that follows it.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following TSL commands create a centered heading, whether in fill,<br />
justify, or default mode.<br />
&cPLATINUM technology, inc.&c555 Twin Dolphin Dr.,<br />
Ste.400&cRedwood City, CA&br<br />
This produces the following output:<br />
PLATINUM technology, inc.<br />
555 Twin Dolphin Dr., Ste.400<br />
Redwood City, CA
&DDF (date default format)<br />
&DDF (date default format)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &DDF to set the default format for the display of dates.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&DDF ([dfmt,] 'mask')<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
dfmt<br />
is one of the following options:<br />
D specifies use of a date mask to display dates. This is the default.<br />
J specifies Julian date display, which is the number of days since<br />
the beginning of the year, inclusive.<br />
A specifies display of dates as the number of days since January 1,<br />
1900, inclusive.<br />
.........................................................................................................................................................................................................˝..........................................<br />
mask<br />
is either a date mask or integer mask.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You can reset the date default format to its initial format with the<br />
following command:<br />
&ddf ('D1-N1-Y2')<br />
■ If you use the J or A dfmt, you must specify an integer mask.<br />
■ Date masks can contain the following symbols:<br />
D specifies a one- or two-digit day of the month (for example,<br />
3 or 24).<br />
D1 specifies a two-digit day of the month. A blank space<br />
(shown as in the example) is used with numbers less than<br />
10 (for example, 3 or 24).<br />
D2 specifies a two-digit day of the month. A zero is used with<br />
numbers less than 10 (for example, 03 or 24).<br />
TSL Commands 6-41
&DDF (date default format)<br />
6-42 <strong>Language</strong> <strong>Reference</strong><br />
X specifies an ordinal abbreviation in upper case (ST, ND,<br />
RD, TH). Use this in addition to specifications for the day,<br />
month, and year.<br />
X1 specifies an ordinal abbreviation in lower case (st, nd, rd, th).<br />
Use this in addition to specifications for the day, month, and<br />
year.<br />
M specifies a one- or two-digit month (for example, 3 or 11).<br />
M1 specifies a two-digit month. A blank space is used with<br />
numbers less than 10 (for example, 3 or 11).<br />
M2 specifies a two-digit month. A zero is used with numbers<br />
less than 10 (for example, 03 or 11).<br />
N specifies a three-character abbreviation of the month, in all<br />
upper case (for example, MAR).<br />
N1 specifies a three-character abbreviation of the month, with<br />
the first letter in upper case (for example, Mar).<br />
N2 specifies a three-character abbreviation of the month, in all<br />
lower case (for example, mar).<br />
NN specifies the complete month name, in all upper case (for<br />
example, MARCH).<br />
NN1 specifies the complete month name, with the first letter in<br />
upper case (for example, March).<br />
NN2 specifies the complete month name, in all lower case (for<br />
example, march).<br />
Y specifies a one- or two-digit year (for example, 3 or 90).<br />
Y1 specifies a two-digit year. A blank space is used with<br />
numbers less than 10 (for example, 3 or 90).<br />
Y2 specifies a two-digit year. A zero is used with numbers less<br />
than 10 (for example, 03 or 90).<br />
Z specifies a four-digit year (for example, 1903 or 1990).<br />
For more information: See “&IDF (integer default format)” on page 6-51<br />
for information about integer masks in TSL.
&DDF (date default format)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statement sets the date default format to display the full month<br />
name, the day of the month followed by ST, ND, RD, or TH, and the four-digit<br />
year.<br />
&ddf ('nn1 dx1, z')<br />
The following command is equivalent:<br />
&ddf (d, 'nn1 dx1, z')<br />
The following command sets the date default format to display dates in threedigit<br />
Julian format.<br />
&ddf(j, '990')<br />
TSL Commands 6-43
&EMP (empty lists, sets, or classes)<br />
&EMP (empty lists, sets, or classes)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-44 <strong>Language</strong> <strong>Reference</strong><br />
Ordinarily, when TSL displays a value that is UNKNOWN, and the value is a<br />
list, set, or class, TSL displays the string * EMPTY LIST *. You can change this<br />
default display with the &EMP command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&EMP 'string'<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
string<br />
is the string that replaces the default display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &EMP command replaces * EMPTY LIST * with string when a list, set,<br />
or class is empty or unresolved.<br />
■ If you want to include an ampersand ( & ) or angle brackets ( ) within<br />
a quoted string, you must precede them with an ampersand.<br />
■ If the list, set, or class is formatted to print in less space than is needed to<br />
print string, string will be truncated within the space allowed.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following lines appear in the text of a message. PREFERENCES is a list<br />
parameter. (The &FI+ command prevents a blank line from appearing<br />
between the two lines of text.)<br />
&fi+<br />
Customer Preferences: %preferences &br<br />
&emp 'None at this time'<br />
Customer Preferences: %preferences<br />
If the parameter PREFERENCES is empty or unresolved at the time this<br />
message is displayed, the following text would appear in the message.<br />
Customer Preferences: * Empty List *<br />
Customer Preferences: None at this time<br />
If a later message displayed an unresolved list parameter, without using<br />
&EMP within the text of that message, * EMPTY LIST * would again be<br />
displayed.
&EMPTBL (empty table)<br />
&EMPTBL (empty table)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
The &EMPTBL command specifies text to be displayed when no data is<br />
available for a table. If <strong>AionDS</strong> tries to display a table but finds that all the<br />
columns refer to empty lists, it displays the string specified in the &EMPTBL<br />
command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&EMPTBL 'string'<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
string<br />
is the string that replaces the default text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &EMPTBL command works in conjunction with the &TBL<br />
command.<br />
■ <strong>AionDS</strong> uses the following default string if you do not specify another<br />
with the &EMPTBL command:<br />
* Empty Table *<br />
■ If you want to include an ampersand ( & ) or angle brackets ( ) within<br />
a quoted string, you must precede them with an ampersand.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following example specifies that the string NO INFORMATION<br />
AVAILABLE be displayed for empty tables.<br />
&EMPTBL 'No Information Available'<br />
TSL Commands 6-45
&ESC (send escape sequence)<br />
&ESC (send escape sequence)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-46 <strong>Language</strong> <strong>Reference</strong><br />
Use the &ESC command to transmit escape sequences, such as printer control<br />
sequences.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&ESC (byte [,byte...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
byte<br />
is a number representing a character.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
A byte can be a number in either decimal or hexadecimal. You must precede<br />
every hexadecimal number with a pound sign ( # ).<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following commands, which start underlining on some printers, are<br />
equivalent:<br />
&esc (27,67)<br />
&esc (#1B,#43)
&FI (fill mode)<br />
&FI (fill mode)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Fill mode formats the text to fill the area within the margins. The output<br />
lines create a ragged right margin. You can switch into and out of the fill<br />
formatting mode with the &FI command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&FI{ + | - }<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &FI command followed by the plus sign ( + ) cancels the previous<br />
mode and sets the current mode to fill mode.<br />
■ The &FI command followed by the minus sign ( - ) cancels fill mode and<br />
returns to the previous mode.<br />
■ In fill mode, groups of spaces and line breaks are replaced by a single<br />
space character before the output is formatted.<br />
■ In fill mode, <strong>AionDS</strong> displays two spaces after each period, exclamation<br />
point, or question mark that is followed by one or more blank spaces.<br />
For example, if a period, exclamation point, or question mark is followed<br />
by three spaces, <strong>AionDS</strong> replaces the three spaces with two. If one of<br />
these punctuation marks is followed by one space, <strong>AionDS</strong> replaces the<br />
one with two. If it is followed by another character with no blank spaces,<br />
<strong>AionDS</strong> does not insert any blank spaces.<br />
■ If you want to display more than one space between words or less than<br />
two spaces after a period, question mark, or exclamation point, you must<br />
temporarily return to the default formatting mode or use the &SPC<br />
command. For example, the following portion of TSL text preserves one<br />
space after the period in the string ST. PAUL:<br />
&fi+<br />
Several aspects of the city of &fi-St. Paul&fi+ contribute<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following TSL statements use &FI to display the first sentence in a filled<br />
format. The length of this sentence varies depending on the values of the<br />
Boolean slots COSTLY, FAMILY, and SPORTY. Fill mode causes the text to<br />
wrap within the margins regardless of the length of the sentence. In this<br />
example, fill mode is cancelled in order to format the customer information.<br />
TSL Commands 6-47
&FI (fill mode)<br />
6-48 <strong>Language</strong> <strong>Reference</strong><br />
&fi +<br />
The car of your dreams<br />
%costly <br />
<br />
%family <br />
%sporty .<br />
&fi -<br />
%customer <<br />
Customer No. %cust_no:17<br />
Credit Limit: %old_limit:17:2<br />
Payment History: %payment_hist:17<br />
><br />
The example above produces the following text when COSTLY and SPORTY<br />
are true and FAMILY is false:<br />
The car of your dreams , though a bit expensive, is the<br />
fastest car of the lot and will be the envy of all your<br />
friends at work.<br />
Customer No. 12345123451234512<br />
Credit Limit: 50000.00<br />
Payment History: ..... excellent
&FOOTER (set footer)<br />
&FOOTER (set footer)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &FOOTER command to set a footer that will appear at the bottom of<br />
every page of a report.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&FOOTER [text | ]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
text<br />
is the text that <strong>AionDS</strong> displays as a footer.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you do not enclose the text within angle brackets ( < > ), the text<br />
cannot extend past the end of the input line and cannot contain TSL<br />
commands or value substitution.<br />
■ If you do not enclose the footer text in angle brackets and the bottom<br />
margin is greater than one, the footer prints on the second line from the<br />
bottom, regardless of the margin setting. If the margin is one, the footer<br />
prints on the bottom line. If the margin is zero, the footer is not printed.<br />
■ If you do not enclose the text in angle brackets, the footer is centered on<br />
the line. Specifically, it is centered between position 1 and the line<br />
length.<br />
■ If you do not enclose the text in angle brackets, and if you do not use the<br />
&N- command, <strong>AionDS</strong> prints the page number at the end of the footer<br />
line preceded by the following text and a blank space:<br />
page:<br />
■ If you enclose the text within angle brackets, the text can extend for<br />
multiple lines, can contain TSL commands, and can contain value<br />
substitution.<br />
■ If you enclose the text within angle brackets, the text prints starting at the<br />
bottom margin. It does not extend past the bottom of the page.<br />
■ If you enclose the text within angle brackets, you can use any TSL<br />
command except the following ones: &BLK, &BM, &FOOTER, &LN,<br />
&N, &PG, &TBL, &TITLE, &TM.<br />
TSL Commands 6-49
&FOOTER (set footer)<br />
6-50 <strong>Language</strong> <strong>Reference</strong><br />
■ If you enclose the text within angle brackets, <strong>AionDS</strong> performs the<br />
following actions before printing the footer:<br />
❐ Fill mode is cancelled<br />
❐ Justify mode is cancelled<br />
❐ Table mode is cancelled<br />
❐ Line numbering is cancelled<br />
❐ Left margin is set to 1<br />
❐ Right margin is set to the line length<br />
After printing the footer, <strong>AionDS</strong> resets all modes, margins, and defaults<br />
to their previous settings, including any of these that have been reset<br />
within the &FOOTER command.<br />
■ This command works in reports and in messages that are included in<br />
reports. If you put it in any other TSL property, <strong>AionDS</strong> ignores the<br />
command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The first example prints the text 3rd Quarter, 1987 centered on the<br />
bottom of every page. The second example prints the page number centered<br />
at the bottom of every page.<br />
&footer 3rd Quarter, 1987<br />
&footer
&IDF (integer default format)<br />
&IDF (integer default format)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &IDF to set the default format for the display of integers. For example,<br />
using the &IDF command in a report object at the beginning of the report<br />
text property sets the default integer format for the entire report.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&IDF ('mask'[,'mask'])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
mask<br />
is an integer mask that can contain the following symbols:<br />
9 reserves space for a decimal digit. The default display is a space.<br />
0 reserves space for a decimal digit. The default display is a zero.<br />
* reserves space for a decimal digit. The default display is an asterisk.<br />
N reserves space for a decimal digit. The default display is nothing.<br />
B reserves space for a binary digit. The default display is a zero.<br />
H reserves space for a hexadecimal digit. The default display is a zero.<br />
, specifies commas between every three digits.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you specify two masks, <strong>AionDS</strong> uses the first one for positive numbers<br />
and the second one for negative numbers. On the second mask, the first<br />
mask character is reserved for the sign. You should allow enough space<br />
for the sign and the number.<br />
■ If you specify only one mask, the mask is used for both positive and<br />
negative numbers. If the number is negative, the first character of the<br />
mask is replaced by a minus sign ( - ).<br />
■ If you only use nines (9...) in the mask, <strong>AionDS</strong> blank fills all positions<br />
to the left of the most significant digit.<br />
■ If you only use zeros (0...) in the mask, <strong>AionDS</strong> zero fills all positions to<br />
the left of the most significant digit.<br />
■ If you only use asterisks (*...) in the mask, <strong>AionDS</strong> asterisk fills all<br />
positions to the left of the most significant digit.<br />
TSL Commands 6-51
&IDF (integer default format)<br />
6-52 <strong>Language</strong> <strong>Reference</strong><br />
■ If you only use the character N (N...) in the mask, <strong>AionDS</strong> truncates all<br />
positions to the left of the most significant digit.<br />
■ If you use a comma ( , ) in the mask, <strong>AionDS</strong> displays commas in<br />
positions that are multiples of three digits from the least significant digit.<br />
If the digit to the left of a comma is suppressed, the comma is also<br />
suppressed.<br />
■ A negative mask is ignored when it specifies binary or hexadecimal<br />
format.<br />
■ To use a special character as a fixed character, precede it with an<br />
ampersand ( & ). To display an ampersand, specify two ampersands<br />
( && ).<br />
■ The profile option THOUSANDS-SEPARATOR determines the display of<br />
commas but not their interpretation in the mask.<br />
■ Integers are right-justified up to the length of the mask. This is the last<br />
step in formatting an integer. If the number is already longer than the<br />
mask, it is not truncated. If the number overflows the mask, the extra<br />
digits are put immediately before the first numeric position of the mask,<br />
except in the case of binary and hexadecimal masks. In those cases,<br />
instead of overflowing, the number is truncated at the left.<br />
■ You cannot combine bases, such as decimal and hexadecimal, in the same<br />
mask.<br />
■ The default fill character, such as a space, is used to fill positions on the<br />
left. For example, if the mask is 'BBBB' and the number is 5 (101<br />
binary) then <strong>AionDS</strong> displays '0101'.<br />
■ If you might display a negative number without specifying a negative<br />
mask, it is important to allow space for a minus sign in the positive mask.<br />
The mask must be at least two digits, one for the sign and one for a digit.<br />
■ If you display a negative number using a mask that contains asterisks, the<br />
sign displays to the left of the left-most asterisk.<br />
■ If you are using a decimal mask, you should specify a '0' in the least<br />
significant position of the mask if you want something to appear when<br />
the number is zero.
&IDF (integer default format)<br />
■ You can reset the default integer format to its initial format with the<br />
following command:<br />
&idf ('0','-0')<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In the following examples, X contains the value 1,000 and Y contains the<br />
value -1,000. The delta character ( ) indicates a blank space.<br />
Mask X on output Y on output<br />
'99999990','-9999990' 1000 -1000<br />
',999,990','-999,990' 1,000 -1,000<br />
',***,**0','-***,**0' ***1,000 -**1,000<br />
',000,000','-000,000' 0001,000 -001,000<br />
' 99,990 ','(99,990)' 1,000 (1,000)<br />
' NN,NN0 ','(NN,NN0)' 1,000 (1,000)<br />
' NN,NN0 ',' NN,NN0-' 1,000 1,000-<br />
' $999,990 ','($999,990)' $1,000 ($1,000)<br />
' $NNN,NN0 ','($NNN,NN0)' $1,000 ($1,000)<br />
'$NNN,NN0','$-NN,NN0' $1,000 $-1,000<br />
'0', '-0' 1000 -1000<br />
In the next example, the value being displayed is indicated in the Value<br />
column.<br />
Mask Value Output<br />
'HHHH:HHHH' ABC10DEF hex ABC1:0DEF<br />
'BBBBBBBB' 101 binary 00000101<br />
'000-00-0000',' &Bad SS #' 12345678 012-34-5678<br />
'000-0000', '&Bad ph #' 5551212 555-1212<br />
TSL Commands 6-53
&INCLUDE (insert text from a file)<br />
&INCLUDE (insert text from a file)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-54 <strong>Language</strong> <strong>Reference</strong><br />
Use &INCLUDE to insert text from a file in any TSL property.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&INCLUDE { 'file_name' | %[library::]string_param }<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
file_name<br />
is the name of any operating system file.<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the parameter exists. The library<br />
name is only required when duplicate parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
string_param<br />
is the name of any parameter with a base type of string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The value of string_param is the name of any operating system file.<br />
■ You can use Fill or Justify mode to format the output file text.<br />
■ To insert a line break at the end of the output file text, use &BR or,<br />
while in the default mode, press ENTER after the &INCLUDE statement.<br />
■ No command interpretation or parameter substitution is performed on<br />
the text of the file.
&INCLUDE (insert text from a file)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following command inserts the contents of the file WORK.DOC in the<br />
text of a message.<br />
&include 'work.doc'<br />
In the following example, the value of the parameter INCLUDE_FILE is the<br />
name of a file. This command inserts the contents of the file in a report.<br />
&include %include_file<br />
TSL Commands 6-55
&J (justify mode)<br />
&J (justify mode)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-56 <strong>Language</strong> <strong>Reference</strong><br />
Justify mode formats text to fill the area within the margins, and creates<br />
output lines that are flush with the right margin. You can switch into and<br />
out of the justify formatting mode with the &J command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&J{ + | - }<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The plus sign ( + ) cancels the previous mode and sets the current mode<br />
to justify mode.<br />
■ The minus sign ( - ) cancels justify mode and returns to the previous<br />
mode.<br />
■ In justify mode, groups of spaces and line breaks are replaced by a single<br />
space character before the output is formatted.<br />
■ In justify mode, <strong>AionDS</strong> displays two spaces after each period,<br />
exclamation point, or question mark that is followed by one or more<br />
blank spaces. For example, if a period, exclamation point, or question<br />
mark is followed by three spaces, <strong>AionDS</strong> replaces the three spaces with<br />
two. If one of these punctuation marks is followed by one space, <strong>AionDS</strong><br />
replaces the one with two. If it is followed by another character with no<br />
blank spaces, <strong>AionDS</strong> does not insert any blank spaces.<br />
■ If you want to display more than one space between words or less than<br />
two spaces after a period, question mark, or exclamation point, you must<br />
temporarily return to the default formatting mode or use the &SPC<br />
command. For example, the following portion of TSL text preserves one<br />
space after the period in the string ST. PAUL:<br />
&j+<br />
Several aspects of the city of &j-St. Paul&j+ contribute
&J (justify mode)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following TSL statements use &J to display the first sentence in a<br />
justified format. The length of this sentence varies depending on the values<br />
of the Boolean slots COSTLY, FAMILY, and SPORTY. Justify mode causes the<br />
text to wrap within the margins regardless of the length of the sentence in<br />
addition to displaying the right edge of each line flush with the margin. In<br />
this example, justify mode is cancelled in order to format the customer<br />
information.<br />
&j +<br />
The car of your dreams<br />
%costly <br />
<br />
%family <br />
%sporty <br />
&j -<br />
%customer <<br />
Customer No. %cust_no:17<br />
Credit Limit: %old_limit:17:2<br />
Payment History: %payment_hist:17<br />
><br />
When COSTLY and SPORTY are true and FAMILY is false the following text is<br />
displayed:<br />
The car of your dreams , though a bit expensive, is the<br />
fastest car of the lot and will be the envy of all your<br />
friends at work.<br />
Customer No. 12345123451234512<br />
Credit Limit: 50000.00<br />
Payment History: ..... excellent<br />
TSL Commands 6-57
&LI (left indent)<br />
&LI (left indent)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-58 <strong>Language</strong> <strong>Reference</strong><br />
Use the &LI command to temporarily set the left margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&LI [ + | - ] number<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is either the relative or absolute position for the margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The plus ( + ) sign moves the margin number positions to the right of the<br />
current margin. The minus ( - ) sign moves the margin number positions<br />
to the left of the current margin. This is called relative positioning.<br />
■ If you do not use relative positioning, number represents the absolute<br />
position. In a report, the absolute position is the number of spaces from<br />
the left edge of the page. In all other TSL properties, the absolute<br />
position is the number of spaces from the left edge of the window. In all<br />
properties, the spaces are numbered with the leftmost position as 1.<br />
■ &LI changes the indent for the current line. The next line of output uses<br />
the previously established left margin.<br />
■ You can use the &LI command anywhere in the line whose margin you<br />
want to change. The command does not need to be at the beginning of<br />
the line.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following TSL statements create numbered paragraphs. The first TSL<br />
statements invoke fill mode and establish the left margin to be at the tenth<br />
space from the left edge of the window or page. The &LI command sets the<br />
left margin for the first line of each paragraph to be four spaces to the left of<br />
the established margin.<br />
&fi+&lm10<br />
&li-4 1. As a further consideration and inducement for this<br />
Agreement, %client hereby waives all rights under Section 1542 of the<br />
California Civil Code or any analogous state, local, or federal law,<br />
statute, rule, order or regulation.<br />
&br
&LI (left indent)<br />
&li-4 2. %client hereby expressly agrees that this Agreement shall<br />
extend and apply to all unknown, unsuspected and unanticipated<br />
injuries and damages, as well as to those that are now disclosed.<br />
&br<br />
<strong>AionDS</strong> displays the paragraphs in the following manner:<br />
1. As a further consideration and inducement for this<br />
Agreement, John Doe hereby waives all rights under<br />
Section 1542 of the California Civil Code or any<br />
analogous state, local, or federal law, statute, rule,<br />
order or regulation.<br />
2. John Doe hereby expressly agrees that this Agreement<br />
shall extend and apply to all unknown, unsuspected and<br />
unanticipated injuries and damages, as well as to those<br />
that are now disclosed.<br />
TSL Commands 6-59
&LM (left margin)<br />
&LM (left margin)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-60 <strong>Language</strong> <strong>Reference</strong><br />
Use the &LM command to set the left margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&LM [ + | - ] number<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is either the relative or absolute position for the margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The plus ( + ) sign moves the margin number positions to the right of the<br />
current margin. The minus ( - ) sign moves the margin number positions<br />
to the left of the current margin. This is called relative positioning.<br />
■ If you do not use relative positioning, number represents the absolute<br />
position. In a report, the absolute position is the number of spaces from<br />
the left edge of the page. In all other TSL properties, the absolute<br />
position is the number of spaces from the left edge of the window. In all<br />
properties, the spaces are numbered with the leftmost position as 1.<br />
■ For objects that are not reports, the default left margin is 1. For report<br />
objects, the default left margin is specified by the Left Margin property.<br />
■ If the command is not at the beginning of a line, it causes a line break.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following TSL command sets the left margin at position 5.<br />
&lm 5<br />
The following TSL command sets the left margin at 7 spaces to the right of<br />
the current margin.<br />
&lm+7
&LN (line numbers)<br />
&LN (line numbers)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &LN command to number lines of a display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&LN { { : [ + | - ] number } | - }<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is the number of positions in which to display the line number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &LN: [+|-] number command turns line numbers on. The &LNcommand<br />
turns line numbers off.<br />
■ Line numbers are displayed in the area between the left edge of the<br />
window or page, and the left margin.<br />
■ The default position for displaying line numbers is left-justified at the left<br />
edge of the window or page (position 1). Note that if the left margin is<br />
at position 1, no line numbers will be displayed.<br />
■ The number argument specifies the number of positions in which to<br />
display the line number. If you use the number argument, line numbers<br />
are right-justified within the positions, otherwise, the numbers are leftjustified.<br />
■ You cannot use line numbers and display text in the left margin (with the<br />
< command) at the same time. The last command that <strong>AionDS</strong><br />
executes overrides the previous command.<br />
■ If the line number cannot fit within the left margin, it is truncated.<br />
■ The first non-title line on a page is line 1.<br />
■ Line numbers are reset to start each page with line number 1.<br />
■ Line numbering is not available within titles or footers. An error occurs<br />
if you attempt to specify line numbers within a title or footer.<br />
TSL Commands 6-61
&LN (line numbers)<br />
6-62 <strong>Language</strong> <strong>Reference</strong><br />
■ Line numbering appears on every line after the &LN command including<br />
blank or skipped lines, except for titles and footers.<br />
■ You can use the &LN command anywhere in the line at which you want<br />
to begin numbering. The command does not need to be at the<br />
beginning of the line.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following message shows the use of the line numbering command:<br />
&ln:1&fi+&lm10&rm-5<br />
&li-4 1. As a further consideration and inducement for this<br />
Agreement, %client hereby waives all rights under Section 1542 of the<br />
California Civil Code or any analogous state, local, or federal law,<br />
statute, rule, order or regulation.<br />
&br<br />
&li-4 2. %client hereby expressly agrees that this Agreement shall<br />
extend and apply to all unknown, unsuspected and unanticipated<br />
injuries and damages, as well as to those that are now disclosed.<br />
&ln-<br />
The following output is displayed:<br />
1 1. As a further consideration and inducement for this Agreement,<br />
2 John Doe hereby waives all rights under Section 1542 of the<br />
3 California Civil Code or any analogous state, local, or<br />
4 federal law, statute, rule, order or regulation.<br />
5 2. John Doe hereby expressly agrees that this Agreement shall<br />
6 extend and apply to all unknown, unsuspected and unanticipated<br />
7 injuries and damages, as well as to those that are now<br />
8 disclosed.
< (text in the left margin)<br />
< (text in the left margin)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the < command to place text in the left margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
< 'string'<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
string<br />
is a text string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The < command places string in the left margin of each line,<br />
including blank and skipped lines.<br />
■ Specifying an empty string cancels the command:<br />
< ''<br />
■ The string must be a single line. You cannot use carriage returns or line<br />
feeds in string.<br />
■ If you want to include an ampersand ( & ) or angle brackets ( ) within<br />
a quoted string, you must precede them with an ampersand.<br />
■ You cannot use line numbers (with the &LN command) and display text<br />
in the left margin at the same time. The last command that <strong>AionDS</strong><br />
executes overrides the previous command.<br />
■ You can use the < command anywhere in the line at which you want<br />
to begin margin text. The command does not need to be at the<br />
beginning of the line.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following message displays side bars ( | ) to the left of each line in the<br />
second paragraph:<br />
&fi+&lm10&rm-5<br />
&li-4 1. As a further consideration and inducement for this<br />
Agreement, %client hereby waives all rights under Section 1542 of the<br />
California Civil Code or any analogous state, local, or federal law,<br />
statute, rule, order or regulation.<br />
&br< '|'<br />
&li-4 2. %client hereby expressly agrees that this Agreement shall<br />
extend and apply to all unknown, unsuspected and unanticipated<br />
injuries and damages, as well as to those that are now disclosed.<br />
&br< ''<br />
TSL Commands 6-63
< (text in the left margin)<br />
6-64 <strong>Language</strong> <strong>Reference</strong><br />
<strong>AionDS</strong> produces the following output:<br />
1. As a further consideration and inducement for this Agreement,<br />
John Doe hereby waives all rights under Section 1542 of the<br />
California Civil Code or any analogous state, local, or<br />
federal law, statute, rule, order or regulation.<br />
| 2. John Doe hereby expressly agrees that this Agreement shall<br />
| extend and apply to all unknown, unsuspected and unanticipated<br />
| injuries and damages, as well as to those that are now<br />
| disclosed.
&MSG (substitute a message)<br />
&MSG (substitute a message)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &MSG command to substitute a message inside another message or<br />
inside a report.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&MSG [library::]msg_obj<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
library<br />
is the name of the included library in which the message exists. The library<br />
name is only required when duplicate message names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
.........................................................................................................................................................................................................˝..........................................<br />
msg_obj<br />
is the name of a message object.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ When you include a message with &MSG, the execution conditions of<br />
msg_obj are not executed. The message is included whether the execution<br />
conditions would evaluate to TRUE or FALSE.<br />
■ With &MSG you can create and maintain standard headings or messages<br />
and use them throughout the knowledge base. This reduces redundancy<br />
of TSL statements in the knowledge base and can reduce the size of the<br />
knowledge base.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following lines are contained in the Report Text property of a report.<br />
The resulting report consists of two sections, SALES_DETAIL and<br />
SALES_SUMMARY. The contents of STANDARD_HEAD is included at the<br />
beginning of each section.<br />
&msg standard_head<br />
&msg sales_detail<br />
&pg<br />
&msg standard_head<br />
&msg sales_summary<br />
TSL Commands 6-65
&N (number pages)<br />
&N (number pages)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-66 <strong>Language</strong> <strong>Reference</strong><br />
Use the &N command to invoke or cancel page numbering of a report.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&N { + | - }<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &N command can only be used in conjunction with the &FOOTER<br />
command. In addition, the &FOOTER command must use the format<br />
without text enclosed in angle brackets ( ).<br />
■ The &N command adds a page number to the footer. The page number<br />
is printed in the lower right corner of each page and is preceded by the<br />
following text and a blank space:<br />
page:<br />
■ The plus sign ( + ) invokes page numbering; the minus sign ( - ) cancels<br />
page numbering.<br />
■ The default choice for page numbering is plus ( + ).<br />
■ This command works in reports and in messages that are included in<br />
reports. If you put it in any other TSL property, <strong>AionDS</strong> ignores the<br />
command.
&PG (eject page)<br />
&PG (eject page)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &PG command to eject the current page of a report.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&PG<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ This command works in reports and in messages that are included in<br />
reports. If you put it in any other TSL property, <strong>AionDS</strong> ignores the<br />
command.<br />
■ You do not need to use this command at the end of a report because the<br />
page is automatically ejected at that time.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following example ejects the page between chapters of a manual.<br />
** End of Chapter 9 **<br />
&pg<br />
&cCHAPTER 10<br />
TSL Commands 6-67
&RDF (real default format)<br />
&RDF (real default format)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-68 <strong>Language</strong> <strong>Reference</strong><br />
Use the &RDF command to set the default format for display of real<br />
numbers. There are two formats to the &RDF command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&RDF(width, precision [, nfmt])<br />
Format 1 Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
width<br />
is the number of positions used to display the formatted number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
precision<br />
is the number of digits displayed to the right of the decimal point.<br />
.........................................................................................................................................................................................................˝..........................................<br />
nfmt<br />
is an optional argument that specifies one of the following formats for<br />
displaying real numbers.<br />
S displays a leading minus sign in front of a negative number.<br />
C displays CR after a negative number and two blanks after a positive<br />
number.<br />
D displays CR after a negative number and DB after a positive number.<br />
P displays parentheses around a negative number and an extra blank on<br />
each side of a positive number.<br />
R displays a trailing minus sign after a negative number and an extra<br />
space after a positive number.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ TSL places a comma every three digits to the left of the decimal point.<br />
■ You should allocate a width large enough to display the value, the<br />
decimal point, significant digits to the right of the decimal point, and<br />
formatting characters.<br />
■ If you do not specify enough positions, TSL displays the entire number.<br />
It truncates trailing spaces, however.<br />
■ If the value and formatting characters require less than width position,<br />
TSL pads the positions with blanks to the left of the number.
&RDF (real default format)<br />
■ The fractional part of the number is rounded to fit in precision positions.<br />
■ You can reset the default real format to its initial format with the<br />
following command:<br />
&rdf (0,2,s)<br />
■ If you specify precision as 0, TSL does not display the decimal point.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
In the following examples, X contains the value 10,000 and Y contains the<br />
value -10,000. The delta character ( ) indicates a blank space.<br />
TSL Output<br />
&rdf(12,2,s)%x<br />
&rdf(12,2,s)%y<br />
&rdf(12,2,c)%x<br />
&rdf(12,2,c)%y<br />
&rdf(12,2,d)%x<br />
&rdf(12,2,d)%y<br />
&rdf(12,2,p)%x<br />
&rdf(12,2,p)%y<br />
&rdf(12,2,r)%x<br />
&rdf(12,2,r)%y<br />
10,000.00<br />
-10,000.00<br />
10,000.00<br />
10,000.00CR<br />
10,000.00DB<br />
10,000.00CR<br />
10,000.00<br />
(10,000.00)<br />
10,000.00<br />
10,000.00-<br />
The following message sets the real default format to format each number in<br />
the message with a width of ten positions and no digits to the right of the<br />
decimal point:<br />
&rdf(10,0)<br />
Old credit limit: %old_limit<br />
Amount of purchase: %new_purchase<br />
New credit limit: %credit_limit<br />
The following message can be displayed with the above statements:<br />
Old credit limit: 10,000<br />
Amount of purchase: 1,000<br />
New credit limit 12,000<br />
TSL Commands 6-69
&RDF (real default format)<br />
.........................................................................................................................................................................................................˝..........................................<br />
&RDF ('mask'[,'mask'])<br />
Format 2 Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
mask<br />
6-70 <strong>Language</strong> <strong>Reference</strong><br />
is a real number mask. The mask can contain the following symbols:<br />
9 reserves space for a decimal digit. The default display is a space.<br />
0 reserves space for a decimal digit. The default display is a zero.<br />
* reserves space for a decimal digit. The default display is an<br />
asterisk.<br />
N reserves space for a decimal digit. The default display is nothing.<br />
, specifies commas between every three digits.<br />
. reserves space for the decimal point.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you specify two masks, <strong>AionDS</strong> uses the first one for positive numbers<br />
and the second one for negative numbers.<br />
■ If you specify only one mask, the mask is used for both positive and<br />
negative numbers. If the number is negative, the first character of the<br />
mask is replaced by a minus sign ( - ).<br />
■ If you only use nines (9...) in the mask, <strong>AionDS</strong> blank fills all positions<br />
to the left of the most significant digit.<br />
■ If you use only zeros (0...) in the mask, <strong>AionDS</strong> zero fills all positions to<br />
the left of the most significant digit.<br />
■ If you use only asterisks (*...) in the mask, <strong>AionDS</strong> asterisk fills all<br />
positions to the left of the most significant digit.<br />
■ If you only use the character N (N...) in the mask, <strong>AionDS</strong> truncates all<br />
positions to the left of the most significant digit.<br />
■ Use the period ( . ) to display a decimal point. The first mask character<br />
to the right of the decimal point determines whether the decimal point is<br />
displayed. If the mask character and the data cause a space or asterisk to<br />
display, or suppression of any character, the period is also displayed as a<br />
space, asterisk, or nothing.
&RDF (real default format)<br />
■ If you use a comma ( , ) in the mask, <strong>AionDS</strong> displays commas in<br />
positions that are multiples of three digits from the least significant digit.<br />
If the digit to the left of a comma is suppressed, the comma is also<br />
suppressed.<br />
■ To use a special character as a fixed character, precede it with an<br />
ampersand ( & ). To display an ampersand, specify two ampersands<br />
( && ).<br />
■ The profile options DECIMAL-SEPARATOR and THOUSANDS-SEPARATOR<br />
determine the display of periods and commas, but not their<br />
interpretation in the mask.<br />
■ Real numbers are right-justified up to the length of the mask. This is the<br />
last step in formatting a number. If the number is already longer than<br />
the mask, it is not truncated. If the number overflows the mask, the<br />
extra digits are put immediately before the first numeric position of the<br />
mask.<br />
■ The default fill character for numeric positions, such as a space, is used in<br />
the following cases:<br />
❐ On the left side of the decimal, the default character is used to fill<br />
positions on the left. For example, if the mask is '999.00' and the<br />
number is 1.23 then TSL displays ' 1.23'. If no numeric<br />
position character is used on the left of the decimal in the mask, the<br />
default (for the 1’s position when printing 0.x or -0.x) is 0.<br />
❐ On the right side of the decimal, the default character is used to fill<br />
positions on the right. For example, if the mask is '999.99' and<br />
the number is 123.50 then TSL displays '123.5 '.<br />
■ If you might display a negative number without specifying a negative<br />
mask, it is important to allow space for a minus sign in the positive mask.<br />
■ If you display a negative number using a mask that contains asterisks, the<br />
sign displays to the left of the left-most asterisk.<br />
■ If you are using a decimal mask, you should specify a '0' in the least<br />
significant position of the mask if you want something to appear when<br />
the number is zero.<br />
TSL Commands 6-71
&RDF (real default format)<br />
6-72 <strong>Language</strong> <strong>Reference</strong><br />
■ You can reset the default real format to its initial format with the<br />
following command:<br />
&rdf (0,2,s)<br />
■ A default specified with &RDF applies until a new default is specified or<br />
until the end of the property in which it is specified.<br />
If the contents of one TSL property are included within another TSL<br />
property, the format defined in one property continues to apply in the<br />
other. For example, if you use &RDF in a TSL property and later in the<br />
property you use the &MSG command, the default will continue to apply<br />
in the included message. Likewise, if you include a message with &MSG<br />
and the included message contains the &RDF command, the default will<br />
continue to apply when <strong>AionDS</strong> returns to the first property.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
In the following example, X contains the value 1,000.00 and Y contains the<br />
value -1,000.00. The delta character ( ) indicates a blank space.<br />
Mask X on output Y on output<br />
'99999990.99','-9999990.99' 1000 -1000<br />
',999,990.00','-999,990.00' 1,000.00 -1,000.00<br />
',***,**0.**','-***,**0.**' ***1,000*** -**1,000***<br />
',***,**0.00','-***,**0.00' ***1,000.00 -**1,000.00<br />
',000,000.00','-000,000.00' 0001,000.00 -001,000.00<br />
' 99,990.09 ','(99,990.09)' 1,000.0 (1,000.0)<br />
' NN,NN0.NN ','(NN,NN0.NN)' 1,000 (1,000)<br />
' NN,NN0.00 ',' NN,NN0.00-' 1,000.00 1,000.00-<br />
' $999,990 ', '($999,990)' $1,000 ($1,000)<br />
' $NNN,NN0 ', '($NNN,NN0)' $1,000 ($1,000)<br />
'$NNN,NN0.00','$-NN,NN0.00' $1,000.00 $-1,000.00<br />
'0.N', '-0.N' 1000 -1000<br />
',.N', '-,.N' 1,000 -1,000
&RI (right indent)<br />
&RI (right indent)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &RI command to temporarily set the right margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&RI [ + | - ] number<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is either the relative or absolute position for the margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The plus ( + ) sign moves the margin number positions to the right of the<br />
current margin. The minus ( - ) sign moves the margin number positions<br />
to the left of the current margin. This is called relative positioning.<br />
■ If you do not use relative positioning, number represents the absolute<br />
position. In a report, the absolute position is the number of spaces from<br />
the left edge of the page. In all other TSL properties, the absolute<br />
position is the number of spaces from the left edge of the window. In all<br />
properties, the spaces are numbered with the leftmost position as 1.<br />
■ &RI changes the indent for the current line. The next line of output uses<br />
the previously established right margin.<br />
■ You can use &RI anywhere in the line whose margin you want to change.<br />
The command does not need to be at the beginning of the line.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following paragraph uses &RI to create a line item signature line.<br />
&lm5&rm50&fi+<br />
I agree not to hold %company responsible for any injury<br />
or death that results directly or indirectly from my<br />
taking part in skydiving lessons. Initial here.<br />
&ri+6&stab(47)&tab______<br />
This generates the following output:<br />
I agree not to hold Acme Skydiving School<br />
responsible for any injury or death that<br />
results directly or indirectly from my taking<br />
part in skydiving lessons. Initial here. ______<br />
TSL Commands 6-73
&RM (right margin)<br />
&RM (right margin)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-74 <strong>Language</strong> <strong>Reference</strong><br />
Use the &RM command to set the right margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&RM [ + | - ] number<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is either the relative or absolute position for the margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The plus ( + ) sign moves the margin number positions to the right of the<br />
current margin. The minus ( - ) sign moves the margin number positions<br />
to the left of the current margin. This is called relative positioning.<br />
■ If you do not use relative positioning, number represents the absolute<br />
position. In a report, the absolute position is the number of spaces from<br />
the left edge of the page. In all other TSL properties, the absolute<br />
position is the number of spaces from the left edge of the window. In all<br />
properties, the spaces are numbered with the leftmost position as 1.<br />
■ For objects that are not reports, the default right margin is the right-most<br />
position in the output window. For report objects, the default right<br />
margin is specified by the Right Margin property.<br />
■ If the command is not at the beginning of a line, it causes a line break.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following TSL command sets the right margin two characters to the left<br />
of the current margin:<br />
&rm -2<br />
The following TSL command sets the right margin at position 66:<br />
&rm 66
&RT (text in right margin)<br />
&RT (text in right margin)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &RT command to place text in the right margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&RT 'string'<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
string<br />
is a text string.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &RT command places string in the right margin of each line,<br />
including blank or skipped lines.<br />
■ Specifying an empty string cancels the command:<br />
&RT ''<br />
■ The string must be a single line. You cannot use carriage returns or line<br />
feeds in string.<br />
■ If you want to include an ampersand ( & ) or angle brackets ( ) within<br />
a quoted string, you must precede them with an ampersand.<br />
■ You can use the &RT command anywhere in the line at which you want<br />
to begin margin text. The command does not need to be at the<br />
beginning of the line.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following message displays side bars ( | ) to the right of each line in the<br />
second paragraph:<br />
&ln+&fi+&lm10&rm-5<br />
&li-4 1. As a further consideration and inducement for this<br />
Agreement, %client hereby waives all rights under Section 1542 of the<br />
California Civil Code or any analogous state, local, or federal law,<br />
statute, rule, order or regulation.<br />
&br&rt ' |'<br />
&li-4 2. %client hereby expressly agrees that this Agreement shall<br />
extend and apply to all unknown, unsuspected and unanticipated<br />
injuries and damages, as well as to those that are now disclosed.<br />
&br&rt ''<br />
TSL Commands 6-75
&RT (text in right margin)<br />
6-76 <strong>Language</strong> <strong>Reference</strong><br />
<strong>AionDS</strong> produces the following output:<br />
1 1. As a further consideration and inducement for this Agreement,<br />
2 John Doe hereby waives all rights under Section 1542 of the<br />
3 California Civil Code or any analogous state, local, or<br />
4 federal law, statute, rule, order or regulation.<br />
5 2. John Doe hereby expressly agrees that this Agreement shall |<br />
6 extend and apply to all unknown, unsuspected and |<br />
7 unanticipated injuries and damages, as well as to those |<br />
8 that are now disclosed. |
&SEND (send a message to an object)<br />
&SEND (send a message to an object)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &SEND statement to send a message to an object. The &SEND<br />
command has three formats.<br />
For more information: See the “Sending messages to classes and instances<br />
from TSL” section in Chapter 5, “Text Substitution <strong>Language</strong>,” about other<br />
syntax for sending messages in TSL.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Format 1 Syntax<br />
Use this format to send a message to a class. This format is used when a<br />
message is intended to operate upon the entire class.<br />
&SEND (method TO %classref [WITH arg1 [, arg2...]]) [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
Format 2 Syntax<br />
Use this format to send a message to an instance. This format is used when a<br />
method is intended to operate upon a particular instance.<br />
&SEND (method TO %instanceref [WITH arg1 [, arg2...]])<br />
[format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
Format 3 Syntax<br />
Use this format to send a message which resides in the parent of the current<br />
class to the current instance or class. The command causes the parent<br />
message to be embedded in the current message.<br />
&SEND (method UP [WITH arg1 [, arg2...]]) [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
method<br />
is the name of the method to be invoked.<br />
TSL Commands 6-77
&SEND (send a message to an object)<br />
.........................................................................................................................................................................................................˝..........................................<br />
classref<br />
6-78 <strong>Language</strong> <strong>Reference</strong><br />
is the class to which the message is sent. %classref can have one of the<br />
following forms:<br />
%[library::]class<br />
%currentclass<br />
library is the name of the included library in which the class exists.<br />
The library name is only required when duplicate class<br />
names exist in any of the following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
class is the name of a class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
instanceref<br />
is the instance to which the message is sent. %instanceref can have one of the<br />
following forms:<br />
%<br />
%classref(static)<br />
%classref(%str_param)<br />
%current<br />
%is<br />
%[library::]ptr*<br />
%static<br />
library is the name of the included library in which the slot or<br />
parameter exists. The library name is only required when<br />
duplicate slot or parameter names exist in any of the<br />
following:<br />
■ knowledge base and any included libraries<br />
■ 2 or more included libraries<br />
ptr is the name of a slot or parameter whose type is pointer.<br />
static is the name of a static instance.
&SEND (send a message to an object)<br />
str_param is the name of a parameter or slot whose type is string and<br />
whose value is the name of an instance.<br />
.........................................................................................................................................................................................................˝..........................................<br />
arg#<br />
is an argument to be passed to the attached function.<br />
.........................................................................................................................................................................................................˝..........................................<br />
format<br />
is formatting appropriate to the type of value returned by the attached<br />
function.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The object attached to the method must be a message or a function. The<br />
message or return value is embedded exactly as it would be using the<br />
&MSG statement or a function call.<br />
■ To specify arguments with the &SEND command, place arguments after<br />
the word WITH and separate the arguments with commas. For example,<br />
the following statement sends a message to the static instance FORD. The<br />
method name is SPECS. The first argument is the value of ENGINE,<br />
which is a slot of the current instance. The second argument is the string<br />
THROTTLE.<br />
&send (specs to %ford with %engine, 'throttle')<br />
■ You can format the return value of a function with TSL formatting<br />
commands such as colon formatting, masks, brackets, and so on.<br />
■ See %UP in this chapter for sending a message to the parent of the<br />
current class.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statement displays text as a result of sending a message to the<br />
class CUSTOMERS:<br />
&send(SalesTotal to %Customers)<br />
The following statements both send a message to the current instance. The<br />
second statement formats the value (in this case it is a real number) with a<br />
width of 10 and precision of 2.<br />
&send(OrderTotal to %Current)<br />
&send(OrderTotal to %Current):10:2<br />
TSL Commands 6-79
&SEND (send a message to an object)<br />
6-80 <strong>Language</strong> <strong>Reference</strong><br />
The following statement sends a message to the instance referred to by the<br />
pointer CUSTPOINTER:<br />
&send(OrderTotal to %CustPointer*)<br />
The following statement sends a message to an instance of the class<br />
CUSTOMERS. The instance name is the value of the parameter BIGGEST.<br />
&send(OrderTotal to %Customers(%Biggest))<br />
The following statement sends a message to the current instance or class. The<br />
method ORDERTOTAL is defined in the parent of the current class.<br />
&send(OrderTotal up)
&SK (skip lines)<br />
&SK (skip lines)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &SK to skip lines.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SK number<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is the number of lines that <strong>AionDS</strong> skips.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If a line break does not precede the command, the command breaks the<br />
line and then skips number lines.<br />
■ If you specify margin text or line numbering with the <, &RT, or<br />
&LN commands before the &SK command, the margin text will appear<br />
on the lines that are skipped.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following TSL text skips two lines before and four lines after the<br />
company name and address.<br />
&sk 2<br />
&cPLATINUM technology, inc.&c555 Twin Dolphin Dr., Ste. 400<br />
&cRedwood City, CA 94065<br />
&sk 4<br />
TSL Commands 6-81
&SPC (insert spaces)<br />
&SPC (insert spaces)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-82 <strong>Language</strong> <strong>Reference</strong><br />
Use &SPC in fill, justify, and table modes to include blank spaces.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SPC<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
■ &SPC inserts the number of spaces specified in the &SSPC command.<br />
Remarks<br />
■ If you do not use the &SSPC command, each &SPC command reserves<br />
five spaces.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following table uses spacing commands to format the heading:<br />
&stab (16,31,51) &sspc 1 &tb+<br />
Customer &spc No.<br />
&tab Credit &spc Limit<br />
&tab &spc &spc Payment &spc History<br />
&tab Credit &spc Status &br<br />
------------<br />
&tab ------------<br />
&tab -----------------<br />
&tab ------------- &br<br />
%customer_list < %><br />
&tb-
&SSPC (set spaces in fill, justify, and table modes)<br />
&SSPC (set spaces in fill, justify, and table modes)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &SSPC in fill, justify, and table modes to set the number of spaces to be<br />
inserted with each &SPC command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SSPC number<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is the number of spaces that <strong>AionDS</strong> uses with each &SPC command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
If you do not use the &SSPC command, each &SPC command reserves five<br />
spaces.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following table uses spacing commands to format the heading:<br />
&stab (16,31,51) &sspc 1 &tb+<br />
Customer &spc No.<br />
&tab Credit &spc Limit<br />
&tab &spc &spc Payment &spc History<br />
&tab Credit &spc Status &br<br />
------------<br />
&tab ------------<br />
&tab -----------------<br />
&tab ------------- &br<br />
%customer_list < %><br />
&tb-<br />
TSL Commands 6-83
&STAB (set tabs)<br />
&STAB (set tabs)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-84 <strong>Language</strong> <strong>Reference</strong><br />
Use the &STAB command to set tab stops.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&STAB (pos1 [, pos ...])<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
pos1<br />
is the position of the first tab stop.<br />
.........................................................................................................................................................................................................˝..........................................<br />
pos<br />
is the position of the next tab stop.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You can specify a maximum of 80 tab stops.<br />
■ If you do not use this command, the default tab stops are every five<br />
positions, starting with position 5.<br />
■ The tab positions are relative to the left margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following command sets tab stops at positions 16, 31, and 51:<br />
&stab (16,31,51)
&TAB (Move to next tab)<br />
&TAB (Move to next tab)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &TAB to position output to start at the next tab stop.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TAB<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
The &TAB command is ignored if more &TAB commands are used than the<br />
number of tab stops.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following statement displays the date and then moves to the next tab<br />
stop to display the time.<br />
%currentdate &tab%currenttime<br />
TSL Commands 6-85
&TB (table mode)<br />
&TB (table mode)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-86 <strong>Language</strong> <strong>Reference</strong><br />
Use table mode when you want TSL to ignore line breaks or to create a table.<br />
You can create tables either with default formatting, table mode, or the &TBL<br />
command. The fill (&FI) and justify (&J) commands are ignored in a table.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TB { + | - }<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &TB command invokes table mode.<br />
■ The plus sign ( + ) cancels the previous mode and sets the current mode.<br />
■ The minus sign ( - ) cancels the table mode and returns to the previous<br />
mode.<br />
■ When you use table mode, TSL ignores new lines and space characters.<br />
■ The &TB command is unrelated to the &TBL command. It is not<br />
necessary to be in table mode (&TB+) before issuing the &TBL<br />
command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following example uses table mode to prevent TSL from using the line<br />
break to start a new line. This example uses default formatting, rather than<br />
table mode or the &TBL command, to control spacing between the columns<br />
of the table.<br />
Consider the following output:<br />
Customer No. Credit Limit Payment History Credit Status<br />
------------ ------------ ----------------- -------------<br />
1001 10000.00 under 30 days okay<br />
1002 0.00 not under 30 days problem<br />
The following TSL statements create the output:<br />
Customer No. Credit Limit Payment History Credit Status<br />
------------ ------------ ----------------- -------------<br />
%customer_list
&TB (table mode)<br />
Because the third TSL statement is long, it is necessary to use table mode to<br />
temporarily cancel the effect of the new line. At the end of the third line,<br />
table mode is invoked with the &TB command using the plus ( + ) option.<br />
At the beginning of the next line, table mode is canceled with the minus ( - )<br />
option. When table mode is canceled, TSL continues with the previous<br />
mode, which is default formatting in this case.<br />
The following example uses table mode and tab settings to produce the same<br />
table for CUSTOMER_LIST. The tab stop command &STAB is used to set<br />
three tabs. Default formatting is used to set up the table headings. After the<br />
&TB command, <strong>AionDS</strong> ignores new lines and spaces. The &TAB command<br />
specifies the next tab position for output.<br />
&stab (16,31,51)<br />
Customer No. Credit Limit Payment History Credit Status<br />
------------ ------------ ----------------- -------------<br />
&tb+<br />
%customer_list < %><br />
&tb-<br />
TSL Commands 6-87
&TBL (table)<br />
&TBL (table)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-88 <strong>Language</strong> <strong>Reference</strong><br />
Use &TBL to format tables. With the &TBL command, <strong>AionDS</strong> can handle<br />
many aspects of table creation automatically. <strong>AionDS</strong> can determine the<br />
number and width of columns in the table, can provide titles for each<br />
column, and can determine the appropriate type of justification for data in a<br />
column. You can modify any of these defaults as appropriate for your table.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TBL [option [, option ...]] < text ><br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
option<br />
is one of the following options:<br />
CENTER specifies that the table is to be centered within the current<br />
margins.<br />
column(col_num [, LEFT |, RIGHT] [, TITLE ])<br />
specifies attributes of individual columns.<br />
col_num is the column number.<br />
LEFT specifies that the column is to be leftjustified.<br />
RIGHT specifies that the column is to be rightjustified.<br />
TITLE specifies a title for the column.<br />
title_text is TSL text for the column title.<br />
ONETITLE specifies that the title is to be displayed only at the beginning<br />
of the table, not at the top of subsequent pages of the report.<br />
TITLEOFF specifies that TSL not generate automatic titles. <strong>AionDS</strong><br />
also does not display the blank line that is otherwise<br />
automatically generated between the title and data.
&TBL (table)<br />
.........................................................................................................................................................................................................˝..........................................<br />
text<br />
is TSL text, with exceptions noted below under Remarks.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ <strong>AionDS</strong> determines column widths at runtime. Each column is given<br />
the width of the widest data that must fit in the column, including the<br />
column title. You can set column widths manually with colon<br />
formatting or fixed-width masking commands. See the examples below.<br />
For more information: See “Displaying simple parameter and slot<br />
values” in Chapter 5, “Text Substitution <strong>Language</strong>,” for more<br />
information about colon formatting and masking.<br />
■ If you do not use the TITLEOFF option, <strong>AionDS</strong> automatically generates<br />
titles for any columns for which you have not provided titles. If you use<br />
the TITLEOFF option, <strong>AionDS</strong> does not generate column titles.<br />
■ You can specify column titles with the COLUMN TITLE option. The title<br />
text can include TSL commands. For example, you can specify line<br />
breaks for multiple-line titles.<br />
■ If you do not use the TITLEOFF option, <strong>AionDS</strong> uses the Print Name<br />
property of the object being displayed for the column title if it is<br />
available. If the Print Name property has no value, <strong>AionDS</strong> uses the<br />
Name property.<br />
■ When <strong>AionDS</strong> uses the Name property to generate column titles,<br />
<strong>AionDS</strong> substitutes blank spaces for all underscore characters (_) and<br />
changes the first letter of the name to upper case.<br />
■ There is an abbreviated syntax available within the &TBL command.<br />
This allows you to refer to elements of a list, set, or class without using<br />
the % character to move to the next element. For example, in standard<br />
TSL text you need to use the following syntax to display the values of the<br />
slot LAST_NAME for instances of the class PEOPLE:<br />
%People<br />
In the &TBL command you can use the following syntax:<br />
&TBL < %People ><br />
In the &TBL command, the following syntax is also equivalent to the<br />
above, except that <strong>AionDS</strong> generates a different column title:<br />
&TBL < %People.last_name ><br />
TSL Commands 6-89
&TBL (table)<br />
6-90 <strong>Language</strong> <strong>Reference</strong><br />
■ Commands that cause line breaks or change margins are not allowed in<br />
text. Specifically, the following TSL commands are not allowed:<br />
&BLK &LM &PG &SK<br />
&BR &LN &RI &STAB<br />
&C < &RM &TAB<br />
&LI &N &RT &TBL<br />
These commands are also not allowed in title_text, with the exception of<br />
&BR and &SK, which can be used.<br />
■ Each row of a table can contain only one line of text. You cannot create<br />
a table with line breaks within a row.<br />
■ Line breaks in table text have no effect on the table. You can include line<br />
breaks for clarity or convenience in the &TBL command. If the<br />
command extends more than one line, remember to include any<br />
necessary blank spaces after the line break. Line breaks do, however,<br />
affect title_text.<br />
■ The syntax you use in the &TBL command determines the title <strong>AionDS</strong><br />
creates for a column. The following table shows what objects <strong>AionDS</strong><br />
uses for column titles according to the object reference in the &TBL<br />
command. The column title comes from the Print Name or Name<br />
property.<br />
<strong>Reference</strong> Automatic column title<br />
class-reference.slot slot<br />
class-reference.method method<br />
class-reference class<br />
%list-of-pointers list<br />
%list-of-pointers*.slot slot<br />
%list-of-pointers*.method method<br />
%list-of-pointers* list<br />
%list list<br />
%list list<br />
%list-of-records.field field<br />
class is the name of a class
&TBL (table)<br />
class-reference can be %CURRENTCLASS or % followed<br />
immediately by the class name. Classreference<br />
can include the restriction (WITH<br />
bool_slot_1) [(WITH bool_slot_2)...].<br />
field is the name of a field in a list of records.<br />
list is the name of a parameter or slot whose type is<br />
a list or set.<br />
list-of-pointers is the name of a parameter or slot whose type is<br />
a list or set of pointers.<br />
list-of-records is the name of a parameter whose type is a list<br />
or set of records.<br />
method is the name of a method.<br />
slot is the name of a slot.<br />
■ Unless you specify the TITLEOFF option, <strong>AionDS</strong> places a blank line<br />
between the last row of the titles and the table. If you specify TITLEOFF<br />
but you want a blank line, you can use &BR at the end of the titles you<br />
specify.<br />
■ <strong>AionDS</strong> creates a column in the table for each reference to a list, set, or<br />
class. The syntax %class counts as one reference and <strong>AionDS</strong> creates<br />
one column for it, regardless of the number of slots inside the angle<br />
brackets.<br />
■ Within the table text, any value substitutions that do not evaluate to a<br />
list, set, or class are repeated in each row. Any other text between<br />
columns is also repeated in each row.<br />
■ If a column is formatted in angle brackets, <strong>AionDS</strong> left-justifies the data<br />
and title for the column. Use the COLUMN LEFT and COLUMN RIGHT<br />
options to override the default behavior.<br />
■ If a column is not formatted in angle brackets, TSL uses the data type of<br />
the data in a column to determine default justification. A column and its<br />
title are right-justified for real or integer data, left-justified for other data<br />
types. Use the COLUMN LEFT and COLUMN RIGHT options to override<br />
the default behavior.<br />
TSL Commands 6-91
&TBL (table)<br />
6-92 <strong>Language</strong> <strong>Reference</strong><br />
■ <strong>AionDS</strong> determines the length of a table from the length of the longest<br />
column. <strong>AionDS</strong> displays one line of the table for each element in the<br />
longest list of elements. <strong>AionDS</strong> puts blank entries at the bottom of any<br />
column that is shorter than the longest column.<br />
■ To display values from a list or set of pointers, use the following syntax:<br />
&TBL < %pointer_list*.slot1 %pointer_list*.slot2...><br />
■ Use the following syntax if you have a list or set of pointers and want to<br />
display the full instance name for each pointer. The full instance name is<br />
the class name followed by the instance name in parentheses.<br />
&TBL < %pointer_list ><br />
■ Use the following syntax if you have a list or set of pointers and want to<br />
display only the instance name for each pointer:<br />
&TBL < %pointer_list ><br />
■ If no data is available for a table, TSL displays the string * EMPTY TABLE<br />
* instead of a table. In other words, if all columns refer to empty lists,<br />
sets, or classes, TSL does not display column titles or empty rows, but<br />
displays the above string instead. You can customize this string with the<br />
&EMPTBL command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following command creates a table from two lists of different lengths.<br />
TSL text:<br />
&TBL < %Boys %Girls ><br />
Resulting table:<br />
Boys Girls<br />
Bob Laura<br />
Mike Susan<br />
Carole
&TBL (table)<br />
The following command creates a table with vertical lines between the<br />
columns and with no column titles. Note that the line break between the<br />
TITLEOFF option and the command text has no effect on the table.<br />
TSL text:<br />
&TBL titleoff<br />
<br />
Resulting table:<br />
| George Curnow | 55 |<br />
| Hortense Stewart | 9 |<br />
The following command creates a table that is centered in the current<br />
margins, with the first column right-justified. The command specifies a title<br />
for the first column. <strong>AionDS</strong> generates a title for the second column.<br />
TSL text:<br />
&TBL center, column(1,right,title )<br />
< | %People | %People.age | ><br />
Resulting table:<br />
Name Age<br />
| George Curnow | 55 |<br />
| Hortense Stewart | 9 |<br />
The following command creates a table with multiple lines in the column<br />
titles:<br />
TSL text:<br />
&TBL column(1,title ),<br />
column(2,title )<br />
< | %People | %People.age | ><br />
TSL Commands 6-93
&TBL (table)<br />
6-94 <strong>Language</strong> <strong>Reference</strong><br />
Resulting table:<br />
How<br />
Name old<br />
---- ---<br />
| George Curnow | 55 |<br />
| Hortense Stewart | 9 |<br />
The following command creates a table with three columns, but with titles<br />
for only the first and third columns. Note that the TITLEOFF option also<br />
removes the blank line between the titles and the table.<br />
TSL text:<br />
&TBL titleoff,<br />
column(1,title ),<br />
column(3,title )<br />
< | %People.first_name %People.last_name | %People.age | ><br />
Resulting table:<br />
Name Age<br />
| George Curnow | 55 |<br />
| Hortense Stewart | 9 |<br />
The two following commands display the same information. Because of the<br />
different syntax, <strong>AionDS</strong> creates three columns for the first example and two<br />
columns for the second. Since no titles are specified, <strong>AionDS</strong> produces<br />
default column titles.<br />
&TBL < %People %People<br />
%People ><br />
&TBL < %People %People ><br />
The first example above produces the following table:<br />
People People People<br />
George Curnow 55<br />
Hortense Stewart 9
The two-column example above produces the following table:<br />
People People<br />
George Curnow 55<br />
Hortense Stewart 9<br />
&TBL (table)<br />
<strong>AionDS</strong> creates the titles PEOPLE, FIRST NAME, and PEOPLE for the first,<br />
second, and third columns in the following example:<br />
&TBL < %People %People.first_name %People ><br />
The following command creates a table that lists all instances of the class<br />
PEOPLE for which the Boolean slot OVER_40 is TRUE. The table includes<br />
values of the slots FIRST_NAME, LAST_NAME, and AGE.<br />
&TBL < %People(with over_40).last_name %People(with<br />
over_40).first_name %People(with over_40).age ><br />
Note that all columns in the example above contain the constraint, since the<br />
table as a whole is intended to include only people over 40. If you did not<br />
include the constraint on one or more of the instance references, the column<br />
for that slot would include information about all instances of the class.<br />
The following TSL text overrides automatic calculation of column widths.<br />
The column width for NAME is set to 20. The minus sign (-) indicates leftjustification.<br />
The column width for AGE is set to 5 by the &IDF mask<br />
specification. The column width for BIRTHDATE is set to 12.<br />
&IDF ('99990')<br />
&TBL <br />
TSL Commands 6-95
&TDF (time default format)<br />
&TDF (time default format)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
6-96 <strong>Language</strong> <strong>Reference</strong><br />
Use &TDF to set the default format for the display of times.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TDF ([tfmt,] 'mask')<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
tfmt<br />
is one of the following options:<br />
T specifies use of a time mask to display times. This is the default.<br />
H specifies time in hours since midnight.<br />
M specifies time in minutes since midnight.<br />
S specifies time in seconds since midnight.<br />
.........................................................................................................................................................................................................˝..........................................<br />
mask<br />
is a time or real mask.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ You can reset the default time format to its initial format with the<br />
following command:<br />
&tdf ('H1:M2X2')<br />
■ If you use the H, M, or S tfmt, you must specify a real mask.<br />
■ Time masks can contain the following symbols:<br />
H specifies a one- or two-digit hour, up to 12 (for example, 3<br />
or 12).<br />
H1 specifies a two-digit hour, up to 12. A blank space (shown<br />
as in the example) is used with numbers less than 10 (for<br />
example, 3 or 12).<br />
H2 specifies a two-digit hour, up to 12. A zero is used with<br />
numbers less than 10 (for example, 03 or 12).<br />
X specifies the abbreviation for before or after noon, in upper<br />
case (AM, PM). Use this in addition to specifications for<br />
the hour.
&TDF (time default format)<br />
X1 specifies the abbreviation for before or after noon, in lower<br />
case (am, pm). Use this in addition to specifications for the<br />
hour.<br />
J specifies a one- or two-digit hour, in 24-hour format (for<br />
example, 3 or 15).<br />
J1 specifies a two-digit hour, in 24-hour format. A blank space<br />
is used with numbers less than 10 (for example, 3 or 15).<br />
J2 specifies a two-digit hour, in 24-hour format. A zero is used<br />
with numbers less than 10 (for example, 03 or 15).<br />
M specifies the number of minutes in one or two digits (for<br />
example, 3 or 45).<br />
M1 specifies the number of minutes in two digits. A blank space<br />
is used with numbers less than 10 (for example, 3 or 45).<br />
M2 specifies the number of minutes in two digits. A zero is used<br />
with numbers less than 10 (for example, 03 or 45).<br />
S specifies the number of seconds in one or two digits (for<br />
example, 3 or 45).<br />
S1 specifies the number of seconds in two digits. A blank space<br />
is used with numbers less than 10 (for example, 3 or 45).<br />
S2 specifies the number of seconds in two digits. A zero is used<br />
with numbers less than 10 (for example, 03 or 45).<br />
F specifies hundredths of a second in one or two digits (for<br />
example, 3 or 45).<br />
F1 specifies hundredths of a second in two digits. A blank space<br />
is used with numbers less than 10 (for example, 3 or 45).<br />
F2 specifies hundredths of a second in two digits. A zero is used<br />
with numbers less than 10 (for example, 03 or 45).<br />
For more information: See “&RDF (real default format)” on page<br />
6-68 for information about real number masks in TSL.<br />
TSL Commands 6-97
&TDF (time default format)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
6-98 <strong>Language</strong> <strong>Reference</strong><br />
The following command sets the time default format to display the hours,<br />
minutes, seconds, and hundredths of seconds in 24-hour format. If the time<br />
is earlier than ten o’clock, the first output position will be a space.<br />
&tdf('h1:m2:s2.f2')<br />
The following command is equivalent:<br />
&tdf(t,'h1:m2:s2.f2')<br />
The following command sets the time default format to display the number<br />
of whole seconds into the day in five digits:<br />
&tdf(s,'99990')
&TITLE (set title)<br />
&TITLE (set title)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &TITLE command to specify a title that will appear at the top of<br />
every page of a report.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TITLE [text | ]<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
text<br />
is the text that <strong>AionDS</strong> displays as a title.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you do not enclose the text within angle brackets ( < > ), the text<br />
cannot extend past the end of the input line and cannot contain TSL<br />
commands or value substitution.<br />
■ If you do not enclose the title text in angle brackets and the top margin is<br />
greater than one, the title prints on the second line, regardless of the<br />
margin setting. If the margin is one, the title prints on the first line. If<br />
the margin is zero, the title is not printed.<br />
■ If you do not enclose the title text in angle brackets, the title is centered<br />
on the line. Specifically, it is centered between position 1 and the line<br />
length.<br />
■ If you enclose the text within angle brackets, the text can extend for<br />
multiple lines, can contain TSL commands, and can contain value<br />
substitution.<br />
■ If you enclose the text within angle brackets, the text prints starting at the<br />
top of the page. It does not extend past the top margin.<br />
■ If you enclose the text within angle brackets, you can use any TSL<br />
statement except the following ones: &BLK, &BM, &FOOTER, &LN,<br />
&N, &PG, &TBL, &TITLE, &TM.<br />
TSL Commands 6-99
&TITLE (set title)<br />
6-100 <strong>Language</strong> <strong>Reference</strong><br />
■ If you enclose the text within angle brackets, <strong>AionDS</strong> performs the<br />
following actions before printing the title:<br />
❐ Fill mode is cancelled.<br />
❐ Justify mode is cancelled.<br />
❐ Table mode is cancelled.<br />
❐ Line numbering is cancelled.<br />
❐ Left margin is set to 1.<br />
❐ Right margin is set to the line length.<br />
After printing the title, <strong>AionDS</strong> resets all modes, margins, and defaults to<br />
their previous settings, including any of these that have been reset within<br />
the &TITLE command.<br />
■ If you want the text to appear in the top margin of the first page, you<br />
must specify the &TITLE command before any text or TSL statements<br />
that cause output to be generated, such as &SK1.<br />
■ This command works in reports and in messages that are included in<br />
reports. If you put it in any other TSL property, <strong>AionDS</strong> ignores the<br />
command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following example displays the text Sales Summary centered on the<br />
second line of every page.<br />
&title Sales Summary<br />
The following example displays the value of the parameter %REPORT_TITLE<br />
in the first space of the first line of every page. On the second line of each<br />
page, indented eight spaces, is the date.<br />
&title
&TM (top margin)<br />
&TM (top margin)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &TM command to set the top margin of a report.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TM[ + | - ] number<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
number<br />
is either the relative or absolute position of the margin.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The plus ( + ) and minus ( - ) sign options move the margin down and<br />
up, respectively, in relation to the current margin.<br />
■ If you do not specify relative positioning using the plus or minus sign,<br />
number represents the absolute position for the margin.<br />
■ Absolute margins are measured in lines from the top of the page. Thus,<br />
the following command sets the margin five lines from the top of the<br />
page:<br />
&tm 5<br />
■ The default margin is specified in the Top Margin property of the report<br />
object.<br />
■ If you want to use a title, you must specify at least one line for the top<br />
margin.<br />
■ If the top and bottom margins are both zero, printing is continuous.<br />
Page eject commands are ignored.<br />
■ This command works in reports and in messages that are included in<br />
reports. If you put it in any other TSL property, <strong>AionDS</strong> ignores the<br />
command.<br />
TSL Commands 6-101
&TM (top margin)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
6-102 <strong>Language</strong> <strong>Reference</strong><br />
The following statement sets the top margin two lines lower on the page than<br />
the current margin:<br />
&tm+2<br />
The following statement raises the top margin three lines from its current<br />
position:<br />
&tm-3<br />
The following statement sets the top margin at six lines down from the top of<br />
the page:<br />
&tm6
&UND (unknown values)<br />
&UND (unknown values)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &UND command to change the default display when a parameter or<br />
slot value is unknown.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&UND 'string'<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
string<br />
is the string that replaces the default display.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &UND command causes string to be displayed when a parameter or<br />
slot is unresolved.<br />
■ <strong>AionDS</strong> uses the following default string if you do not specify another<br />
with the &UND command:<br />
Unknown<br />
■ If you want to include an ampersand ( & ) or angle brackets ( ) within<br />
a quoted string, you must precede them with an ampersand.<br />
■ If the parameter or slot is formatted to print in less space than is needed<br />
to print string, string will be truncated within the space allowed.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following lines appear in the text of a message. The &FI+ command<br />
ensures that the line used by the &UND command does not cause a blank<br />
line in the output.<br />
&fi+<br />
Height: %height &br<br />
&und 'n.a.'<br />
Weight: %weight<br />
If the parameters HEIGHT and WEIGHT are unknown at the time this<br />
message is displayed, the following text will appear in the message:<br />
Height: Unknown<br />
Weight: n.a.<br />
TSL Commands 6-103
&UND (unknown values)<br />
6-104 <strong>Language</strong> <strong>Reference</strong><br />
If a later message displays an unknown parameter, without using &UND<br />
within the text of that message, UNKNOWN will again be displayed.<br />
The following statement defines a string that is longer than is specified for the<br />
slot value:<br />
&und 'Unresolved'<br />
%weight:3<br />
This results in the following text if WEIGHT is unknown:<br />
Unr
&UNDPTR (unknown pointer)<br />
&UNDPTR (unknown pointer)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use the &UNDPTR command to specify text to be displayed when a pointer is<br />
unknown. If <strong>AionDS</strong> tries to follow a pointer to display instance<br />
information, but the pointer is unknown, <strong>AionDS</strong> displays the string<br />
specified in the &UNDPTR command.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&UNDPTR 'string'<br />
Syntax<br />
.........................................................................................................................................................................................................˝..........................................<br />
string<br />
is the string that replaces the default text.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ The &UNDPTR string is used whenever an unknown pointer is displayed,<br />
including cases in which a pointer points to an instance that has been<br />
deleted.<br />
■ <strong>AionDS</strong> uses the following default string if you do not specify another<br />
with the &UNDPTR command:<br />
NUL<br />
■ If you want to include an ampersand ( & ) or angle brackets ( ) within<br />
a quoted string, you must precede them with an ampersand.<br />
■ If the pointer is formatted to print in less space than is needed to print<br />
string, string will be truncated within the space allowed.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following example specifies that UNKNOWN be displayed for unknown<br />
pointers:<br />
&UNDPTR 'Unknown'<br />
TSL Commands 6-105
Summary of TSL commands<br />
Summary of TSL commands<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
6-106 <strong>Language</strong> <strong>Reference</strong><br />
This section gives a summary of TSL commands, grouped according to their<br />
use.<br />
■ Predefined functions<br />
■ Special characters<br />
■ Text modes<br />
■ White space<br />
■ Margins<br />
■ Formatting tables<br />
■ Developer-definable strings<br />
■ Embedded text<br />
■ Message passing<br />
■ Default formats and masks<br />
■ Comments<br />
■ Report commands<br />
You can use this summary to identify commands you need and as a quick<br />
syntax guide.
Predefined functions<br />
Summary of TSL commands<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CURRENTDATE [format]<br />
Date<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CURRENTTIME [format]<br />
Time<br />
.........................................................................................................................................................................................................˝..........................................<br />
%AES_PAGENUM [format]<br />
Page number (reports<br />
only)<br />
Class substitution<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CURRENTCLASS [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CURRENT [format]<br />
Current instance<br />
% [format]<br />
%IS [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
%slot_name [format]<br />
Slot of current<br />
instance<br />
%CURRENT.slot_name [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
%NAMEOF(instance) [format]<br />
Name of instance<br />
.........................................................................................................................................................................................................˝..........................................<br />
%UP.method[(arg1 [, arg2 ...])] [format]<br />
Send a message up<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]list_param <br />
Next element of list,<br />
set, or class<br />
All elements of list,<br />
set, or class<br />
Element number<br />
.........................................................................................................................................................................................................˝..........................................<br />
%[library::]list_param <br />
.........................................................................................................................................................................................................˝..........................................<br />
%INDEX[:[-]width]<br />
TSL Commands 6-107
Summary of TSL commands<br />
Special characters<br />
.........................................................................................................................................................................................................˝..........................................<br />
&%<br />
Percent<br />
.........................................................................................................................................................................................................˝..........................................<br />
&&<br />
Ampersand<br />
.........................................................................................................................................................................................................˝..........................................<br />
&(&)<br />
Parentheses<br />
.........................................................................................................................................................................................................˝..........................................<br />
&.<br />
Period<br />
.........................................................................................................................................................................................................˝..........................................<br />
&:<br />
Colon<br />
.........................................................................................................................................................................................................˝..........................................<br />
&< &><br />
Angle Brackets<br />
.........................................................................................................................................................................................................˝..........................................<br />
&ESC (byte[, byte...])<br />
Escape sequence<br />
6-108 <strong>Language</strong> <strong>Reference</strong>
Text modes<br />
Summary of TSL commands<br />
.........................................................................................................................................................................................................˝..........................................<br />
&C<br />
Center line<br />
.........................................................................................................................................................................................................˝..........................................<br />
&FI{ + | - }<br />
Fill mode<br />
.........................................................................................................................................................................................................˝..........................................<br />
&J{ + | - }<br />
Justify mode<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TB{ + | - }<br />
Table mode<br />
TSL Commands 6-109
Summary of TSL commands<br />
White space<br />
.........................................................................................................................................................................................................˝..........................................<br />
&BR<br />
Break line<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SK number<br />
Skip lines<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SSPC number<br />
Set spaces<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SPC<br />
Insert spaces<br />
.........................................................................................................................................................................................................˝..........................................<br />
&STAB (pos1[, pos2 ...])<br />
Set tab stops<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TAB<br />
Position at next tab<br />
6-110 <strong>Language</strong> <strong>Reference</strong>
Margins<br />
Summary of TSL commands<br />
.........................................................................................................................................................................................................˝..........................................<br />
&{LM | RM}[ + | - ] number<br />
Left and right<br />
margins<br />
.........................................................................................................................................................................................................˝..........................................<br />
&{LI | RI} [ + | - ] number<br />
Temporary margins<br />
.........................................................................................................................................................................................................˝..........................................<br />
&LN{ { : [ + | - ] number } | - }<br />
Line numbers<br />
.........................................................................................................................................................................................................˝..........................................<br />
&{LT | RT} 'string'<br />
Text in margins<br />
TSL Commands 6-111
Summary of TSL commands<br />
Formatting tables<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TBL [option [, option ...]] < text ><br />
Display table<br />
6-112 <strong>Language</strong> <strong>Reference</strong>
Developer-definable strings<br />
Summary of TSL commands<br />
.........................................................................................................................................................................................................˝..........................................<br />
&UND 'string'<br />
Set string for<br />
unknown parameter<br />
.........................................................................................................................................................................................................˝..........................................<br />
&UNDPTR 'string'<br />
Set string for<br />
unknown pointer<br />
.........................................................................................................................................................................................................˝..........................................<br />
&EMP 'string'<br />
Set string for empty<br />
list, set, or class<br />
.........................................................................................................................................................................................................˝..........................................<br />
&EMPTBL 'string'<br />
Set string for empty<br />
table<br />
TSL Commands 6-113
Summary of TSL commands<br />
Embedded text<br />
.........................................................................................................................................................................................................˝..........................................<br />
&INCLUDE {'file_name' | %[library::]string_param}<br />
Include a file<br />
.........................................................................................................................................................................................................˝..........................................<br />
&MSG [library::]msg_obj<br />
Substitute a message<br />
6-114 <strong>Language</strong> <strong>Reference</strong>
Message passing<br />
Summary of TSL commands<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SEND(method TO %classref [WITH arg1 [, arg2...]]) [format]<br />
Send to a class<br />
.........................................................................................................................................................................................................˝..........................................<br />
Send to an instance &SEND(method TO %instanceref [WITH arg1 [, arg2...]])<br />
[format]<br />
%instanceref.method[(arg1 [, arg2 ...])] [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SEND(method UP [WITH arg1 [, arg2...]]) [format]<br />
Send message which<br />
resides in parent<br />
%UP.method[(arg1 [, arg2 ...])] [format]<br />
.........................................................................................................................................................................................................˝..........................................<br />
%method[(arg1 [, arg2 ...])] [format]<br />
Send to current or<br />
nested instance<br />
Send to every<br />
instance<br />
.........................................................................................................................................................................................................˝..........................................<br />
%classref.method[(arg1 [, arg2 ...])] [format]<br />
TSL Commands 6-115
Summary of TSL commands<br />
Default formats and masks<br />
.........................................................................................................................................................................................................˝..........................................<br />
&DDF([dfmt,] 'mask')<br />
Date default format<br />
.........................................................................................................................................................................................................˝..........................................<br />
&IDF('mask'[, 'mask'])<br />
Integer default<br />
format<br />
Real default format<br />
.........................................................................................................................................................................................................˝..........................................<br />
&RDF(width, precision [, nfmt])<br />
6-116 <strong>Language</strong> <strong>Reference</strong><br />
&RDF('mask'[,'mask'])<br />
.........................................................................................................................................................................................................˝..........................................<br />
&TDF([tfmt,] 'mask')<br />
Time default format
Comments<br />
Summary of TSL commands<br />
.........................................................................................................................................................................................................˝..........................................<br />
&/* comment &*/<br />
Embed comments<br />
TSL Commands 6-117
Summary of TSL commands<br />
Report commands<br />
.........................................................................................................................................................................................................˝..........................................<br />
&{TM | BM}[ + | - ] number<br />
Top and bottom<br />
margin<br />
.........................................................................................................................................................................................................˝..........................................<br />
&{TITLE | FOOTER} [text | ]<br />
Titles and footers<br />
.........................................................................................................................................................................................................˝..........................................<br />
&N{ + | - }<br />
Page numbers<br />
.........................................................................................................................................................................................................˝..........................................<br />
&PG<br />
Page eject<br />
.........................................................................................................................................................................................................˝..........................................<br />
&BLK{ + | - }<br />
Mark blocks of text<br />
6-118 <strong>Language</strong> <strong>Reference</strong>
Appendix A<br />
Certainty<br />
.........................................................................................................................................................................................................˝..........................................<br />
Introduction<br />
Certainty is a measure of the strength of belief or confidence that the value of<br />
a parameter is true. Certainty is not, however, the probability that the value<br />
is true.<br />
<strong>AionDS</strong> provides constructs that allow representation, manipulation, and<br />
display of values that you are less than certain are true. This chapter<br />
introduces the concept of certainty and discusses how to implement certainty<br />
in knowledge bases.<br />
.........................................................................................................................................................................................................˝..........................................<br />
In this appendix<br />
Topic Page<br />
Introducing certainty A-2<br />
Certainty sets A-4<br />
Certainty factors A-6<br />
Certainty set operations A-10<br />
TSL statements A-25<br />
Displaying certainty sets in tables A-31<br />
Specifying certainty during consultations A-32<br />
Certainty A-1
Introducing certainty<br />
Introducing certainty<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
A-2 <strong>Language</strong> <strong>Reference</strong><br />
Consider the following example. Your knowledge base determines the return<br />
on investment (ROI) for international investments. The rules and other<br />
objects in the knowledge base establish an ROI in the following ranges:<br />
'< 5%', '6-10%', '11-15%', '16-20%', '> 20%'<br />
You might use the following rules that operate on ROI:<br />
if near_term_interest_rate < .08 then roi is '6-10%'<br />
if roi is '< 5%' then add project to reject_list<br />
When you do not use certainty, your confidence is absolute that the action of<br />
the first rule results in the correct choice. The second rule does not take into<br />
account uncertainty about the premise.<br />
When you use certainty, however, you can specify a confidence that is less<br />
than absolute. You can replace the first rule with one that adds the element<br />
6-10% to a set of possible returns on investment and, at the same time, you<br />
can specify your confidence that the element is actually part of the set. You<br />
can also replace the second rule with one that tests for inclusion of < 5% with<br />
the degree of confidence that you specify.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Basic concepts<br />
In <strong>AionDS</strong>, you can specify the strength of belief or confidence that an<br />
element is a member of a certainty set. You can specify the certainty, which<br />
is the degree of confidence that the element is actually part of the set.
Introducing certainty<br />
The certainty is represented by a certainty factor A certainty factor is<br />
associated with each element in the certainty set. Certainty factors range<br />
from -1.0 to +1.0, inclusive. Unless you change the interpretation, <strong>AionDS</strong><br />
uses the certainty factor as follows:<br />
Certainty factor Interpretation<br />
>= 0.2 and -0.2 and < 0.2 The element might be in the set (UNKNOWN)<br />
< -0.2 and >=-1.0 The element is not in the set (FALSE)<br />
Certainty A-3
Certainty sets<br />
Certainty sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Data types<br />
A-4 <strong>Language</strong> <strong>Reference</strong><br />
When you use certainty, you must replace the data type of a parameter with a<br />
certainty set of that data type because you need to associate more than one<br />
value with a parameter. For example, consider a string ROI that holds the<br />
return on investment.<br />
If you do not use certainty, the string can only hold one value, for example<br />
6-10%. When you use certainty, however, you need the ability to hold more<br />
than one value. For example, you might need to hold 6-10% with one<br />
degree of certainty and 11-15% with another degree of certainty.<br />
To use certainty, you must create a type object that uses the following syntax<br />
in the Type Definition property.<br />
.........................................................................................................................................................................................................˝..........................................<br />
[MULTIPLE] CERTAINTY SET OF type<br />
Syntax<br />
type is a basic or structured data type for each element.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
You create the parameter ROI with a Base Type property of a type object with<br />
the following type definition:<br />
certainty set of string<br />
This allows ROI to contain more than one string element. A certainty factor<br />
is associated with each element.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Using constraints<br />
If you want to constrain the string, you can create another type object that<br />
contains the constraint. For example, you can create ROI_VALUES with the<br />
following type definition:<br />
is from ('< 5%', '6-10%', '11-15%', '16-20%','> 20%')<br />
You use the type object that contains the constraint in the type object for the<br />
certainty set, as follows:<br />
certainty set of roi_values
The data type of the certainty set, in this case, is still string.<br />
Certainty sets<br />
Alternatively, you can constrain the certainty set in ROI_VALUES as follows:<br />
certainty set of<br />
from ('< 5%', '6-10%', '11-15%', '16-20%','> 20%')<br />
.........................................................................................................................................................................................................˝..........................................<br />
Set characteristics<br />
In general, certainty sets have the same characteristics as other sets, except<br />
each element in a certainty set consists of a value and a certainty factor. You<br />
should not, however, create a certainty set for Booleans.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Single certainty sets<br />
Single certainty sets have a unique processing characteristic. As soon as an<br />
element is added to the set with a certainty factor of 1.0, all other elements<br />
are discarded and the set is processed.<br />
You use single certainty sets when you know that there is only one possible<br />
result. Because an element with a certainty factor of 1.0 indicates complete<br />
confidence that a value is the correct result, other elements are no longer<br />
relevant after an element with a certainty of 1.0 is added to the set. If an<br />
element with a certainty factor of 1.0 is not added to the set during a<br />
consultation, a single certainty set has the same characteristics as any other<br />
set.<br />
You create a single certainty set when you do not use the MULTIPLE keyword.<br />
If you use MULTIPLE, you create a multiple certainty set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Multiple certainty<br />
sets<br />
Multiple certainty sets do not discard other elements when an element with a<br />
certainty factor of 1.0 is added. A multiple certainty set can contain more<br />
than one element with a certainty factor of 1.0.<br />
You can use multiple certainty sets as follows:<br />
■ When the set can contain more than one value in which you are<br />
completely confident. For example, the result might allow more than one<br />
correct answer.<br />
■ When you are completely confident that the value is correct, but you<br />
want to display other values that are close alternatives.<br />
Certainty A-5
Certainty factors<br />
Certainty factors<br />
.........................................................................................................................................................................................................˝..........................................<br />
Range of certainty<br />
factors<br />
A-6 <strong>Language</strong> <strong>Reference</strong><br />
A certainty factor is a number that represents the strength of belief that an<br />
element is in a certainty set. The certainty factor is on a scale from -1.0 to<br />
1.0, inclusive.<br />
Certainty factors are stored as Boolean numbers. <strong>AionDS</strong> represents<br />
Booleans internally as integers in the range of -100 to +100, inclusive. These<br />
correspond to certainty factors from -1.0 to +1.0, inclusive.<br />
The following diagram shows the range of certainty factors:<br />
<br />
-1.0 -.2 +.2 +1.0<br />
<br />
FALSE UNKNOWN TRUE<br />
.........................................................................................................................................................................................................˝..........................................<br />
Corresponding<br />
Boolean values<br />
<strong>AionDS</strong> interprets the meaning of a certainty factor. The meanings of TRUE,<br />
FALSE, and UNKNOWN in certainty sets are as follows:<br />
TRUE The element is included in the certainty set.<br />
FALSE The element is not included in the certainty set.<br />
UNKNOWN The element might be included in the certainty set.<br />
<strong>AionDS</strong> considers certainty factors of less than .20 but greater than -.20 as<br />
UNKNOWN. These values are still members of the set, however, and they can<br />
be tested for inclusion by KDL and displayed by TSL.
Certainty factors<br />
.........................................................................................................................................................................................................˝..........................................<br />
Certainty factor<br />
functions<br />
You can use two functions to determine the certainty factor of an element or<br />
to set its value:<br />
CERTAINTY returns the certainty that an element is included in the<br />
certainty set. You can also use this function to return a real<br />
number from a Boolean value.<br />
CF sets the certainty factor for an element of a certainty set.<br />
You can also use this function to return a Boolean value<br />
from a real number.<br />
The main purpose of these functions is to convert between certainty factors,<br />
which are Booleans, and real numbers that can be manipulated arithmetically.<br />
Certainty A-7
Certainty factors<br />
Certainty function<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
A-8 <strong>Language</strong> <strong>Reference</strong><br />
You can return the certainty factor for an element in one of two ways. If you<br />
want the certainty factor of an element where you know the element number,<br />
you can use the function in the following way:<br />
cf_value = certainty(roi(i))<br />
This statement assigns CF_VALUE with the certainty factor of the I th element<br />
of ROI. CF_VALUE must be a real number.<br />
If you do not know the position of the element, you can determine the<br />
certainty factor of an element by testing for the existence of the element by<br />
value. For example, the following statement determines the certainty factor<br />
of the element of ROI containing 6-10%:<br />
cf_value = certainty(roi includes '6-10%')<br />
.........................................................................................................................................................................................................˝..........................................<br />
Return values<br />
The CERTAINTY function returns the following values:<br />
■ The actual certainty factor for the element<br />
■ -1.0 if the element does not exist in the certainty set
CF function<br />
Certainty factors<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
The CF function converts a real number into a Boolean certainty factor. You<br />
use CF to assign a certainty factor when you add an element to a certainty set,<br />
or when you test the premise using a specific certainty factor.<br />
The certainty factor actually associated with the element also depends on<br />
whether the element already exists in the set.<br />
For more information: See the “Adding an element” section on page<br />
A-16.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following statement assigns 6-10% to ROI with a certainty factor of 0.5:<br />
if near_term_interest_rate < .08<br />
then add '6-10%' to roi with cf(.5)<br />
The following statement tests whether 6-10% exists in the set with a certainty<br />
factor of 0.5 or greater before <strong>AionDS</strong> executes the action:<br />
if roi includes '6-10%' with cf(.5) then ...<br />
Certainty A-9
Certainty set operations<br />
Certainty set operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
A-10 <strong>Language</strong> <strong>Reference</strong><br />
Using certainty sets causes <strong>AionDS</strong> to change the way it evaluates a premise<br />
and performs other set operations. The following sections discuss these<br />
operations:<br />
■ Testing a premise<br />
■ Changing the system threshold<br />
■ Adding an element<br />
■ Combining certainty factors<br />
■ Comparing certainty sets<br />
■ Comparing certainty set elements to Unknown<br />
■ Sorting certainty sets<br />
■ Other set operations
Testing a premise<br />
Certainty set operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
When you use a certainty set in a premise, you must consider the following<br />
points:<br />
■ The premise evaluates to TRUE only if the certainty factors that you use<br />
evaluate to TRUE. Unless you override the system threshold, TRUE is any<br />
certainty factor in the range of +0.2 to +1.0, inclusive.<br />
■ If the premise includes parameters other than certainty sets, <strong>AionDS</strong> uses<br />
the following constants for the certainty factor:<br />
TRUE +1.0<br />
FALSE -1.0<br />
UNKNOWN NUL<br />
.........................................................................................................................................................................................................˝..........................................<br />
Results of premise<br />
The following rules determine the certainty factor of a premise, where B1 and<br />
B2 represent either Boolean parameters or Boolean expressions.<br />
B1 AND B2 evaluates to the lower of the two certainty factors. B2 is not<br />
executed if the certainty of B1 evaluates to NUL or -1.0.<br />
B1 OR B2 evaluates to the greater of the two certainty factors. B2 is not<br />
executed if the certainty of B1 evaluates to +1.0.<br />
NOT B1 evaluates to the negation of the certainty factor. If the<br />
certainty factor is NUL, the negation also results in NUL.<br />
B1 = B2 evaluates to +1.0 if the value of B1 equals B2; otherwise the<br />
certainty factor evaluates to -1.0.<br />
B1 B2 both evaluate to +1.0 if the value of B1 does not equal B2;<br />
B1 XOR B2 otherwise the certainty factor evaluates to -1.0.<br />
B1 > B2 evaluates to +1.0 if the value of B1 is greater than the value<br />
of B2; otherwise the certainty factor evaluates to -1.0.<br />
Certainty A-11
Certainty set operations<br />
A-12 <strong>Language</strong> <strong>Reference</strong><br />
B1 >= B2 evaluates to +1.0 if the value of B1 is greater than or equal to<br />
the value of B2; otherwise the certainty factor evaluates to<br />
-1.0.<br />
B1 < B2 evaluates to +1.0 if the value of B1 is less than the value of<br />
B2; otherwise the certainty factor evaluates to -1.0.<br />
B1 >=<br />
1.0 1.0 1.0 1.0 -1.0 1.0 -1.0 1.0<br />
1.0 -1.0 -1.0 1.0 -1.0 -1.0 1.0 1.0<br />
1.0 nul nul 1.0 -1.0 nul nul nul<br />
1.0 0.0 0.0 1.0 -1.0 -1.0 1.0 1.0<br />
-1.0 1.0 -1.0 1.0 1.0 -1.0 -1.0 -1.0<br />
-1.0 -1.0 -1.0 -1.0 1.0 1.0 -1.0 1.0<br />
-1.0 nul -1.0 nul 1.0 nul nul nul<br />
-1.0 0.0 -1.0 0.0 1.0 -1.0 -1.0 -1.0<br />
nul 1.0 nul 1.0 nul nul nul nul<br />
nul -1.0 nul nul nul nul nul nul<br />
nul nul nul nul nul nul nul nul<br />
nul 0.0 nul nul nul nul nul nul<br />
0.0 1.0 0.0 1.0 0.0 -1.0 -1.0 -1.0<br />
0.0 -1.0 -1.0 0.0 0.0 -1.0 1.0 1.0<br />
0.0 nul nul nul 0.0 nul nul nul<br />
continued
continued<br />
Boolean<br />
expressions<br />
Resulting certainty factors<br />
B1 B2 AND OR NOT<br />
(B1)<br />
Certainty set operations<br />
= > >=<br />
0.0 0.0 0.0 0.0 0.0 1.0 -1.0 1.0<br />
0.5 0.7 0.5 0.7 -0.5 -1.0 -1.0 -1.0<br />
0.7 0.5 0.5 0.7 -0.7 -1.0 1.0 1.0<br />
0.5 0.1 0.1 0.5 -0.5 -1.0 1.0 1.0<br />
0.1 0.5 0.1 0.5 -0.1 -1.0 -1.0 -1.0<br />
-0.5 -0.7 -0.7 -0.5 0.5 -1.0 1.0 1.0<br />
-0.7 -0.5 -0.7 -0.5 0.7 -1.0 -1.0 -1.0<br />
Certainty A-13
Certainty set operations<br />
Changing the system threshold<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
A-14 <strong>Language</strong> <strong>Reference</strong><br />
In <strong>AionDS</strong>, the system threshold is +0.2. A rule fires when the certainty<br />
factor of the premise is +0.2 or greater.<br />
You can increase the certainty factor that is required to fire the rule by<br />
including a WITH clause in the premise.<br />
.........................................................................................................................................................................................................˝..........................................<br />
IF bool1 WITH bool2 THEN actions<br />
Syntax<br />
bool1 is the premise of the rule.<br />
bool2 is the certainty factor the premise must meet before the rule<br />
executes.<br />
actions are the actions of the rule.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
For example, the following rule executes only when the premise results in a<br />
certainty factor of 0.5 or greater:<br />
if (roi includes '16-20%' or roi includes '> 20%') with<br />
cf(0.5)<br />
then add project to possible_list<br />
If ROI contains either 16-20% with a certainty factor of at least 0.5 or > 20%<br />
with a certainty factor of at least 0.5, the rule executes. If you do not use<br />
parentheses the WITH clause associates with the clause to its left.<br />
If the certainty factor of the WITH clause is less than 0.2, the rule never fires,<br />
regardless of the certainty factor. To handle this case, you must explicitly<br />
compare certainty values. For example, the following rule executes when the<br />
certainty factor of the Boolean is greater than or equal to 0.15:<br />
if certainty(roi includes '16-20%'<br />
or roi includes '> 20%') >= .15<br />
then add project to possible_list
Certainty set operations<br />
The CERTAINTY function returns a real number that represents the certainty<br />
factor of the premise. The rule compares the certainty factor of the premise<br />
with the constant .15, which represents the certainty factor that allows the<br />
rule to fire.<br />
For more information: To determine the certainty factor for the premise,<br />
<strong>AionDS</strong> uses the rules defined in the “Testing a premise” section on page<br />
A-11.<br />
Certainty A-15
Certainty set operations<br />
Adding an element<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default certainty<br />
factor<br />
A-16 <strong>Language</strong> <strong>Reference</strong><br />
When you add an element to a certainty set, the default certainty factor is<br />
+1.0. For example, the following rule adds 6-10% to ROI with a certainty<br />
factor of 1.0:<br />
if economic_indicators includes mild_inflation<br />
then add '6-10%' to roi<br />
If ROI is a single certainty set, it only contains 6-10% after the rule executes.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Changing the<br />
certainty factor<br />
You can change the certainty factor of the element by using the WITH clause<br />
in the action. The following rule adds 6-10% to ROI with a certainty of 0.5:<br />
if economic_indicators includes mild_inflation<br />
then add '6-10%' to roi with cf(0.5)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Preserving certainty<br />
Use the system parameter AES_CF to copy the certainty of the premise into a<br />
certainty set element in the action of the rule. For example, if<br />
ECONOMIC_INDICATORS is a certainty set, you can use the following rule to<br />
add 6-10% to ROI with the same certainty as the premise:<br />
if economic_indicators includes mild_inflation<br />
then add '6-10%' to roi with cf(aes_cf)<br />
.............................................................................................................................................................................<br />
Example<br />
AES_CF is a real number. You can use it arithmetically. The following<br />
example specifies the certainty factor of the action to be slightly less than the<br />
certainty factor for the premise.<br />
if economic_indicators includes mild_inflation<br />
then add '6-10%' to roi with cf(.9*aes_cf)<br />
You must be careful not to perform arithmetic, however, that results in a<br />
certainty factor outside the range of -1.0 to +1.0, inclusive.
Certainty set operations<br />
.............................................................................................................................................................................<br />
Else clauses<br />
The certainty factor of the implied premise in an ELSE clause is always 1.0.<br />
Therefore, AES_CF always contains 1.0 when <strong>AionDS</strong> executes an ELSE<br />
clause. You must explicitly set the certainty factor if you do not want to use<br />
1.0.<br />
The following statement shows an example of setting the certainty factor of<br />
an action in an ELSE clause to be the same as the certainty factor of the<br />
premise:<br />
if economic_indicators includes mild_inflation<br />
then add '6-10%' to roi with cf(.9*aes_cf)<br />
else add '6-10%' to roi<br />
with economic_indicators includes mild_inflation<br />
AES_CF is undefined outside of the action of an IF statement. Using AES_CF<br />
elsewhere can cause unpredictable results.<br />
Certainty A-17
Certainty set operations<br />
Combining certainty factors<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
A-18 <strong>Language</strong> <strong>Reference</strong><br />
When you add an element to a certainty set for the first time, the initial<br />
certainty factor is either what you specify in the rule or the default certainty<br />
factor.<br />
For more information: The “Adding an element” section on page A-16<br />
shows how to add certainty factors.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Duplicate elements<br />
Even though you add the same element to a certainty set several times, the<br />
element and its certainty factor appear only once in the set. The certainty<br />
factor of the element you add is weighted with the element that is already<br />
present in the certainty set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Weighting factors<br />
The following table shows the algorithm for weighting certainty factors.<br />
Old CF New CF Rule<br />
>=0 >=0 old + (new * (1-old))<br />
>=0 < 0 (old + new) / (1-min(abs(old),abs(new)))<br />
< 0 >=0 (old + new) / (1-min(abs(old),abs(new)))<br />
< 0 < 0 old + (new * (1+old))<br />
OLD is the certainty factor of the element in the set. NEW is the certainty<br />
factor of the matching element that you add to the set. For example, if RED<br />
exists in the certainty set with a certainty factor of 0.2, and you add RED to<br />
the set again with an certainty factor of 0.5, the resulting certainty is 0.6, or:<br />
0.2 + 0.5 * (1.0 - 0.2)<br />
If the old certainty factor is -0.1 and the new certainty factor is +0.2, the<br />
resulting certainty factor is 0.11, or:<br />
(-0.1 + 0.2) / (1 - (min(0.1,0.2)))
Comparing certainty sets<br />
Certainty set operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of operators<br />
You can compare certainty sets for equality or inequality by using the<br />
following operators:<br />
=<br />
is<br />
are<br />
<br />
is not<br />
are not<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
<strong>AionDS</strong> only uses elements with certainty factors greater than or equal than<br />
+0.2 in the comparison. Consider the following sets:<br />
A: ('red' cf(0.6), 'white' cf(0.2), 'blue' cf(0.5))<br />
B: ('red' cf(0.6), 'white' cf(0.5), 'blue' cf(-.5))<br />
C: ('red' cf(0.4), 'white' cf(0.7))<br />
For the purpose of comparison, <strong>AionDS</strong> does not consider blue to be a<br />
member of set B because its certainty factor, -0.5, is less than 0.2. <strong>AionDS</strong><br />
considers only the following elements:<br />
A: ('red' cf(0.6), 'white' cf(0.2), 'blue' cf(0.5))<br />
B: ('red' cf(0.6), 'white' cf(0.5))<br />
C: ('red' cf(0.4), 'white' cf(0.7))<br />
Sets B and C are equal because they contain the same elements when elements<br />
with certainty factors less than 0.2 are excluded from the comparison.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Certainty factors of<br />
set comparisons<br />
If certainty sets are not equal, the certainty factor of a Boolean result of the<br />
comparison is -1.0. Thus, if you compare sets A and B in a premise, the<br />
certainty factor is -1.0.<br />
If certainty sets are equal, the certainty factor of a Boolean result is the lowest<br />
certainty factor of all the elements in the comparison. If you compare sets B<br />
and C, the lowest certainty factor is 0.4. Thus, the certainty factor of the<br />
following premise is 0.4:<br />
if a = b then ...<br />
Certainty A-19
Certainty set operations<br />
A-20 <strong>Language</strong> <strong>Reference</strong><br />
If you compare B to itself, the certainty factor for the comparison is 0.5,<br />
which is the lowest certainty factor in set B.
Comparing certainty set elements to Unknown<br />
Certainty set operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
Compare an element of a certainty set to UNKNOWN by using any of the set<br />
comparison operators. An element is UNKNOWN if it is between -0.2 and<br />
+0.2.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Results<br />
A test for UNKNOWN always results in a certainty factor of +1.0 if the<br />
premise is TRUE. Otherwise, the certainty factor is -1.0, representing FALSE.<br />
If you compare an entire certainty set to UNKNOWN, the result is TRUE only<br />
if the set is empty. If the set contains an element, the set is not UNKNOWN,<br />
regardless of the certainty factor of the element.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following set COLORS:<br />
('red' cf(0.6), 'white' cf(0.5),<br />
'blue' cf(-.5), 'green' cf(0.1))<br />
The following premises result in certainty factors of 1.0:<br />
if colors(1) is not unknown then ...<br />
if colors(3) is not unknown then ...<br />
if colors(4) is unknown ...<br />
The following premises result in certainty factors of -1.0:<br />
if colors(1) is unknown ...<br />
if colors(3) is unknown ...<br />
if colors(4) is not unknown ...<br />
Certainty A-21
Certainty set operations<br />
Sorting certainty sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
A-22 <strong>Language</strong> <strong>Reference</strong><br />
You can sort certainty sets in three ways. They are as follows:<br />
■ Ascending order by element value using ASORT<br />
■ Descending order by element value using DSORT<br />
■ Descending order by certainty factor using CSORT<br />
.........................................................................................................................................................................................................˝..........................................<br />
CSORT<br />
Use CSORT when you want to present the elements in order of confidence,<br />
from the highest certainty factor to the lowest certainty factor. For example,<br />
you can sort ROI into DISPLAY_ROI and use DISPLAY_ROI in a message<br />
showing possible returns on investment and your confidence in each return<br />
element. The following statement performs the sort:<br />
display_roi = csort(roi)<br />
You can retrieve the most certain element of the sorted set, as follows:<br />
probable_roi = display_roi(1)<br />
Alternatively, you can perform both actions in a single step, as follows:<br />
probable_roi = csort(roi)(1)<br />
.........................................................................................................................................................................................................˝..........................................<br />
ASORT and DSORT<br />
ASORT and DSORT are statements for sorting any list or set, including<br />
certainty sets.<br />
For more information: See the description of these statements in Chapter<br />
4, “KDL Statement Syntax,” for more information.
Other set operations<br />
Certainty set operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
The following additional set operations are defined for certainty sets:<br />
UNION returns a unique list of elements in two or more sets.<br />
INTERSECTION returns the common elements of two or more sets.<br />
SIZE returns the size of the set.<br />
These operators preserve UNKNOWN elements, which have a certainty factor<br />
between -0.2 and 0.2.<br />
Consider the following sets in the discussion of these set operations:<br />
A: ('red' cf(0.6), 'white' cf(0.2), 'blue' cf(0.5))<br />
B: ('red' cf(0.1), 'white' cf(0.5), 'blue' cf(-.5))<br />
C: ('red' cf(0.4), 'white' cf(0.7))<br />
.........................................................................................................................................................................................................˝..........................................<br />
Union<br />
The UNION operator returns the elements of all sets. When an element is<br />
represented in two or more sets, the highest certainty factor is associated with<br />
the element in the union set.<br />
The following set results from the union of sets A, B, and C:<br />
('red' cf(0.6), 'white' cf(0.7), 'blue' cf(0.5))<br />
.........................................................................................................................................................................................................˝..........................................<br />
Intersection<br />
The INTERSECTION operator returns all elements that are common to all sets.<br />
When an element is represented in all of the sets, the lowest certainty factor is<br />
associated with the element in the intersection set.<br />
The following set results from the intersection of sets A, B, and C:<br />
('red' cf(0.1), 'white' cf(0.2))<br />
Certainty A-23
Certainty set operations<br />
.........................................................................................................................................................................................................˝..........................................<br />
Size<br />
A-24 <strong>Language</strong> <strong>Reference</strong><br />
The SIZE operator returns the number of elements in the certainty set,<br />
regardless of UNKNOWN values. The sizes of A, B, and C are 3, 3, and 2,<br />
respectively.
TSL statements<br />
TSL statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can display certainty sets and individual elements of certainty sets just as<br />
you display any set or element. <strong>AionDS</strong> provides additional TSL commands<br />
to handle the selection of set elements and display of the certainty factors, as<br />
follows:<br />
&SCF sets the display format of the certainty factor.<br />
&SCS sets the substitution criteria for the certainty set elements.<br />
%CERTAINTY displays a certainty factor.<br />
In a message or report that uses certainty factors, you must specify the<br />
following characteristics or use the default choices:<br />
■ The format of certainty factors<br />
■ The substitution criteria<br />
■ Whether to use a default or formatted display<br />
The following sections discuss these choices.<br />
Certainty A-25
TSL statements<br />
Setting TSL formatting criteria<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
A-26 <strong>Language</strong> <strong>Reference</strong><br />
Use &SCF to set the display format for certainty factors.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SCF {F | W}<br />
Syntax<br />
F Specifies a real or floating-point format, such as 0.5, -0.2, or -1.0. It<br />
is the default.<br />
W Specifies a whole number, such as 50, -20, or -100.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Assume that X_CF contains a certainty factor of 0.6. The following TSL<br />
statements produce the output below each statement:<br />
&scf f The certainty factor is %x_cf.<br />
The certainty factor is 0.6.<br />
&scf w The certainty factor is %x_cf.<br />
The certainty factor is 60.
Setting TSL substitution criteria<br />
TSL statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Use &SCS to choose the substitution criteria for a certainty set.<br />
.........................................................................................................................................................................................................˝..........................................<br />
&SCS {T | A | D | M}<br />
Syntax<br />
T Specifies display of only true values, which are values with certainty<br />
factors between +0.2 and +1.0, inclusive. It is the default.<br />
A Specifies display of all values, regardless of the certainty factor.<br />
D Specifies display of definite values, which are values where the<br />
certainty factor is 1.0.<br />
M Specifies display of the maximum value, which is the value with the<br />
highest certainty factor. If two or more certainty factors are tied for<br />
the highest value, TSL displays multiple values, one for each<br />
certainty factor in the tie.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following set:<br />
('red' cf(0.2), 'white' cf(0.5), 'black' cf(0.5),<br />
'blue' cf(-.5), 'green' cf(0.1))<br />
The options display elements in the format that you choose, as follows:<br />
T displays red, white, and black<br />
A displays red, white, black, blue, and green<br />
D displays * empty list *<br />
M displays white and black<br />
Certainty A-27
TSL statements<br />
Unformatted substitution of certainty sets<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default format<br />
A-28 <strong>Language</strong> <strong>Reference</strong><br />
Default substitution format of certainty sets is the same as the default<br />
substitution format for other sets, except that the certainty factor of each<br />
element is displayed with the element. Consider the following set COLORS:<br />
('red' cf(0.1), 'white' cf(0.5), 'blue' cf(-.5))<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
The following TSL statements produce the display that follows them:<br />
&scs a &scf f %colors<br />
red (0.1), white (0.5) and blue (-0.5)<br />
&scs a &scf w %colors<br />
red (10), white (50) and blue (-50)
Formatted substitution of certainty sets<br />
TSL statements<br />
.........................................................................................................................................................................................................˝..........................................<br />
Usage<br />
Formatted substitution of certainty sets is the same as formatted substitution<br />
of other sets, except that you can also specify the certainty factor. Use<br />
%CERTAINTY to specify the display of the certainty factor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
%CERTAINTY[:[-]width[:precision]]<br />
Syntax<br />
width is the number of positions for the display of the certainty<br />
factor.<br />
precision is the number of positions displayed after the decimal point.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Remarks<br />
■ If you do not specify any arguments, the certainty factor is displayed<br />
according to the format specified by the &SCF command. If you specify<br />
the F option or use the default, you can use the real default format &RDF<br />
to format the certainty factor.<br />
■ If the minus sign (-) is present, TSL left-justifies the certainty factor;<br />
otherwise TSL right-justifies the certainty factor.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Examples<br />
Consider the following set COLORS:<br />
('red' cf(0.1), 'white' cf(0.5), 'blue' cf(-.5))<br />
The following TSL statement produces the display that follows it:<br />
&scs a %colors <br />
red with certainty 0.10<br />
white with certainty 0.50<br />
blue with certainty -0.50<br />
Certainty A-29
TSL statements<br />
A-30 <strong>Language</strong> <strong>Reference</strong><br />
Consider the following certainty set of sets X:<br />
(<br />
(10, 20, 30, 40 cf(0.2))<br />
(11, 12, 13, 14 cf(0.5))<br />
(100, 200, 300, 400 cf(-1.0))<br />
)<br />
The following TSL statement produces the display that follows it:<br />
&scs a &scf w %x <br />
10 20 30 40 20<br />
11 12 13 14 50<br />
100 200 300 400 -100<br />
The following TSL statement produces the display that follows it:<br />
&scs a &scf w %x <br />
20<br />
50<br />
-100<br />
.........................................................................................................................................................................................................˝..........................................<br />
Boolean displays<br />
You can display the certainty factor by substituting the possible Boolean<br />
values with strings. When you place a percent sign in a string, the value of<br />
the Boolean appears.<br />
Consider the following example:<br />
&scs a &scf w<br />
%roi(1) 20% with very little confidence<br />
ROI < 5% is unlikely (-100)
Displaying certainty sets in tables<br />
Displaying certainty sets in tables<br />
.........................................................................................................................................................................................................˝..........................................<br />
Overview<br />
You can use certainty sets with the &TBL command. In default certainty set<br />
substitution, the command displays each element of the set and its certainty<br />
factor on a separate line. The certainty factor follows the element and is in<br />
parentheses. Consider the following command:<br />
&tbl titleoff < %cert_set ><br />
The command specifies the following kind of display:<br />
Lions (-0.20)<br />
Tigers (0.30)<br />
Bears (0.30)<br />
.........................................................................................................................................................................................................˝..........................................<br />
Omitting the<br />
certainty factor<br />
If you do not want to display the certainty factor, specify after the<br />
certainty set name, as follows:<br />
&tbl titleoff < %cert_set ><br />
The following display is the result:<br />
Lions<br />
Tigers<br />
Bears<br />
.........................................................................................................................................................................................................˝..........................................<br />
Displaying only the<br />
certainty factor<br />
If you only want to print the certainty factor, specify after<br />
the certainty set name. Consider the following TSL command:<br />
&tbl titleoff < %cert_set %cert_set ><br />
The command specifies a two column table. The first column displays the<br />
certainty set element without the certainty factor. The second column<br />
displays the certainty factor without the element. The following display is the<br />
result:<br />
Lions -0.20<br />
Tigers 0.30<br />
Bears 0.80<br />
Certainty A-31
Specifying certainty during consultations<br />
Specifying certainty during consultations<br />
.........................................................................................................................................................................................................˝..........................................<br />
Default windows<br />
A-32 <strong>Language</strong> <strong>Reference</strong><br />
When the user must enter values for a certainty set, the default screen in a<br />
character-based consultation contains three windows, as follows:<br />
Prompt contains the prompt message.<br />
Answer allows the user to respond.<br />
Certainty allows the user to supply a certainty factor.<br />
You can change the window display by attaching a display object.<br />
Tip: There is no default display for a graphical knowledge base. However,<br />
you can create one by customizing an AskDialog.<br />
.........................................................................................................................................................................................................˝..........................................<br />
User input<br />
During the consultation, the user must enter a value for each element of the<br />
set and a confidence in the range of -1.0 to 1.0, inclusive. Enter the certainty<br />
factors in the Certainty window to the right of the Answer window. If the set<br />
is a single certainty set, the user can enter at most only one confidence of 1.0.<br />
If the parameter contains a constrained string, the Answer window is<br />
protected and the user can only enter a certainty factor for each value that is<br />
included in the answer. If a certainty value is not entered for an element of<br />
the set, <strong>AionDS</strong> does not consider that particular element as part of the set.
Specifying certainty during consultations<br />
.........................................................................................................................................................................................................˝..........................................<br />
Example<br />
The following figure shows the default screen for ROI.<br />
.........................................................................................................................................................................................................˝..........................................<br />
Structured data types<br />
If the certainty set is a set of a structured data type, such as a list, set, or<br />
record, the user enters all the values for the structured data type. The<br />
certainty window pops up after the user enters the values for the structure.<br />
<strong>AionDS</strong> quits prompting for responses if the user enters a certainty factor of<br />
1.0 when using a single certainty set.<br />
Certainty A-33
Specifying certainty during consultations<br />
A-34 <strong>Language</strong> <strong>Reference</strong>
Appendix B<br />
Reserved Words<br />
.........................................................................................................................................................................................................˝..........................................<br />
List of words<br />
The following table lists <strong>AionDS</strong> reserved words.<br />
ABS<br />
ADD<br />
AES<br />
AES_ *<br />
AND<br />
APPEND<br />
ARCTAN<br />
ARE<br />
ASK<br />
ASORT<br />
BESTVALUE<br />
BIN<br />
BOOLEAN<br />
BREAK<br />
BREAKIF<br />
BYNAME<br />
CERTAINTY<br />
CF<br />
CLASS<br />
CLEAR<br />
CLOSEFILE<br />
CM<br />
COS<br />
CREATE<br />
CSORT<br />
CURRENT<br />
CURRENTCLASS<br />
CURRENTDATE<br />
CURRENTTIME<br />
CURRENTVALUE<br />
DATE<br />
DAYS<br />
DBINFO<br />
DBMS<br />
DDE_ *<br />
DELETE<br />
DELETEREC<br />
DIFFERENCE<br />
DISPLAY<br />
DIV<br />
DSORT<br />
ELSE<br />
ELSEIF<br />
END<br />
EOF<br />
EXISTS<br />
EXITSTATE<br />
EXP<br />
FILE<br />
FILESTATUS<br />
FINALVALUE<br />
FIRST<br />
FOR<br />
FORWARDCHAIN<br />
FROM<br />
FUNCTION<br />
GETREC<br />
GRAPH<br />
GROUP<br />
HEX<br />
Reserved Words B-1
B-2 <strong>Language</strong> <strong>Reference</strong><br />
HSECONDS<br />
IDMS<br />
IF<br />
IFMATCH<br />
INCLUDES<br />
INDEX<br />
INSTANCE<br />
INTEGER<br />
INTERSECTION<br />
INTO<br />
IS<br />
ITERATE<br />
LAST<br />
LENGTH<br />
LIST<br />
LN<br />
LOOP<br />
MAX<br />
MESSAGE<br />
MIN<br />
MOD<br />
MONTHS<br />
MULTIPLE<br />
NAMEOF<br />
NOT<br />
NUM<br />
OF<br />
ON<br />
OPENFILE<br />
OR<br />
ORDERBY<br />
PARAMETER<br />
POINTER<br />
PROCESS<br />
PUTREC<br />
READSTR<br />
REAL<br />
RECORD<br />
REPORT<br />
RETURN<br />
ROUND<br />
RULE<br />
SELECT<br />
SELECTALL<br />
SELECTONE<br />
SEND<br />
SET<br />
SIN<br />
SIZE<br />
SLOT<br />
SOURCEVALUE<br />
SQL<br />
SQLCONNECT<br />
SQR<br />
SQRT<br />
STATE<br />
STR<br />
STRING<br />
SUBSTRING<br />
THEN<br />
TIME<br />
TIMESTAMP<br />
TO<br />
TRUNC<br />
UNION<br />
UNKNOWN<br />
UP<br />
WEEKDAY<br />
WIN_ *<br />
WITH<br />
WRITESTR<br />
XOR<br />
YEARDAY<br />
YEARS<br />
* Do not use words beginning with AES_, DDE_, or WIN_. They are used<br />
internally by <strong>AionDS</strong> or are reserved for future use.
Index<br />
%<br />
%, syntax and use of, 6-9<br />
%aes_pagenum, syntax and use of, 6-10<br />
%currentdate, syntax and use of, 6-14<br />
%currenttime, syntax and use of, 6-15<br />
%emptbl, syntax and use of, 6-45<br />
%is, syntax and use of, 6-20<br />
%nameof, syntax and use of, 6-22<br />
%up, syntax and use of, 6-24<br />
&<br />
&%, syntax and use of, 6-26<br />
&&, syntax and use of, 6-27<br />
&(, syntax and use of, 6-28<br />
&), syntax and use of, 6-29<br />
&*/, syntax and use of, 6-30<br />
&, syntax and use of symbol, 4-16<br />
&., syntax and use of, 6-31<br />
&/*, syntax and use of, 6-32<br />
&:, syntax and use of, 6-33<br />
&, syntax and use of, 6-35<br />
&blk, syntax and use of, 6-36<br />
&bm, syntax and use of, 6-37<br />
&br, syntax and use of, 6-39<br />
&c, syntax and use of, 6-40<br />
&ddf, syntax and use of, 6-41<br />
&emp, syntax and use of, 6-44<br />
&fi, syntax and use of, 6-47<br />
&footer, syntax and use of, 6-49<br />
&idf, syntax and use of, 6-51<br />
&include, syntax and use of, 6-54<br />
&j, syntax and use of, 6-56<br />
&li, syntax and use of, 6-58<br />
&ln, syntax and use of, 6-61<br />
<, syntax and use of, 6-63<br />
&msg, syntax and use of, 6-65<br />
&n, syntax and use of, 6-66<br />
&rdf, syntax and use of, 6-68<br />
&ri, syntax and use of, 6-73<br />
&rm, syntax and use of, 6-74<br />
&rt, syntax and use of, 6-75<br />
&scf, syntax and use of, 10-26<br />
&send, syntax and use of, 6-77<br />
&sk, syntax and use of, 6-81<br />
&spc, syntax and use of, 6-82<br />
&sspc, syntax and use of, 6-83<br />
&stab, syntax and use of, 6-84<br />
&tab, syntax and use of, 6-85<br />
&tb, syntax and use of, 6-86<br />
&tbl<br />
displaying certainty sets, 10-31<br />
syntax and use of, 6-88<br />
&tdf, syntax and use of, 6-96<br />
&title, syntax and use of, 6-99<br />
&tm, syntax and use of, 6-101<br />
&und, syntax and use of, 6-103<br />
&undptr, syntax and use of, 6-105<br />
*<br />
**, syntax and use of symbol, 4-18<br />
*, syntax and use of symbol, 4-17<br />
+<br />
+, syntax and use of symbol, 4-19<br />
Index I-1
,<br />
-, syntax and use of symbol, 4-20<br />
/<br />
/, syntax and use of symbol, 4-21<br />
><br />
-><br />
A<br />
in pointer expressions, 3-6<br />
abort, option of aes statement, 4-26<br />
abs, syntax and use of, 4-23<br />
absolute value function, 4-23<br />
access method<br />
in PC systems, 1-33<br />
overview, 1-32<br />
action, compound, 4-165<br />
add<br />
element to a certainty set, 10-16<br />
element to set or list, 4-24<br />
option of CM statement, 4-65<br />
syntax and use of KDL statement, 4-24<br />
windows to screen, 4-65<br />
addition operator, 4-19<br />
aes statement<br />
abort, 4-26<br />
break, 4-27<br />
chain, 4-28<br />
error, 4-30<br />
exitcode, 4-31<br />
KDL syntax summary, 4-263<br />
overview, 4-25<br />
I-2 <strong>Language</strong> <strong>Reference</strong><br />
profile, 4-32<br />
title, 4-33<br />
tracelevel, 4-34<br />
writelog, 4-36<br />
writetrace, 4-37<br />
aes_cf<br />
description of, 10-16<br />
syntax and use of, 4-38<br />
aes_chain, 4-28<br />
aes_title, 4-33<br />
aes_tslmessage, 5-60<br />
aes_tslprompt, 5-60<br />
aes_tslreport, 5-60<br />
aes_tsltext, 5-60<br />
agenda<br />
agenda statements, 3-28<br />
combining sourcing and processing options,<br />
3-34<br />
function statement, 4-157<br />
graph statement, 4-159<br />
group statement, 4-161<br />
KDL syntax summary, 4-259<br />
message statement, 4-182<br />
parameter statement, 4-191<br />
process statement, 4-193<br />
processing options, 3-32<br />
report statement, 4-199<br />
rule statement, 4-203<br />
slot statement, 4-217<br />
sourcing options, 3-30<br />
specifying goals, 3-28<br />
state statement, 4-222<br />
statement in rules and functions, 3-36<br />
<strong>AionDS</strong>, data types, 1-2<br />
ampersand display in TSL, 6-27<br />
and, syntax and use of, 4-39<br />
append, syntax and use of KDL statement, 4-41<br />
arctan, syntax and use of, 4-42<br />
arctangent function, 4-42
arguments, in message passing, 4-210<br />
arithmetic operators, 3-12<br />
ascending sort, 4-47<br />
ask, syntax and use of, 4-43<br />
asort, syntax and use of, 4-47<br />
assignment<br />
definition of, 3-42<br />
operators, 3-42<br />
with KDL, 3-39<br />
associating text with booleans, 5-27, 10-30<br />
associating text with parameters and slots, 5-7<br />
automatic data interface, dbms statement, 4-127<br />
B<br />
beep option of CM statement, 4-68<br />
begin comment in TSL, 6-32<br />
bestvalue, syntax and use of, 4-50<br />
bin, syntax and use of, 4-51<br />
binary<br />
digit conversion, 4-51<br />
display using TSL, 5-13<br />
boolean<br />
associating text in TSL, 5-27, 10-30<br />
base type, 1-3<br />
conversion to string, 4-224<br />
criteria to display instances, 5-33<br />
description of, 1-3<br />
expressions, 3-3<br />
formatting in TSL, 5-26<br />
in non-textual file, 1-48<br />
in textual file, 1-39<br />
KDL syntax summary, 4-248, 4-252<br />
TDL statement, 2-3<br />
bottom margin. see margin<br />
break<br />
option of aes statement, 4-27<br />
syntax and use of KDL statement, 4-52<br />
breakif, syntax and use of, 4-53<br />
breaks in TSL text lines, 6-39<br />
byname clause, syntax and use of, 4-54<br />
C<br />
canceling the effect of new lines and spaces in<br />
TSL, 6-86<br />
centering lines with TSL, 6-40<br />
certainty. see also certainty set<br />
basic concepts, 10-2<br />
certainty factor, 4-56, 4-57, 10-3<br />
changing the certainty factor, 4-242<br />
changing the system threshold, 10-14<br />
consultation input, 10-32<br />
description of KDL statement, 10-8<br />
display in tables, 10-31<br />
file attribute, 1-36, 1-54<br />
noattr attribute, 1-36, 1-54<br />
overview, 10-1<br />
preserving the certainty factor, 10-16<br />
set size, 4-216<br />
sort function, 4-115<br />
syntax and use of aes_cf, 4-38<br />
syntax and use of KDL statement, 4-56<br />
testing a premise, 10-11<br />
TSL statements, 10-25<br />
certainty factor. see also certainty<br />
combining, 10-18<br />
conversion, 10-9<br />
description of, 10-3, 10-6<br />
preserving, 10-16<br />
returned from a comparison, 10-19<br />
returning the value of, 10-8<br />
certainty set<br />
adding an element, 10-16<br />
boolean displays, 10-30<br />
certainty factor, 10-6<br />
Index I-3
cf<br />
comparing an element to unknown, 10-21<br />
comparison, 10-19<br />
description of, 10-4<br />
formatted substitution, 10-29<br />
formatting in TSL, 10-26<br />
intersection, 10-23<br />
KDL syntax summary, 4-256<br />
multiple, 10-4, 10-5<br />
operations, 10-10, 10-23<br />
single, 10-5<br />
size, 10-24<br />
sorting, 10-22<br />
substitution criteria in TSL, 10-27<br />
unformatted substitution, 10-28<br />
union, 10-23<br />
using in a premise, 10-11<br />
description of, 10-9<br />
syntax and use of, 4-57<br />
chain, option of aes statement, 4-28<br />
changing modes in TSL, 6-47, 6-56<br />
Changing the display of unknown in TSL, 6-44,<br />
6-103, 6-105<br />
checklength attribute, 1-12<br />
class<br />
boolean criteria for TSL display, 5-31<br />
current, 3-17<br />
displaying with TSL, 5-31<br />
iteration, 4-147<br />
references to, 3-16<br />
send message to, 4-207<br />
TSL syntax summary, 5-67<br />
using boolean criteria to display classes, 5-33<br />
clear, syntax and use of KDL statement, 4-58<br />
close comment in TSL, 6-30<br />
closing angle bracket display in TSL, 6-35<br />
closing parenthesis display in TSL, 6-29<br />
CM<br />
add, 4-65<br />
I-4 <strong>Language</strong> <strong>Reference</strong><br />
beep, 4-68<br />
delete, 4-69<br />
error, 4-71<br />
getcoordinates, 4-73<br />
getcursor, 4-74<br />
getdimensions, 4-75<br />
getinfo, 4-76<br />
getoutlinecolor, 4-79<br />
getposition, 4-81<br />
getstatus, 4-82<br />
gettext, 4-84<br />
gettextcolor, 4-85<br />
gettitlecolor, 4-87<br />
gettitleposition, 4-89<br />
getwindow, 4-90<br />
getwindowlist, 4-93<br />
getword, 4-94<br />
KDL syntax summary, 4-261<br />
popup, 4-95<br />
setcursor, 4-97<br />
setdimensions, 4-98<br />
setoutlinecolor, 4-99<br />
setposition, 4-101<br />
settextcolor, 4-102<br />
settitlecolor, 4-104<br />
settitleposition, 4-106<br />
system, 4-107<br />
CM GetObjectInfo<br />
syntax, 4-78<br />
colon, displaying in TSL, 6-33<br />
color<br />
get outline color, 4-79<br />
get text color, 4-85<br />
get title color, 4-87<br />
set outline color, 4-99<br />
set text color, 4-102<br />
set title color, 4-104<br />
combining certainty factors, 10-18<br />
commands, in TSL, 6-1
comments<br />
in KDL, 4-22<br />
in TSL, 6-30, 6-32<br />
commits<br />
dbms option, 4-127<br />
local access, with, 4-128<br />
remote access, with, 4-128<br />
unit of work, 4-128<br />
comparison<br />
certainty set element to unknown, 10-21<br />
of certainty sets, 10-19<br />
of real numbers, 3-10<br />
comparison-tolerance, 3-10<br />
compatibility, in <strong>AionDS</strong> environments, 1-17<br />
compound actions, 4-165<br />
concatenation symbol, 4-16<br />
confidence. see certainty<br />
constraint<br />
clearing, 4-58<br />
data types, 1-8<br />
definition of, 3-40<br />
in type objects, 1-8<br />
numeric, syntax and use of, 2-36<br />
string, syntax and use of, 2-37<br />
TDL syntax, 2-35<br />
consultation monitor KDL statements, 4-13<br />
consultation monitor statements. see CM<br />
consultation, using certainty, 10-32<br />
control of flow, 3-22<br />
control statements, KDL syntax summary, 4-258<br />
conversion<br />
binary digits to integer, 4-51<br />
boolean to string, 4-224<br />
date from string, 4-119, 4-123<br />
date to day of week, 4-124<br />
date to integer, 4-119, 4-120, 4-123<br />
date to julian date, 4-125<br />
date to months, 4-121<br />
date to parts, 4-122<br />
date to record, 4-122<br />
date to string, 4-226<br />
dates to years, 4-126<br />
hexadecimal digits to integer, 4-163<br />
integer to string, 4-229<br />
real to string, 4-231<br />
string, 4-234<br />
string to number, 4-188<br />
time to number, 4-237<br />
time to string, 4-226<br />
cos, syntax and use of, 4-111<br />
cosine function, 4-111<br />
create<br />
syntax and use of, 4-112<br />
create a list, 4-41<br />
creating tables with TSL, 6-86<br />
csort, syntax and use of, 4-115<br />
currentclass, syntax and use in KDL, 3-17<br />
currentdate<br />
syntax and use in KDL, 4-116<br />
syntax and use of TSL statement, 6-14<br />
currenttime<br />
syntax and use KDL, 4-117<br />
syntax and use of TSL statement, 6-15<br />
currentvalue, syntax and use in KDL, 4-118<br />
cursor<br />
get position, 4-74<br />
get screen coordinates, 4-73<br />
get word underneath, 4-94<br />
set position, 4-97<br />
custom access method, 1-33<br />
D<br />
data access, 4-128<br />
data types<br />
constraint, 1-8<br />
default substitution formats, 5-40<br />
Index I-5
description of lists and sets, 1-4<br />
file, 1-7<br />
formatted substitution for structured data<br />
types, 5-47<br />
integer_list, 1-5<br />
integer_set, 1-5<br />
KDL syntax summary, 4-247<br />
overview, 1-2<br />
predefined structured data types, 1-5<br />
real_list, 1-5<br />
real_set, 1-5<br />
record, 1-6<br />
record formatting, 5-49<br />
size and precision of records, 1-38, 1-46<br />
string_list, 1-5<br />
string_set, 1-5<br />
structured, 1-4<br />
TSL for elements of lists and sets, 5-43<br />
date<br />
calculate months, 4-121<br />
calculate years, 4-126<br />
conversion from string, 4-119, 4-123<br />
conversion to day of week, 4-124<br />
conversion to integer, 4-119, 4-120, 4-123<br />
conversion to julian date, 4-125<br />
conversion to record, 4-122<br />
conversion to string, 4-226<br />
currentdate statement, 4-116<br />
decode parts, 4-122<br />
default format in TSL, 6-41<br />
display current date, 6-14<br />
formatting in TSL, 5-19<br />
in non-textual file, 1-48<br />
in textual file, 1-40<br />
KDL syntax summary, 4-248, 4-253<br />
masks, 1-21<br />
syntax and use of integer option, 4-120<br />
syntax and use of months option, 4-121<br />
syntax and use of record option, 4-122<br />
I-6 <strong>Language</strong> <strong>Reference</strong><br />
syntax and use of statement, 4-119<br />
syntax and use of string option, 4-123<br />
syntax and use of weekday option, 4-124<br />
syntax and use of yearday option, 4-125<br />
syntax and use of years option, 4-126<br />
TDL statement, 2-5<br />
date default format, 6-41<br />
dBASE data access, file attribute, 1-32, 2-7<br />
DBMS statement<br />
restrictions, 4-128<br />
dbms, syntax and use of, 4-127<br />
decoding variant records, 4-194<br />
default assignments using KDL, 3-39<br />
default formats<br />
date, 6-41<br />
integer, 6-51<br />
real, 6-68<br />
time, 6-96<br />
default property, KDL use, 3-39<br />
default substitution formats in TSL<br />
basic data types, 5-5<br />
structured data types, 5-40<br />
delete<br />
option of CM statement, 4-69<br />
syntax and use of, 4-131, 4-133<br />
windows from screen, 4-69<br />
descending sort, 4-137<br />
difference, syntax and use of, 4-135<br />
dimensions<br />
get for window, 4-75<br />
set for window, 4-98<br />
direct iteration, 4-149<br />
display ampersand in TSL, 6-27<br />
display closing angle bracket in TSL, 6-35<br />
display closing parenthesis in TSL, 6-29<br />
display colon in TSL, 6-33<br />
display current date, 6-14<br />
display current instance, 5-30<br />
display current time, 6-15
display empty list, set, or class, 6-44<br />
display instances from multiple classes, 5-38<br />
display name of an instance, 6-22<br />
display numbers in hexadecimal and binary, 5-13<br />
display open angle bracket in TSL, 6-34<br />
display open parenthesis in TSL, 6-28<br />
display percent sign in TSL, 6-26<br />
display period in TSL, 6-31<br />
display plain text, 5-4<br />
div, syntax and use of, 4-136<br />
division operator, 4-21<br />
division, integer, 4-136, 4-184<br />
DL/I data access, file attribute, 1-32, 2-7<br />
do while loop. see loop<br />
dsort, syntax and use of, 4-137<br />
duration of TSL commands, 6-7, 6-8<br />
dynamic screen management. see CM<br />
E<br />
else clause, 4-165<br />
elseif clause, 4-166<br />
empty list, set, or class, TSL substitution, 6-44<br />
empty table, TSL substitution, 6-45<br />
encoding variant records, 4-243<br />
end keyword, 4-167<br />
entry conditions, effects of processing options,<br />
3-34<br />
error<br />
option of aes statement, 4-30<br />
option of CM statement, 4-71<br />
ESDS data access, file attribute, 2-7<br />
evaluation of premises, 3-21<br />
execution conditions, effects of processing options,<br />
3-34<br />
execution of internal ADS functions, 4-25<br />
exists<br />
clause of ifmatch, 4-168<br />
syntax and use of, 4-140<br />
exitcode, option of aes statement, 4-31<br />
exitstate, syntax and use of, 4-142<br />
exp, syntax and use of, 4-144<br />
explicit iteration, 4-151<br />
exponent of log e, 4-144<br />
exponentiation operator, 4-18<br />
expressions<br />
boolean, 3-3<br />
list, 3-5<br />
numeric, 3-4<br />
overview, 3-2<br />
pointer, 3-6<br />
record, 3-6<br />
set, 3-5<br />
string, 3-4<br />
usage, 3-3<br />
F<br />
facts<br />
effect of processing options, 3-34<br />
KDL in property, 3-39<br />
field and record sizes, for textual files, 1-38<br />
field, see Record, 5-51<br />
file. see also non-textual file structures. see also<br />
textual file structures<br />
access method, 1-32<br />
data type, 1-7<br />
noattr attribute, 1-36, 1-54<br />
output attribute, 2-7<br />
TDL attributes, 1-31<br />
TDL statement, 2-7<br />
textual attribute, 1-34<br />
variable attribute, 1-35<br />
fill mode, 6-47<br />
finalvalue, syntax and use of KDL statement,<br />
4-145<br />
Index I-7
first, syntax and use of, 4-146<br />
fixed attribute, 1-51<br />
flow control, 3-22<br />
flush, dbms option, 4-127<br />
footer, TSL specification, 6-49<br />
for statement. see also loop<br />
class iteration, 4-147<br />
direct iteration, 4-149<br />
explicit iteration, 4-151<br />
implicit iteration, 4-153<br />
syntax and use of, 4-147, 4-149, 4-151,<br />
4-153<br />
forcing line breaks, 6-39<br />
formatted substitution<br />
%is, 6-20<br />
associating text with booleans, 5-27<br />
associating text with parameters and slots, 5-7<br />
certainty sets, 10-26<br />
lists and sets, 5-43<br />
lists and sets of structured data types, 5-47<br />
operator, 6-20<br />
records, 5-49<br />
formatting. see also TSL<br />
forwardchain, syntax and use of, 4-155<br />
function<br />
ADS-defined, 4-107<br />
in TSL, 5-52<br />
return statement, 4-200<br />
sourcing options, 3-36<br />
syntax and use of agenda statement, 4-157<br />
TSL syntax summary, 5-70<br />
using agenda statements in, 3-36<br />
G<br />
get cursor position, 4-74<br />
get dimensions, 4-75<br />
get outline color, 4-79<br />
I-8 <strong>Language</strong> <strong>Reference</strong><br />
get screen coordinates, 4-73<br />
get status for answer window, 4-82<br />
get text color, 4-85<br />
get text from window, 4-84<br />
get title color, 4-87<br />
get window handle, 4-90<br />
get window information, 4-76<br />
get window list, 4-93<br />
get window position, 4-81<br />
get window title position, 4-89<br />
get word underneath cursor, 4-94<br />
getcoordinates, option of CM statement, 4-73<br />
getcursor, option of CM statement, 4-74<br />
getdimensions, option of CM statement, 4-75<br />
getinfo, option of CM statement, 4-76<br />
GetObjectInfo, CM<br />
syntax, 4-78<br />
getoutlinecolor, option of CM statement, 4-79<br />
getposition, option of CM statement, 4-81<br />
getstatus, option of CM statement, 4-82<br />
gettext, option of CM statement, 4-84<br />
gettextcolor, option of CM statement, 4-85<br />
gettitlecolor, option of CM statement, 4-87<br />
gettitleposition, option of CM statement, 4-89<br />
getwindow, option of CM statement, 4-90<br />
getwindowlist, option of CM statement, 4-93<br />
getword, option of CM statement, 4-94<br />
goals, specifying agenda statements, 3-28<br />
graph, syntax and use of agenda statement, 4-159<br />
group, syntax and use of agenda statement, 4-161<br />
H<br />
hex, syntax and use of, 4-163<br />
hexadecimal<br />
conversion, 4-163<br />
display using TSL, 5-13
I<br />
I parameter, 4-153<br />
I/O<br />
textual file structure example, 1-44<br />
variant record manipulation, 4-194, 4-243<br />
I/O statements<br />
byname, 4-54<br />
dbms, 4-127<br />
if statement<br />
nested, 4-167<br />
syntax and use of, 4-164<br />
ifmatch, syntax and use of, 4-168<br />
implicit iteration, 4-153<br />
include, TSL statement, 6-54<br />
includes. see also unknown<br />
syntax and use of, 4-174<br />
indent<br />
temporary left margin, 6-58<br />
temporary right margin, 6-73<br />
independent state, sourcing options, 3-36<br />
index, syntax and use of, 4-175<br />
inference rules, 3-23<br />
input attributes. see user-input attributes<br />
input masks. see also masks<br />
date, 1-21<br />
integer, 1-23<br />
real, 1-24<br />
string, 1-25<br />
time, 1-26<br />
instance<br />
creating dynamic instances, 4-112<br />
deleting, 4-133<br />
determine existence of, 4-140<br />
displaying with TSL, 5-29, 5-30<br />
dynamic, 4-112<br />
in TSL, 5-38, 6-22<br />
nameof, syntax and use of, 4-185<br />
references to, 3-17<br />
select all, 4-204<br />
select one, 4-205<br />
TDL statement, 2-13<br />
TSL syntax summary, 5-65, 5-67<br />
integer<br />
conversion to string, 4-229<br />
default format in TSL, 6-51<br />
division, 4-136, 4-184<br />
formatting in TSL, 5-11<br />
in non-textual file, 1-48<br />
in textual file, 1-40<br />
KDL syntax summary, 4-248, 4-249<br />
masks, 1-23<br />
option of date statement, 4-120<br />
predefined list, 1-5<br />
predefined set, 1-5<br />
TDL statement, 2-10<br />
integer_list data type, 1-5<br />
integer_set data type, 1-5<br />
internal <strong>AionDS</strong> functions, invocation, 4-25<br />
intersection<br />
of certainty sets, 10-23<br />
syntax and use of KDL statement, 4-176<br />
introducing certainty, 10-2<br />
iteration<br />
class, 4-147<br />
direct, 4-149<br />
explicit, 4-151<br />
implicit, 4-153<br />
J<br />
justify mode, 6-56<br />
K<br />
KDL. see also KDL statements<br />
Index I-9
AES statements, 4-14<br />
agenda statements, 4-12<br />
assignment operators, 3-42<br />
certainty set operations, 4-11<br />
class references, 3-16<br />
CM statements, 4-60<br />
comments, 4-22<br />
comparing real numbers, 3-10<br />
compound actions, 4-165<br />
constraints, 3-40<br />
consultation monitor statements, 4-13<br />
control statements, 4-11<br />
date operations, 4-10<br />
default property use, 3-39<br />
else clause, 4-165<br />
elseif keyword, 4-166<br />
end keyword, 4-167<br />
expressions. see expressions<br />
facts property use, 3-39<br />
instance references, 3-17<br />
list operations, 4-10<br />
logical operators, 4-10<br />
multiple premises, 4-166<br />
nested if statements, 4-167<br />
numeric operations and functions, 4-9<br />
object processing statements, 4-12<br />
operators. see operators<br />
other statements, 4-14<br />
premise evaluation, 3-21<br />
set operations, 4-10<br />
slot references, 3-19<br />
statement syntax, 4-9<br />
string operations, 4-10<br />
syntax summary by data type, 4-247<br />
time operations, 4-10<br />
KDL statements. see also I/O statements. see also<br />
KDL<br />
&, 4-16<br />
*, 4-17<br />
I-10 <strong>Language</strong> <strong>Reference</strong><br />
**, 4-18<br />
*/, 4-22<br />
+, 4-19<br />
/, 4-21<br />
/*, 4-22<br />
abs, 4-23<br />
add, 4-24<br />
aes, 4-25<br />
aes abort, 4-26<br />
aes break, 4-27<br />
aes chain, 4-28<br />
aes error, 4-30<br />
aes exitcode, 4-31<br />
aes profile, 4-32<br />
aes title, 4-33<br />
aes tracelevel, 4-34<br />
aes writelog, 4-36<br />
aes writetrace, 4-37<br />
aes_cf, 4-38<br />
and, 4-39<br />
append, 4-41<br />
arctan, 4-42<br />
ask, 4-43<br />
asort, 4-47<br />
bestvalue, 4-50<br />
bin, 4-51<br />
break, 4-52<br />
breakif, 4-53<br />
byname, 4-54<br />
certainty, 4-56<br />
cf, 4-57<br />
clear, 4-58<br />
cm, 4-60<br />
cm add, 4-65<br />
cm beep, 4-68<br />
cm delete, 4-69<br />
cm error, 4-71<br />
cm getcoordinates, 4-73<br />
cm getcursor, 4-74
cm getdimensions, 4-75<br />
cm getinfo, 4-76<br />
cm getoutlinecolor, 4-79<br />
cm getpopup, 4-95<br />
cm getposition, 4-81<br />
cm getstatus, 4-82<br />
cm gettext, 4-84<br />
cm gettextcolor, 4-85<br />
cm gettitlecolor, 4-87<br />
cm gettitleposition, 4-89<br />
cm getwindow, 4-90<br />
cm getwindowlist, 4-93<br />
cm getword, 4-94<br />
cm setcursor, 4-97<br />
cm setdimensions, 4-98<br />
cm setoutlinecolor, 4-99<br />
cm setposition, 4-101<br />
cm settextcolor, 4-102<br />
cm settitlecolor, 4-104<br />
cm settitleposition, 4-106<br />
cm system, 4-107<br />
cos, 4-111<br />
create, 4-112<br />
csort, 4-115<br />
currentclass, 3-17<br />
currentdate, 4-116<br />
currenttime, 4-117<br />
currentvalue, 4-118<br />
date, 4-119<br />
date integer, 4-120<br />
date months, 4-121<br />
date record, 4-122<br />
date string, 4-123<br />
date weekday, 4-124<br />
date yearday, 4-125<br />
date years, 4-126<br />
dbms, 4-127<br />
delete from list or set, 4-131<br />
delete instance, 4-133<br />
difference, 4-135<br />
div, 4-136<br />
dsort, 4-137<br />
exists, 4-140<br />
exitstate, 4-142<br />
exp, 4-144<br />
finalvalue, 4-145<br />
first, 4-146<br />
for, class iteration, 4-147<br />
for, direct iteration, 4-149<br />
for, explicit iteration, 4-151<br />
for, implicit iteration, 4-153<br />
forwardchain, 4-155<br />
function, 4-157<br />
graph, 4-159<br />
group, 4-161<br />
hex, 4-163<br />
if, 4-164<br />
ifmatch, 4-168<br />
includes, 4-174<br />
index, 4-175<br />
intersection, 4-176<br />
last, 4-177<br />
length, 4-178<br />
ln, 4-179<br />
loop, 4-180<br />
max, 4-181<br />
message, 4-182<br />
min, 4-183<br />
mod, 4-184<br />
nameof, 4-185<br />
not, 4-187<br />
num, 4-188<br />
or, 4-189<br />
parameter, 4-191<br />
process, 4-193<br />
readstr, 4-194<br />
report, 4-199<br />
return, 4-200<br />
Index I-11
ound, 4-202<br />
rule, 4-203<br />
selectall, 4-204<br />
selectone, 4-205<br />
send to class, 4-207<br />
send to instance, 4-209<br />
send up, 4-212<br />
set, 4-214<br />
sin, 4-215<br />
size, 4-216<br />
slot, 4-217<br />
sourcevalue, 4-219<br />
sqr, 4-220<br />
sqrt, 4-221<br />
state, 4-222<br />
str from booleans, 4-224<br />
str from dates and times, 4-226<br />
str from integers, 4-229<br />
str from real numbers, 4-231<br />
str with strings, 4-234<br />
substring, 4-236<br />
time, 4-237<br />
trunc, 4-238<br />
union, 4-239<br />
unknown, 4-240<br />
with, 4-242<br />
writestr, 4-243<br />
knowledge base objects, changing the property,<br />
4-214<br />
KSDS data access, file attribute, 2-7<br />
L<br />
last, syntax and use of KDL statement, 4-177<br />
leastrecent, option of forwardchain, 4-155<br />
left indent, in TSL, 6-58<br />
left margin, text in TSL, 6-63<br />
length, syntax and use of, 4-178<br />
I-12 <strong>Language</strong> <strong>Reference</strong><br />
limitations<br />
DBMS statement, 4-128<br />
line breaks in TSL, 6-39<br />
line numbers, displaying in TSL, 6-61<br />
line skipping with TSL, 6-81<br />
list<br />
append, 4-41<br />
default format in TSL, 5-41<br />
deleting elements from, 4-131<br />
description of, 1-4<br />
determine existence of element, 4-174<br />
expressions, 3-5<br />
find matching element, 4-175<br />
formatting individual elements in TSL, 5-43<br />
formatting structured data types in TSL, 5-47<br />
in non-textual file, 1-49<br />
in textual file, 1-41<br />
in TSL, 5-40<br />
indexing using a record field, 5-51<br />
KDL syntax summary, 4-254<br />
of pointers in TSL, 5-36<br />
select elements from, 4-146, 4-177<br />
side-by-side display, 6-17<br />
size, 4-216<br />
TDL statement, 2-14<br />
TSL syntax summary, 5-68<br />
writing length to a file, 1-49<br />
ln, syntax and use of, 4-179<br />
load, option of dbms statement, 4-127<br />
local access<br />
definition, 4-128<br />
log<br />
base e, 4-179<br />
e exponent, 4-144<br />
logical operators<br />
and, 4-39<br />
in KDL, 3-13<br />
KDL, 4-10<br />
not, 4-187
or, 4-189<br />
loop. see also for statement<br />
break statement, 4-52<br />
breakif statement, 4-53<br />
direct iteration, 4-149<br />
do while, 4-180<br />
explicit iteration, 4-151<br />
implicit iteration, 4-153<br />
repeat until, 4-180<br />
statement description, 4-180<br />
syntax and use of KDL statement, 4-180<br />
M<br />
margin<br />
setting bottom margins, 6-37<br />
setting the right margin, 6-74<br />
setting top margins, 6-101<br />
temporary left, 6-58<br />
temporary right, 6-73<br />
text in TSL, 6-63, 6-75<br />
marking blocks of text, 6-36<br />
masks<br />
date, 1-21, 6-41<br />
for input, 1-19<br />
integer, 1-23, 6-51<br />
overview, 1-19<br />
real, 1-24, 6-70<br />
string, 1-25<br />
time, 1-26, 6-96<br />
max, syntax and use of, 4-181<br />
maximum value of numeric expressions, 4-181<br />
message<br />
substitution in TSL, 6-65<br />
syntax and use of agenda statement, 4-182<br />
message passing<br />
overview, 3-26<br />
send to class, 4-207<br />
send to instance, 4-209<br />
send up, 4-212<br />
using arguments and return values, 4-210<br />
with TSL, 5-55, 6-77<br />
method<br />
sending up in TSL, 6-24<br />
specialization, 4-213<br />
min, syntax and use of, 4-183<br />
minimum value of numeric expressions, 4-183<br />
mod, syntax and use of, 4-184<br />
modulus, 4-184<br />
months, option of date statement, 4-121<br />
mostrecent, option of forwardchain, 4-155<br />
multiple certainty set. see certainty set<br />
multiple premises, 4-166<br />
multiplication operator, 4-17<br />
N<br />
nameof<br />
in TSL, 6-22<br />
syntax and use of, 4-185<br />
Nested if statements, 4-167<br />
nested records, 1-7<br />
noattr attribute<br />
for non-textual files, 1-54<br />
use in TDL, 1-36<br />
noempty attribute, 1-13<br />
nomenu attribute, 1-14<br />
non-textual file attribute, 1-34<br />
non-textual file structures. see also textual file<br />
structures<br />
boolean, 1-48<br />
date, 1-48<br />
description of, 1-45<br />
fixed attribute, 1-51<br />
integer, 1-48<br />
list, 1-49<br />
Index I-13
numeric attributes, 1-51<br />
packed attribute, 1-52<br />
real, 1-49<br />
set, 1-49<br />
string, 1-49<br />
textual attribute, 1-52<br />
time, 1-50<br />
unsigned attribute, 1-52<br />
zoned attribute, 1-53<br />
not, syntax and use of, 4-187<br />
notrim attribute, 1-15, 1-50, 4-195, 4-244<br />
nounknown attribute, 1-16<br />
num, syntax and use of KDL statement, 4-188<br />
numbering lines, TSL display, 6-61<br />
numbering pages with TSL, 6-10, 6-66<br />
numeric constraint syntax in TDL, 2-36<br />
numeric expressions, 3-4<br />
numeric field attributes, 1-51<br />
O<br />
object processing<br />
class references, 3-16<br />
creating dynamic instances, 4-112<br />
current class, 3-17<br />
displaying classes, 5-31<br />
displaying instances from multiple classes,<br />
5-38<br />
displaying the current instance, 5-30<br />
displaying the name of an instance, 6-22<br />
inference rules, 3-23<br />
instance references, 3-17<br />
KDL syntax summary, 4-260<br />
message passing, 3-26<br />
send to class, 4-207<br />
send to instance, 4-209<br />
send up, 4-212<br />
sending messages with TSL, 5-55, 6-77<br />
I-14 <strong>Language</strong> <strong>Reference</strong><br />
slot references, 3-19<br />
substitution of instances, 5-29<br />
using TSL, 5-29<br />
object_pointer<br />
comparing values, 2-18<br />
modifying values, 2-18<br />
syntax, 2-17<br />
open angle bracket display in TSL, 6-34<br />
open parenthesis display in TSL, 6-28<br />
operators. see also reference<br />
arithmetic, 3-12<br />
assignment, 3-42<br />
logical, 3-13<br />
relational, 3-7<br />
selection, 3-14<br />
or, syntax and use of, 4-189<br />
order of premise evaluation, 3-21<br />
orderby<br />
clause in pattern-matching rules, 4-168<br />
clause of forwardchain, 4-155<br />
output argument<br />
attribute, 1-30<br />
output masks. see masks<br />
P<br />
packed attribute, 1-52<br />
page numbers in TSL, 6-10, 6-66<br />
parameter. see also TSL<br />
constraint specification, 3-40<br />
I, 4-153<br />
syntax and use of agenda statement, 4-191<br />
TSL syntax summary, 5-63<br />
using finalvalue, 4-145<br />
pattern-matching rules, overview, 3-23<br />
PC data access, access overview, 1-33<br />
percent sign display in TSL, 6-26<br />
percent substitution operator, 6-9
period, displaying in TSL, 6-31<br />
plain text, displaying in TSL, 5-4<br />
pointer<br />
displaying unknown in TSL, 6-105<br />
displaying values with TSL, 5-34, 5-35<br />
expressions, 3-6<br />
select all, 4-204<br />
select one, 4-205<br />
TDL statement, 2-20<br />
TSL syntax summary, 5-66<br />
unknown pointers in TSL, 5-39<br />
popup<br />
option of CM statement, 4-95<br />
window, 4-95<br />
position of substring in string, 4-175<br />
precedence<br />
of arithmetic operators, 3-21<br />
of logical operators, 3-21<br />
precision of record fields, 1-38, 1-46<br />
predefined structured data types, 1-5<br />
premise<br />
description of, 3-7<br />
evaluation summary, 3-21<br />
multiple, 4-166<br />
nested if statements, 4-167<br />
unknown, 4-240<br />
using certainty, 10-11<br />
preserving certainty, 10-16<br />
priority<br />
option of forwardchain, 4-155<br />
setting the priority, 4-214<br />
process, syntax and use of agenda statement,<br />
4-193<br />
processing option<br />
combining with sourcing options, 3-34<br />
effect on execution conditions, 3-34<br />
overview, 3-32<br />
profile monitor<br />
change option at runtime, 4-32<br />
comparison-tolerance, 3-10<br />
profile, option of aes statement, 4-32<br />
programming constructs, 3-22<br />
properties, changing at run time, 4-214<br />
Q<br />
QSAM data access, file attribute, 1-32, 2-7<br />
R<br />
readstr, syntax and use of, 4-194<br />
real<br />
comparisons between numbers, 3-10<br />
conversion to string, 4-231<br />
formatting values in TSL, 5-15<br />
in non-textual file, 1-49<br />
in textual file, 1-41<br />
KDL syntax summary, 4-248, 4-249<br />
masks, 1-24<br />
predefined list, 1-5<br />
predefined set, 1-5<br />
rounding, 4-202<br />
TDL statement, 2-21<br />
truncation, 4-238<br />
TSL default format, 6-68<br />
real_list data type, 1-5<br />
real_set data type, 1-5<br />
record<br />
definition of, 1-6<br />
expressions, 3-6<br />
field size and precision, 1-38, 1-46<br />
formatting structured data types in TSL, 5-47<br />
formatting with TSL, 5-49<br />
nesting, 1-7<br />
option of date statement, 4-122<br />
TDL statement, 2-25<br />
Index I-15
TSL syntax summary, 5-69<br />
type object, 1-6<br />
using a field as an index in TSL, 5-51<br />
writing the string length, 1-50<br />
writing the string, list, or set length, 1-49<br />
reference<br />
class, 3-16<br />
instance, 3-17<br />
slot, 3-19<br />
relational operators<br />
and unknown values, 3-9<br />
description of, 3-7<br />
remainder of integer division, 4-184<br />
remote access<br />
definition, 4-128<br />
repeat until loop. see loop<br />
report<br />
syntax and use of agenda statement, 4-199<br />
title, 6-99<br />
reserved words, 11-1<br />
restrictions<br />
DBMS statement, 4-128<br />
return value, in message passing, 4-210<br />
return, syntax and use of, 4-200<br />
right indent, in TSL, 6-73<br />
right margin. see also margin<br />
text in TSL, 6-75<br />
rollbacks<br />
dbms option, 4-127<br />
remote access, with, 4-128<br />
unit of work, 4-128<br />
round, syntax and use of, 4-202<br />
RRDS data access, file attribute, 2-7<br />
rule. see also operators. see also expressions<br />
comparing real numbers, 3-10<br />
compound action, 4-165<br />
else clause, 4-165<br />
elseif keyword, 4-166<br />
end keyword, 4-167<br />
I-16 <strong>Language</strong> <strong>Reference</strong><br />
S<br />
if statement syntax, 4-164<br />
inference, 3-23<br />
multiple premises, 4-166<br />
nested if statements, 4-167<br />
premise evaluation, 3-21<br />
return statement, 4-200<br />
syntax and use of agenda statement, 4-203<br />
using agenda statements in, 3-36<br />
using the forwardchain statement, 4-155<br />
using the ifmatch statement, 4-168<br />
select first elements from list, 4-146<br />
select last elements from list, 4-177<br />
selectall, syntax and use of, 4-204<br />
selection operators, 3-14<br />
selectone, syntax and use of, 4-205<br />
send<br />
statement in TSL, 5-55, 6-77<br />
syntax and use of KDL statement, 4-207,<br />
4-209<br />
TSL syntax summary, 5-71<br />
up in TSL, 6-24<br />
up, syntax and use of KDL statement, 4-212<br />
sending messages<br />
in TSL, 5-55, 6-77<br />
with arguments or return values, 4-210<br />
set. see also certainty set<br />
default format in TSL, 5-41<br />
deleting elements from, 4-131<br />
description of, 1-4<br />
determine existence of element, 4-174<br />
difference, 4-135<br />
expressions, 3-5<br />
find matching element, 4-175<br />
formatting individual elements in TSL, 5-43<br />
formatting structured data types in TSL, 5-47
in non-textual file, 1-49<br />
in textual file, 1-41<br />
in TSL, 5-40<br />
indexing using a record field, 5-51<br />
intersection, 4-176<br />
KDL syntax summary, 4-255<br />
of pointers in TSL, 5-36<br />
side-by-side display, 6-17<br />
size, 4-216<br />
TDL statement, 2-27<br />
TSL syntax summary, 5-68<br />
union, 4-239<br />
writing length to a file, 1-49<br />
set cursor position, 4-97<br />
set dimensions, 4-98<br />
set outline color, 4-99<br />
set report title, 6-99<br />
set text color, 4-102<br />
set title color, 4-104<br />
set window position, 4-101<br />
set window title position, 4-106<br />
set, syntax and use of command, 4-214<br />
setcursor, option of CM statement, 4-97<br />
setdimensions, option of CM statement, 4-98<br />
setoutlinecolor, option of CM statement, 4-99<br />
setposition, option of CM statement, 4-101<br />
settextcolor, option of CM statement, 4-102<br />
setting margins in TSL, 6-37, 6-74, 6-101<br />
setting spaces in TSL, 6-82, 6-83<br />
settitlecolor, option of CM statement, 4-104<br />
settitleposition, option of CM statement, 4-106<br />
side-by-side display of list or set elements, 6-17<br />
sin, syntax and use of, 4-215<br />
sine function, 4-215<br />
single certainty set. see certainty set<br />
size<br />
of certainty sets, 10-24<br />
syntax and use of KDL statement, 4-216<br />
size and precision of fields, 1-38, 1-46<br />
skipping lines with TSL, 6-81<br />
slot<br />
constraint specification, 3-40<br />
displaying in TSL, 5-30<br />
references to, 3-19<br />
syntax and use of agenda statement, 4-217<br />
TSL syntax summary, 5-64<br />
values in TSL, 5-29<br />
sort<br />
ascending, 4-47<br />
certainty set, 4-115, 10-22<br />
descending, 4-137<br />
sourcevalue, syntax and use of, 4-219<br />
sourcing<br />
agenda statement options, 3-30<br />
and functions, 3-36<br />
and independent states, 3-36<br />
best value, 4-50<br />
combining with processing options, 3-34<br />
current value, 4-118<br />
final value, 4-145<br />
sourcevalue, 4-219<br />
spaces in TSL, 6-82, 6-83<br />
specialization of methods, 4-213<br />
SQL data access, file attribute, 1-32, 2-7<br />
sqr, syntax and use of, 4-220<br />
sqrt, syntax and use of, 4-221<br />
square of a number, 4-220<br />
square root, 4-221<br />
state<br />
exit state, 4-142<br />
syntax and use of agenda statement, 4-222<br />
using exitstate, 4-142<br />
stopwhen, clause of forwardchain, 4-155<br />
str, syntax and use of<br />
booleans, 4-224<br />
dates, 4-226<br />
integers, 4-229<br />
real numbers, 4-231<br />
Index I-17
strings, 4-234<br />
times, 4-226<br />
strength of belief. see certainty<br />
string. see also substring<br />
conversion between strings, 4-234<br />
conversion from boolean, 4-224<br />
conversion from date, 4-226<br />
conversion from integer, 4-229<br />
conversion from real, 4-231<br />
conversion from time, 4-226<br />
convert to number, 4-188<br />
expressions, 3-4<br />
find substring, 4-175<br />
in non-textual file, 1-49<br />
in textual file, 1-42<br />
KDL syntax summary, 4-248, 4-251<br />
length, 4-178<br />
masks, 1-25<br />
option of date statement, 4-123<br />
predefined list, 1-5<br />
predefined set, 1-5<br />
return substring, 4-236<br />
syntax and use of constraints in TDL, 2-37<br />
TDL statement, 2-30<br />
TSL formatting, 5-9<br />
writing length to a file, 1-50<br />
string_list data type, 1-5<br />
string_set data type, 1-5<br />
structured data types. see also data types<br />
description of, 1-4<br />
file, 1-7<br />
lists and sets, 1-4<br />
predefined, 1-5<br />
record, 1-6<br />
substitution<br />
of booleans, 5-27<br />
of classes, 5-31<br />
of instances, 5-29<br />
of messages, 6-65<br />
I-18 <strong>Language</strong> <strong>Reference</strong><br />
of parameters and slots, 5-5, 5-7<br />
operator in TSL, 6-9, 6-20<br />
substring<br />
matching, 4-175<br />
syntax and use of, 4-236<br />
subtraction operator, 4-20<br />
summary of premise evaluation, 3-21<br />
summary of TSL commands, 6-106<br />
summary of TSL substitution, 5-62<br />
syntax<br />
KDL, 4-9<br />
KDL syntax summary, 4-247<br />
TDL, 2-2<br />
TSL command summary, 6-106<br />
TSL substitution summary, 5-62<br />
system threshold. see certainty<br />
system, option of CM statement, 4-107<br />
T<br />
table<br />
displaying certainty sets, 10-31<br />
mode in TSL, 6-86, 6-88<br />
tabs in TSL, 6-84, 6-85<br />
TDL<br />
boolean, syntax and use of, 2-3<br />
checklength attribute, 1-12<br />
constraint data types, 1-8<br />
constraints, syntax and use of, 2-35<br />
data types, 1-2<br />
date input masks, 1-21<br />
date, syntax and use of, 2-5<br />
file attributes, 1-31<br />
file, syntax and use of, 2-7<br />
files, 1-7<br />
fixed attribute, 1-51<br />
input masks, 1-19<br />
instance, syntax and use of, 2-13
integer input masks, 1-23<br />
integer, syntax and use of, 2-10<br />
list, syntax and use of, 2-14<br />
lists and sets, 1-4<br />
noattr attribute, 1-36, 1-54<br />
noempty attribute, 1-13<br />
nomenu attribute, 1-14<br />
notrim attribute, 1-15, 1-50, 4-195, 4-244<br />
nounknown attribute, 1-16<br />
numeric constraint syntax, 2-36<br />
numeric field attributes, 1-51<br />
overview, 2-1<br />
packed attribute, 1-52<br />
pointer, syntax and use of, 2-20<br />
predefined lists and sets, 1-5<br />
real input masks, 1-24<br />
real, syntax and use of, 2-21<br />
record, syntax and use of, 2-25<br />
records, 1-6<br />
set, syntax and use of, 2-27<br />
string constraint syntax, 2-37<br />
string input masks, 1-25<br />
string, syntax and use of, 2-30<br />
structured data types, 1-4<br />
syntax, 2-2<br />
text attribute, 1-17<br />
textual attribute, 1-34, 1-52<br />
time input masks, 1-26<br />
time, syntax and use of, 2-33<br />
unsigned attribute, 1-52<br />
uppercase attribute, 1-18<br />
user-input attribute examples, 1-28<br />
user-input attributes, 1-10<br />
variable attribute, 1-35<br />
writelength attribute, 1-49<br />
writelength I/O attribute, 1-50<br />
zoned attribute, 1-53<br />
text<br />
associating text in TSL, 5-7<br />
displaying in TSL, 5-4<br />
text attribute, 1-17<br />
Text Substitution <strong>Language</strong>. see TSL<br />
textual attribute, 1-34, 1-52<br />
textual file structures. see also non-textual file<br />
structures<br />
boolean, 1-39<br />
date, 1-40<br />
description of, 1-37<br />
example, 1-44<br />
field and record sizes, 1-38<br />
integer, 1-40<br />
list, 1-41<br />
real, 1-41<br />
set, 1-41<br />
string, 1-42<br />
time, 1-42<br />
time<br />
conversion to string, 4-226<br />
currenttime statement, 4-117<br />
default format in TSL, 6-96<br />
display current time, 6-15<br />
in non-textual file, 1-50<br />
in textual file, 1-42<br />
KDL syntax summary, 4-248, 4-253<br />
masks, 1-26<br />
syntax and use of KDL statement, 4-237<br />
TDL statement, 2-33<br />
values in TSL, 5-23<br />
title<br />
in TSL, 6-99<br />
option of aes statement, 4-33<br />
top margin. see margin<br />
tracelevel, option of aes statement, 4-34<br />
trunc, syntax and use of, 4-238<br />
truncate number, 4-238<br />
TSL<br />
%, syntax and use of, 6-9<br />
%aes_pagenum, syntax and use of, 6-10<br />
Index I-19
%currentdate, syntax and use of, 6-14<br />
%currenttime, syntax and use of, 6-15<br />
%emptbl, syntax and use of, 6-45<br />
%is, 6-20<br />
%nameof, 6-22<br />
%up, syntax and use of, 6-24<br />
&%, syntax and use of, 6-26<br />
&&, syntax and use of, 6-27<br />
&(, syntax and use of, 6-28<br />
&), syntax and use of, 6-29<br />
&*/, syntax and use of, 6-30<br />
&., syntax and use of, 6-31<br />
&/*, syntax and use of, 6-32<br />
&:, syntax and use of, 6-33<br />
&, syntax and use of, 6-35<br />
&blk, syntax and use of, 6-36<br />
&bm, syntax and use of, 6-37<br />
&br, syntax and use of, 6-39<br />
&c, syntax and use of, 6-40<br />
&ddf, syntax and use of, 6-41<br />
&emp, syntax and use of, 6-44<br />
&fi, syntax and use of, 6-47<br />
&footer, syntax and use of, 6-49<br />
&idf, syntax and use of, 6-51<br />
&include, syntax and use of, 6-54<br />
&j, syntax and use of, 6-56<br />
&li, syntax and use of, 6-58<br />
&ln, syntax and use of, 6-61<br />
<, syntax and use of, 6-63<br />
&msg, syntax and use of, 6-65<br />
&n, syntax and use of, 6-66<br />
&rdf, syntax and use of, 6-68<br />
&ri, syntax and use of, 6-73<br />
&rm, syntax and use of, 6-74<br />
&rt, syntax and use of, 6-75<br />
&scf, syntax and use of, 10-26<br />
&scs, syntax and use of, 10-27<br />
&send, syntax and use of, 6-77<br />
I-20 <strong>Language</strong> <strong>Reference</strong><br />
&sk, syntax and use of, 6-81<br />
&spc, syntax and use of, 6-82<br />
&sspc, syntax and use of, 6-83<br />
&stab, syntax and use of, 6-84<br />
&tab, syntax and use of, 6-85<br />
&tb, syntax and use of, 6-86<br />
&tbl, syntax and use of, 6-88<br />
&tdf, syntax and use of, 6-96<br />
&title, syntax and use of, 6-99<br />
&tm, syntax and use of, 6-101<br />
&und, syntax and use of, 6-103<br />
&undptr, syntax and use of, 6-105<br />
aes_tslmessage, 5-60<br />
aes_tslprompt, 5-60<br />
aes_tslreport, 5-60<br />
aes_tsltext, 5-60<br />
ampersand, 6-27<br />
associating text with booleans, 5-27, 10-30<br />
associating text with parameters and slots, 5-7<br />
begin comment, 6-32<br />
canceling the effect of new lines and spaces,<br />
6-86<br />
centering lines, 6-40<br />
certainty set, 10-29<br />
changing modes, 6-47, 6-56<br />
changing the display of unknown, 6-44,<br />
6-103, 6-105<br />
close comment, 6-30<br />
closing angle bracket, 6-35<br />
closing parenthesis, 6-29<br />
command summary, 6-106<br />
commands, 6-5<br />
comments, 6-30, 6-32<br />
creating tables, 6-86<br />
default format for lists and sets, 5-41<br />
default substitution and formatting, 5-5<br />
defaults, 6-7<br />
displaying classes, 5-31
displaying instances from multiple classes,<br />
5-38<br />
displaying the current instance, 5-30<br />
displaying the name of an instance, 6-22<br />
displaying unknown pointers, 5-39<br />
duration of defaults, modes, or margins, 6-7,<br />
6-8<br />
empty table substitution, 6-45<br />
fill mode, 6-47<br />
footer, 6-49<br />
forcing line breaks, 6-39<br />
formatted substitution of structured data<br />
types, 5-47<br />
formatting binary numbers, 5-13<br />
formatting boolean values, 5-26<br />
formatting certainty sets, 10-25, 10-26, 10-28<br />
formatting date values, 5-19<br />
formatting hexadecimal numbers, 5-13<br />
formatting individual slot values, 5-30<br />
formatting integer values, 5-11<br />
formatting lists and sets, 5-40<br />
formatting lists or sets of pointers, 5-36<br />
formatting plain text, 5-4<br />
formatting pointer values, 5-34<br />
formatting real values, 5-15<br />
formatting records, 5-49<br />
formatting slot values, 5-29<br />
formatting slot values from pointers, 5-35<br />
formatting string values, 5-9<br />
formatting time values, 5-23<br />
functions in TSL, 5-52<br />
indexing using a record field, 5-51<br />
individual elements of lists and sets, 5-43<br />
inserting text from a file, 6-54<br />
justify mode, 6-56<br />
left margin text, 6-63<br />
margins, 6-74<br />
message substitution, 6-65<br />
nameof statement, 6-22<br />
open angle bracket, 6-34<br />
open parenthesis, 6-28<br />
overview, 5-1<br />
page numbers, 6-66<br />
percent sign, 6-26<br />
right margin text, 6-75<br />
sending messages to objects, 5-55, 6-77<br />
setting bottom margins, 6-37<br />
setting spaces in fill justify and table modes,<br />
6-82, 6-83<br />
setting top and bottom margins, 6-101<br />
side-by-side display of list or set elements,<br />
6-17<br />
skipping lines, 6-81<br />
substitution of instances, 5-29<br />
substitution operator, 6-20<br />
substitution summary, 5-62<br />
table mode, 6-86, 6-88<br />
tabs, 6-84, 6-85<br />
uniform defaults and headers, 5-60<br />
with object processing, 5-29<br />
type<br />
constraints in object, 1-8<br />
record, 1-6<br />
type definition language. see TDL<br />
U<br />
union<br />
of certainty sets, 10-23<br />
syntax and use of, 4-239<br />
unit of work, 4-128<br />
unknown<br />
display in TSL, 6-44, 6-103, 6-105<br />
display of pointers in TSL, 5-39<br />
in certainty set comparison, 10-21<br />
relational comparison, 3-9<br />
syntax and use of KDL statement, 4-240<br />
Index I-21
unsigned attribute, 1-52<br />
uppercase attribute, 1-18<br />
user-input attributes<br />
checklength, 1-12<br />
examples, 1-28<br />
noempty, 1-13<br />
nomenu, 1-14<br />
notrim, 1-15, 1-50, 4-195, 4-244<br />
nounknown, 1-16<br />
overview, 1-10<br />
text, 1-17<br />
uppercase, 1-18<br />
using a record field as an index in TSL, 5-51<br />
using boolean criteria to display classes, 5-33<br />
using constraints in type objects, 1-8<br />
using functions in TSL, 5-52<br />
using the end keyword, 4-167<br />
V<br />
value, definition of, 3-2<br />
variable file attribute, 1-35<br />
variant record<br />
using readstr, 4-194<br />
using writestr, 4-243<br />
VSAM data access, file attribute, 1-32, 2-8<br />
W<br />
weekday, option of date statement, 4-124<br />
while loop. see loop<br />
window<br />
add, 4-65<br />
CM statements, 4-60<br />
delete, 4-69<br />
error display, 4-71<br />
get cursor from, 4-74<br />
I-22 <strong>Language</strong> <strong>Reference</strong><br />
get dimensions, 4-75<br />
get handle, 4-90<br />
get list, 4-93<br />
get outline color, 4-79<br />
get position, 4-81<br />
get status for answer window, 4-82<br />
get status information, 4-76<br />
get text, 4-84<br />
get text color, 4-85<br />
get title color, 4-87<br />
get title position, 4-89<br />
get word underneath cursor, 4-94<br />
popup, 4-95<br />
set cursor position, 4-97<br />
set dimensions, 4-98<br />
set outline color, 4-99<br />
set position, 4-101<br />
set text color, 4-102<br />
set title color, 4-104<br />
set title position, 4-106<br />
with<br />
description of, 10-14<br />
syntax and use of, 4-242<br />
words, reserved, 11-1<br />
writelength, 1-49, 1-50<br />
writelog, option of aes statement, 4-36<br />
writestr, syntax and use of, 4-243<br />
writetrace, option of aes statement, 4-37<br />
writing list and set lengths to a file, 1-49<br />
writing string lengths to a file, 1-50<br />
Y<br />
yearday, option of date statement, 4-125<br />
years, option of date statement, 4-126
Z<br />
zoned attribute, 1-53<br />
Index I-23
I-24 <strong>Language</strong> <strong>Reference</strong>
Aion Developement System<br />
<strong>Language</strong> <strong>Reference</strong><br />
(DC0429)<br />
<br />
<br />
PLATINUM technology Technical Documentation<br />
PLATINUM technology, inc.<br />
555 Twin Dolphin Drive, Suite 400<br />
Redwood City, CA 94065<br />
Hotline: 800/833-PLAT<br />
FAX: 415/594-8645<br />
Dear Customer: Your comments on PLATINUM technology Technical Documentation are highly valued. If you<br />
have any problem or suggestion about this manual or the online help, please use this form to communicate with us.<br />
Alternatively, you may call the PLATINUM technology Hotline to report documentation problems or provide<br />
comments.<br />
Describe Problem or Suggestion: _________________________________________________________________<br />
____________________________________________________________________________________________<br />
____________________________________________________________________________________________<br />
____________________________________________________________________________________________<br />
Page Number:_______________ Manual Title and ID (if different from above): ____________________________<br />
(Optional) Your name: __________________________________ Phone No: ______________________________<br />
Company: ___________________________________________________________________________________<br />
Please take a moment to complete this Quick Survey. For the following statements, indicate the extent of agreement<br />
you have with the statement by circling the number that best reflects your opinion.<br />
“This manual is useful, clear, and covers the appropriate material.”<br />
Strongly<br />
Disagree 1 2 3 4 5<br />
Strongly<br />
Agree<br />
“The product's Online Help was concise and easily navigated.”<br />
Strongly<br />
Disagree 1 2 3 4 5<br />
Strongly<br />
Agree<br />
“The quality of the written documentation is superior to similar products.”<br />
Strongly<br />
Disagree 1 2 3 4 5<br />
Strongly<br />
Agree<br />
“The overall product documentation meets or exceeds our expectations.”<br />
Strongly<br />
Disagree 1 2 3 4 5<br />
Strongly<br />
Agree