What's new in KCML 6.10
Records
A simple method of defining fields in a structure or records has been implemented using DEFRECORD and FLD. This allows the fields to be laid out in a natural way and relieves the programmer from having to compute start bytes and the total size of the structure. KCML will track the records fields and not allow them to be altered or reused. The records in a library can be browsed in the Workbench. Some standard KCML structures are documented in the manual using records (see $PSTAT, LINPUT+ and KI_INFO).
Fields
Fields have been changed considerably internally to be more efficient and flexible. A new naming scheme for fields has been introduced to permit a simple standardized data-typing for the data aware types. If these new types are used in defining the fields that represent KDB table rows then the Type$ property, which redundantly specifies the datatype of a column, can be dispensed with. In particular there are new field packing types for DATE, TIME, HEX and BOOL. There are, in fact, two boolean types, an MB type for legacy Y/N booleans returning a string value and a new BOOL type that encodes Y/N to be compatible but returns a numeric TRUE or FALSE.
A TIMESTAMP type can be used for millisecond timestamps. The SY8 type used to encode numbers using the KCML number format has been renamed to FP.
The PACK() function returns the packing format used for a field using the new naming scheme. The DIM() function will return the occurrence number for a field, if any.
There may be compatibility issues with KI_DESCRIBE_COL as it will now return the new pack codes rather than the two character hex strings that previous versions of KCML would have done.
The $UNPACK format for counting bits HEX(FBxxxxxx) is now only available through $UNPACK(E="BITS(xxxxxx)"). The Informix money format HEX(FCxx) is also now only available as an extended $PACK(E="X").
Constants
KCML will now supply default values for certain common constants. The available constants are listed in the KCML workbench functions browser and on this page.
Constants are now enabled by default i.e. the default value of byte 59 in $OPTIONS RUN is now HEX(01)
Modules or Libraries
Note the term module was replaced with library in KCML 6.20. This document refers to libraries for consistency.
Variables defined as common in COM statements within a library will be automatically instantiated in the foreground when the library is loaded. They are known as library variables. Constants and fields are ignored for this but will be copied to the foreground if referenced in executing code. Variables declared in DIM statements in the library are ignored. Library variables are not destroyed if a library is unloaded though this may be supported in a future version of KCML.
Libraries can have constructor DEFSUBs with the special reserved name of '_Constructor() which will be called automatically by LIBRARY ADD when a library is loaded.
New keywords PUBLIC and PRIVATE can be applied to DEFSUB in a library to indicate whether the function is visible from outside the library. By default a DEFSUB without this modifier is considered as PUBLIC.
A new make utility, kmake, can be used to compile libraries in a batch mode. Libraries can be comprised of more than one program whose line number ranges may clash as the compiler will renumber them automatically. The utility will compile only those libraries with components which have been modified since the library was last built. Each program can have its own constructor DEFSUB and the compiler will rename them uniquely and arrange for them to be called in turn when the library is loaded. The make utility is driven by an XML build script listing the libraries and their components.
XML DOM
Support for the Apache Xerces XML DOM has been provided through a new type of dynamic object. The Document Object Model is a W3C standard and allows programmers to directly manipulate XML documents in memory in a natural way.
There is also a SAX2 implementation which streams the text and does not build any tree structures. This should be more efficient for large documents.
The Apache Xerces DLL or shared library, plus a KCML shim library dyndom.dll, must be available on the server. Versions for NT, Linux, Solaris, Unixware, AIX and HP-UX are available on kcml.com.
KCML workbench
A number of small changes have been made to the KCML workbench.
- References in the object browser
- Records and constants in the functions browser
- A new database browser for KDB type 7 databases
- A local variables window
- Display variables can display in text, string or record views
- Tooltips can dereference SYM values, KDB handle values and can understand DATE/TIME/BOOL fields
- New search options
- Option to print program source through a KPRINT form
SOAP
SOAP support, for both client and server, has been enhanced beyond that provided in KCML 6.00 mostly to track the WSDL standard and the emerging Microsoft .Net implementation. Some of these changes to the KCML SOAP server are not backward compatible (e.g. the arguments to the KCMLObjectExports $DECLARE). The use of a WSDL file is now mandatory but KCML can generate it automatically and in particular can return it in response to a HTTP GET request. The URL used to access the WSDL must now conform to a .Net convention of ending in ?WSDL. If the endpoint URL is accessed from a browser a KCML SOAP server will now generate a documentation page. The SOAP client can now understand the WSDL generated by a .Net Web Service.
KCMLObjectGetUserName() can be used to authenticate users in a SOAP server.
The object browser in the KCML workbench can now remember SOAP WSDL URLs and permits the browsing of their methods without the requirement to have a running instance in the application. By right clicking a SOAP reference in the browser a suitable CREATE statement or a method invocation can be pasted into the editor window.
COM
The object browser in the KCML workbench can now remember COM type library references and permits the browsing of their properties, methods and events without the requirement to have a running instance in the application. By right clicking a COM reference in the browser a suitable CREATE statement or a method invocation can be copied to the clipboard to be pasted into the editor window.
There is specific support for the Win32 type library which defines all the Win32 API in the form of a COM type library. A right click here can copy a suitable $DECLARE to invoke a function to the clipboard.
KDB database
- The maximum size of a column that is word search indexable has been changed from 255 to 32767 bytes. This is a structural change that will require any word search indices on existing KDB type 7 tables to be dropped. KCML will not open a table that has an old format index still active.
- There have been some internal changes in type 7 tables to improve performance. Once a table has been opened in KCML 6.10 its internal layout will be altered and that table cannot subsequently be opened by an earlier version of KCML.
- The KI_INFO structure for word search indices has also changed to support this.
- KDB tables are now presumed to be encoded in Unicode using UTF-8.
- A new TIMESTAMP data type allows GMT timestamps with millisecond granularity.
- KI_START_FIRST and KI_START_BETWEEN can be used to restrict the range of keys that can be sequentially traversed. These are particularly useful with Oracle tables as they allow much better optimization of the generated SQL.
- NT locking semantics are enforced on Unix so on all platforms a second lock on a locked record will fail.
- Handles returned by KI_ALLOC_HANDLE are no longer small integers but are now huge opaque tokens with distinctive values that allow the workbench to identify them as handles and tooltip them with information about their properties.
Unicode
The default encoding for KCML and Kclient has been changed from Latin-1 to the UTF-8 encoding of Unicode. For English speaking countries this will have no implications but in countries and languages which require the use of characters above 0x80 there may well be issues. See the Unicode tutorial in the manual.
The implementation of UTF-8 is intended for forms based applications. It is incompatible with text applications that use $BOXTABLE and applications that run on terminals other than KClient using TERMINFO.
KCML will use UTF-8 in communicating with the client if the environment variable USING_UTF8 is set.
There are new $PACK formats to support converting from UTF-8 to the native locale of the server.
There are new functions to get the number of characters in a Unicode string (ULEN8()) and to move one character at a time forwards (UNEXT8()) and backwards (UPREV8()) in a string.
The POS(), VER(), $UPPER, $LOWER and $TRAN functions support the use of UTF-8 encoded characters.
The graphical forms designer Kform now requires an operating system that supports Unicode like NT4, Windows 2000 or XP. It does not run on Windows 9x. Kclient is available in two versions, for NT class operating systems that support Unicode and for Windows 9x type operating systems that do not.
Oracle
There is a new Oracle layer for the KDB database which targets Oracle 9i and completely implements the functionality of KDB in a totally transparent way.
The older shared library for Oracle 8 is still available but will no longer be maintained.
New methods
- SetDefault() method which is used to define the default item which will appear in bold on a popup.
- SetDataField() method which can be used to set the DataField data awareness for a grid cell.
- Type$ property is no longer required for data awareness as a default type can be extracted from the DataField property. However if Type$ is specified it will override the default.
- Tree controls have two new methods SetObject() and GetObject() that allow the programmer to tag a tree node with an object reference, say from an XML DOM.
New styles
- Toolbar buttons can be flagged in the forms editor forcing them to appear first in the list of toolbar icons associated with a menu. This allows exit buttons to appear in a fixed place even though they are conventionally at the end of the File menu.
- Data Binding in Forms using new methods to provide more programmatic options.
Connection manager
- KCML sessions started by the connection manager can now SHELL interactive sessions on Unix by creating a pseudo tty for the session. It also supports password expiry under Unix.
Other changes
- KI_FLD will no longer create fields but it will initialize existing fields. This is done to be KCML7 friendly as creating fields on the fly is not allowed in KCML7.
- The environment variables OPTIONS_xx, OPTIONS_RUN_xx and OPTIONS_LIST_xx can be used to preset bytes in the $OPTIONS, $OPTIONS RUN and $OPTIONS LIST.
- New statement DEFSECTION, used to define sections of a program. Provides a way of encapsuling more structure into a program and allows the workbench function browser to group common functions in a user defined way.
- Subroutine labels can be passed as arguments to a DEFSUB using BYREF. They can be optional with a default value supplied in the DEFSUB.
- The GLOBAL_ID environment variable will set the value of the currently selected global in bytes 45 and 46 of $PSTAT. Prior to KCML 6.00 this value was set by SELECT @PART but in KCML 6.00 and later it was no longer maintained. By setting this variable by connection in the Connection Manager kconf.xml, all the partitions using the same connection can be identified.
- The $MSG message text can be popped up in a client window for a specific KCML or for all KCMLs using a new broadcast option in bkstat and kservadm. This can be used by system administrators to warn users of operational changes.
- The berror.d error file is no longer used.
- On Unix systems the kcml binary is now just a loader for the shared library kserver.so which contains the actual KCML interpreter. This is to support the kc6 compiler and to be symmetric with the situation that has prevailed on Windows since KCML 5.0 (kcml.exe loads kserver.dll). If you manually copy or rename kcml you must copy or rename the shared library too.
- kclient -Y stops user access to the preferences dialog in the client. This can be useful on Citrix or WTS sites where the preferences can be set centrally.
- The client bookmarking feature can now generate a URL bookmark which can be used as a IE browser favorite.
- Support for conditional compilation and for compiling text programs without line numbers or colon statement separators.
- Better support for nested subroutines as KCML will now error calling one out of scope and the function browser shows them as nested.
- The number returned by SYM() is now encoded differently so that KCML can spot these unique values and dereference then automatically in the debugger or in panic files. It will also error any attempt to dereference using SYM(*) a number that did not come originally from a SYM() function.
- The -w switch to KCML to load a program from a platter has been dropped
- The -l switch to KCML allowing direct telnet connections has been dropped as this function is now performed by the connection manager.
- The delimiter form of $PACK/$UNPACK has been enhance to support rules for comma separated values quoting or CSV format.
- The 64kb restriction on the size of a scalar string and on the size of a dimension in an array has been lifted. Now the only restriction is that the total size cannot exceed 2Gb which means that lack of available memory is going to be the only reason for being unable to allocate a given string or array. The algorithm for redimensioning arrays in $DECLARE, KDB and KI_COMP has been changed to set the array dimensions to 1 and to vary the element length. This preserves the shape of the array and sizes it exactly.
- It is now legal to reference a scalar variable, numberic or string, before an explicit COM of the variable. The default definition from the original reference will be ignored and the definition from the COM will be used. In previous versions of KCML this was an error. The change is to facilitate the construction of modules from more than one program where there may be references to COMed library variables before the program that defines them.
- The CNUM() function can be used to convert an string representation of a number to a number. Decoding stops at the first non-numeric character in the string.
- Support Shelling out of interactive commands when connecting via the connection manager, on UNIX.
- XML panic files generated by PANIC now use a W3C compliant stylesheet rather than the obsolete Microsoft IE5 one. You therefore need a standards compliant XML parser as shipped with XP, IE6 and Mozilla. IE5.x users should upgrade their XML parser component to MSXML3 or MSXML4. At this time this is avaiable from Microsoft at this location.
- $CONVERT supports a new scaling format for use with currencies that lead to very high numeric values, e.g. Turkey, Indonesia.
- $MACHINE has a new bit in BYTE 53 indicating that the KClient is a Unicode version.
- SELECT PRINT without a file or device will now reset the PRINT stream to its default.
- On Unix systems the kcml executable has been split into two and the bulk of the code is now in a shared library kserver.so with kcml now just a wrapper that loads the library. This allows sharing of code between kcml and the kc6 compiler. NT systems have always had this structure.
- $UPPER and $LOWER are no longer restricted to LET statements but can be used as functions.