Overview of language features

Maths functions

KCML provides many in built advanced mathematical functions including trigonometric functions and Boolean functions as well as other common functions like modulus calculations, rounding, random number generation, etc.

String functions

KCML provides a mechanism known as fields which is similar to that used by other modern languages. Fields allow sub-strings to be named and referenced in a meaningful manner, which makes programs easy to read and maintain.

KCML also allows bit operations to be performed on all or part of string variables, for example logical AND, OR and XOR operations. Binary and decimal additions and subtractions can also be performed on whole or parts of a string.

Matrix handling

KCML allows matrices of both numeric and alpha information to be created. Various statements exists to allow matrices to searched, sorted, extended and initialised.

Special matrix arithmetic statements are also available to perform standard numeric operations on whole arrays.

Forms

There is native support for displaying GUI forms on the client. The forms can be created in the Workbench with a graphical editor and code attached to the events that can be triggered by the user interacting with the form.

Distributed objects

KCML can instantiate objects on and interact with COM and Corba servers with native methods and properies.

File I/O

KCML provides several alternative methods of file I/O. The main method is known as KISAM, which is a fast file access method for the relational database that is built in to KCML. KISAM is implemented as a series of external routines that are called from within KCML programs.

A simpler though less efficient file access method is also available that uses ANSI style statements like OPEN #, READ #, WRITE # and SEEK #. These statements can be used on UNIX devices and UNIX pipes, as well as on native operating system files.

Support for the original BASIC-2 platter based file access method is also still maintained for compatibility reasons, although use of this method is discouraged as it is considerably inefficient and has many restrictions. An enhancement to this original method allows the program and data files to be stored directly within the native operating system.

Device I/O

KCML allows access to any external peripherals connected to the UNIX CPU or Windows PCs and Network devices. Both the standard output devices and standard input devices used by KCML to display program output and to receive program input can be redirected to alternative devices.

Native operating system access

KCML allows access to native operating system commands and utilities from within KCML programs. Native commands can also be executed at any time while programs are being modified and debugged. The $DECLARE statment allows direct access to any Windows or 3rd party API.

KCML attempts to hide operating specific functions with its own commands as excessive use of O/S features compromises portability. For instance there are features in KCML to allow access to serial ports, TCP/IP sockets, pipes and native files in a platform independent way.

Programming constructs

KCML has all of the standard programming constructs that are found in most modern languages, for example WHILE ... WEND, REPEAT ... UNTIL, and FOR ... NEXT. Loop flow can be controlled with the BREAK and CONTINUE statements.

Logical switching is also available with the SELECT CASE construct, while statement grouping is available with the DO ... ENDDO construct.

Security

General programming features can be disabled to prevent users from breaking into applications code. If the HALT key is pressed, a password prompt is displayed. The response to this prompt is generated by the software supplier. The password only lasts for a short period of time, therefore the user cannot break into the code using the password at a later date. This feature is enabled by setting bytes in the $OPTIONS system variable.

KCML programs can be scramble protected to prevent users from copying and modifying the software. Programs can later be unscrambled with a "one-shot" password mechanism similar to that described above to allow programs to be modified over the phone.

Data conversion and storage

KCML contains several statements to simplify the conversion, storage and retrieval of data. For example, there is a single KCML statement called CONVERT, that can be used to convert alpha variables to numeric variables and vice-verse.

A more powerful data conversion statement is the $PACK statement which can be used to convert multiple numeric values directly into an alpha receiver variable. Many different formats may be used to alter the way in which the data is stored into the alpha receiver. The data can then later be converted back into individual numeric values with the $UNPACK statement.