0% found this document useful (0 votes)
11 views83 pages

Jobjex

The document is a comprehensive manual for jBASE OBjEX, detailing its copyright, acknowledgments, and various methods for interacting with jBASE objects. It covers the creation, connection, and manipulation of data within jBASE, including syntax definitions and examples for each method. Additionally, it provides guidelines for error handling and internationalization within the jBASE environment.

Uploaded by

Khaled Ghalab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views83 pages

Jobjex

The document is a comprehensive manual for jBASE OBjEX, detailing its copyright, acknowledgments, and various methods for interacting with jBASE objects. It covers the creation, connection, and manipulation of data within jBASE, including syntax definitions and examples for each method. Additionally, it provides guidelines for error handling and internationalization within the jBASE environment.

Uploaded by

Khaled Ghalab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 83

jBASE OBjEX 33

MAN
Copyright
Copyright (c) 2002 TEMENOS HOLDINGS NV
All rights reserved.
This document contains proprietary information that is protected by copyright. No part of this
document may be reproduced, transmitted, or made available directly or indirectly to a third party
without the express written agreement of jBASE Software. Receipt of this material directly from
jBASE Software or TEMENOS HOLDINGS NV constitutes its express permission to copy.
Permission to use or copy this document expressly excludes modifying it for any purpose, or using
it to create a derivative therefrom.

Acknowledgements
Information regarding Unicode has been provided in part courtesy of the Unicode Consortium.
The Unicode Consortium is a non-profit organization founded to develop, extend and promote use
of the Unicode Standard, which specifies the representation of text in modern software products
and standards. The membership of the consortium represents a broad spectrum of corporations and
organizations in the computer and information processing industry. The consortium is supported
financially solely through membership dues. Membership in the Unicode Consortium is open to
organizations and individuals anywhere in the world who support the Unicode Standard and wish
to assist in its extension and implementation.
Portions of the information included herein regarding IBM’s ICU has been reprinted by
permission from International Business Machines Corporation copyright 2001

jBASE, jBASIC, jED, jSHELL, jLP, jEDI, jCL, jQL, j1, j2 j3 j4 and jPLUS files are trademarks
of jBASE Software and TEMENOS Holdings NV.

REALITY is a trademark of MDIS plc.


PICK is a trademark of Pick Systems Inc.
All other trademarks are acknowledged.

Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun
Microsystems, Inc. in the United States and other countries.
Windows, Windows NT, and Excel are either registered trademarks or trademarks of Microsoft
Corporation in the United States and/or other countries.
UNIX is a registered trademark in the United States and other countries licensed exclusively
through X/Open Company Limited.
Other company, product, and service names used in this publication may be trademarks or service
marks of others.
Errata and Comments
If you have any comments regarding this manual or wish to report any errors in the
documentation, please document them and send them to the address below:

Technical Publications Department


TEMENOS UK Limited
6th Floor Kodak House
Hemel Hempstead
Hertfordshire
HP1 1JY
England
Tel SB: +44 (0) 1442 411800
Direct +44 (0) 1442 411808
Fax: +44 (0) 1442 411900

Please include your name, company, address, and telephone and fax numbers, and email address if
applicable. Documentation: documentation@temenos.com
Contents
DOCUMENTATION CONVENTIONS .........................................................................................................3
OVERVIEW ...........................................................................................................................................1
JBASE OBJECT ..................................................................................................................................1
CREATION .....................................................................................................................................2
CHANGE METHOD.......................................................................................................................3
CONNECT METHOD.....................................................................................................................4
CONVERT METHOD .....................................................................................................................5
COUNT METHOD..........................................................................................................................6
DATE PROPERTY ..........................................................................................................................7
DCOUNT METHOD.......................................................................................................................8
FIELD METHOD............................................................................................................................9
ICONV METHOD.........................................................................................................................10
INDEX METHOD .........................................................................................................................11
MATBUILD METHOD .................................................................................................................12
OCONV METHOD .......................................................................................................................13
CONVERSION CODES ................................................................................................................14
TIME PROPERTY.........................................................................................................................16
TRIM METHOD ...........................................................................................................................17
CREATEFILE METHOD..............................................................................................................18
OPEN METHOD ..........................................................................................................................19
JCONNECTION.OBJECT ............................................................................................................20
CALL METHOD ...........................................................................................................................21
CREATEFILE METHOD..............................................................................................................21
DATE PROPERTY ........................................................................................................................23
DELETELIST METHOD ..............................................................................................................24
EXECUTE METHOD Executes any other program from the command line COMMAND
SYNTAX .....................................................................................................................................25
GETLIST METHOD Retrieves a previously stored list COMMAND SYNTAX Set
jSelectList object = jConnectionObject.GetList( Name) Part
Description ................................................................................................................................26
ICONV METHOD Applies a jBASE input conversion code to the supplied data. ........................27
OConv Method Applies a jBASE conversion code to the supplied data .......................................28
Open Method.................................................................................................................................29
PRECISION PROPERTY Returns or sets the current precision used for the Call method
COMMAND SYNTAX.............................................................................................................30
JEDI OBJECT...............................................................................................................................32
METHODS............................................................................................................................................33
CLEARFILE METHOD Deletes all records from the file.............................................................33
Copy Method Creates a copy of an object ....................................................................................34
DELETE METHOD ......................................................................................................................35
READ METHOD...........................................................................................................................36
READU METHOD........................................................................................................................37
READV METHOD ........................................................................................................................38
READVU METHOD Reads a specific field from a file into a variable. If successful, the record is
locked. COMMAND SYNTAX ...............................................................................................39
ReleaseAllLocks Release all locks on records in a file. ................................................................40
RELEASELOCK METHOD ..........................................................................................................41
SELECT METHOD.......................................................................................................................42
WRITE METHOD .........................................................................................................................43
WRITEU METHOD ......................................................................................................................44
WRITEV METHOD.......................................................................................................................45
WRITEVU METHOD....................................................................................................................46
JDYNARRAY OBJECT ......................................................................................................................47
METHODS........................................................................................................................................48
CHANGE METHOD.....................................................................................................................48
DEL METHOD .............................................................................................................................49
EXTRACT METHOD ....................................................................................................................50
EXTRACTDYNARRAY METHOD ................................................................................................51
FIND METHOD ...........................................................................................................................52
FINDSTR METHOD.....................................................................................................................53
INS METHOD...............................................................................................................................54
LOCATE METHOD ......................................................................................................................55
MATPARSE METHOD .................................................................................................................56
REPLACE METHOD....................................................................................................................57
SELECT METHOD.......................................................................................................................58
SORT METHOD ...........................................................................................................................59
TEXT METHOD ...........................................................................................................................60
jSELECTLIST OBJECT ................................................................................................................61
ReadNext Method..........................................................................................................................62
WRITELIST METHOD .................................................................................................................63
VISUAL BASIC IN VISUAL BASIC THE RESULT, CODE IS USED TO UPDATE THE ERR
OBJECT AND WILL CAUSE CERTAIN ACTIONS TO BE TAKEN ACCORDING TO THE
USE OF THE ON ERROR STATEMENT. IF YOU DON’T USE AN ON ERROR
STATEMENT, ANY RUN-TIME ERROR THAT OCCURS IS FATAL; THAT IS, AN ERROR
MESSAGE IS DISPLAYED AND EXECUTION STOPS. AN “ENABLED” ERROR
HANDLER IS ONE THAT HAS BEEN TURNED ON BY AN ON ERROR STATEMENT; AN
“ACTIVE” ERROR HANDLER IS AN ENABLED HANDLER THAT IS IN THE PROCESS
OF HANDLING AN ERROR. IF AN ERROR OCCURS WHILE AN ERROR HANDLER IS
ACTIVE (BETWEEN THE OCCURRENCE OF THE ERROR AND A RESUME, EXIT SUB,
EXIT FUNCTION, OR EXIT PROPERTY STATEMENT), THE CURRENT PROCEDURE’S
ERROR HANDLER CAN’T HANDLE THE ERROR. CONTROL RETURNS TO THE
CALLING PROCEDURE; IF THE CALLING PROCEDURE HAS AN ENABLED ERROR
HANDLER, IT IS ACTIVATED TO HANDLE THE ERROR. IF THE CALLING
PROCEDURE’S ERROR HANDLER IS ALSO ACTIVE, CONTROL PASSES BACK
THROUGH PREVIOUS CALLING PROCEDURES UNTIL AN ENABLED, BUT INACTIVE,
ERROR HANDLER IS FOUND. IF NO INACTIVE, ENABLED ERROR HANDLER IS
FOUND, THE ERROR IS FATAL AT THE POINT AT WHICH IT ACTUALLY OCCURRED.
EACH TIME THE ERROR HANDLER PASSES CONTROL BACK TO THE CALLING
PROCEDURE, THAT PROCEDURE BECOMES THE CURRENT PROCEDURE. ONCE AN
ERROR HANDLER IN ANY PROCEDURE HANDLES AN ERROR, EXECUTION RESUMES
IN THE CURRENT PROCEDURE AT THE POINT DESIGNATED BY THE RESUME
STATEMENT.......................................................................................................................................64
jBASIC AND VISUAL BASIC GUIDE ..........................................................................................65
NULL REFERENCES VS NULL DYNAMIC ARRAYS..................................................................71
COMPONENTS ............................................................................................................................71
INTERNATIONALIZATION (I18N).................................................................................................72
IMPLEMENTING I18N..........................................................................................................................72
USING MARKERS IN I18N MODE ........................................................................................................72
MAPPING.............................................................................................................................................74
IMPLEMENTING A MAPPING FILE ........................................................................................................74
MAPPING FILE FORMAT ......................................................................................................................74
Documentation Conventions
This manual uses the following conventions:

Convention Usage

BOLD In syntax, bold indicates commands, function names, and


options. Intext, bold indicates keys to press, function names,
menu selections, and MS-DOS commands.

UPPERCASE In syntax, uppercase indicates JBase commands, keywords, and


options; BASIC statements and functions; and SQL statements
and keywords. In text, uppercase also indicates JBase identifiers
such as filenames, account names, schema names, and Windows
NT filenames and pathnames.

UPPERCASE Italic In syntax, italic indicates information that you supply. In text,
italic also indicates UNIX commands and options, filenames,
and pathnames.

Courier Courier indicates examples of source code and system output.

Courier Bold Courier Bold In examples, courier bold indicates characters that
the user types or keys (for example, <Return>).

[] Brackets enclose optional items. Do not type the brackets unless


indicated.

{} Braces enclose nonoptional items from which you must select at


least one. Do not type the braces.

ItemA | itemB A vertical bar separating items indicates that you can choose
only one item. Do not type the vertical bar.

... Three periods indicate that more of the same type of item can
optionally follow.

⇒ A right arrow between menu options indicates you should


choose each option in sequence. For example, “Choose File
⇒Exit” means you should choose File from the menu bar, and
then choose Exit from the File pull-down menu.
Syntax definitions and examples are indented for ease in reading.
All punctuation marks included in the syntax—for example, commas, parentheses, or
quotation marks—are required unless otherwise indicated.
Syntax lines that do not fit on one line in this manual are continued on subsequent lines.
The continuation lines are indented. When entering syntax, type the entire syntax entry,
including the continuation lines, on the same input line.
OVERVIEW

The majority of computer systems are now connected to some kind of network, which enables
machines to “talk” to another machine. The amount of “talking” possible between the two
machines depends on either proprietary mechanisms, whereby the two systems specifically know
how to talk to each other, or by standard mechanisms, defacto or otherwise, whereby any machine
should be able to talk to another using the “standard” component.
However even when data can be transferred between systems being able to exchange data between
applications can still be a problem. One of the primary reasons behind jBASE OBjEX was to be
enable data from Multivalued applications to be provided directly to common desktop applications
like Excel and Word or any application coded in Visual Basic or Delphi.

Provided via an additional dynamic linked library, OBjEX.dll, and a type library, OBjEX.tlb the
OBjEX interface provides the developer with a mechanism to retrieve or update data directly from
an OLE, Object Linking and Embedding, and compliant application. For example, you can code
an Excel macro using jBASE OBjEX to extract data from a jBASE hash file directly into an Excel
spreadsheet. As jBASE OBjEX accesses data via the jBASE jEDI layer any database, for which a
jEDI driver exists, can be accessed using jBASE OBjEX. For example, jBASE Hash files NT/95
directories or SQL databases.

jBASE OBJECT
The jBASE object represents the jBASE engine. As the top-level object, it contains and controls
all other objects in the hierarchy of objects.

The jBASE object is used to open files and to perform certain jBASE operations on the built-in
types. For maintainability, you are advised to use the name jB for all references to the jBASE
object. This documentation will use jB whenever a reference is made to the jBASE object
CREATION
To create the jBASE object from an early binding controller such as Visual Basic 4.0, use the
following VB statement:

Public jB As New jBASE

Alternately, when using a late binding controller such as VBA then use:

Public jB As Object

Set jB = CreateObject(“OBjEX.jBaseObject.3”)

NOTES

There can only be one jBASE Object in existence in a process at any one time, any attempt to
create an additional one will return a pointer to the original object.

When creating a jBASE object using CreateObject or the equivalent in other languages you can
either default to using the latest installed version of OBjEX or specify a specific version by
appending a period and the major version number as a single digit to the object name e.g.:

Set jB = CreateObject(“OBjEX.jBaseObject.3”)
CHANGE METHOD
Returns a string with all occurences of a substring replaced with another

COMMAND SYNTAX

jB.Change( Source, FromString,ToString)

Source a string expression that evaluates to the string to be modified.


FromStringa string expression that evaluates to the substring to be replaced
ToStringa string expression that evaluates to the substring to use as a replacement

REMARKS

This method returns a modified string it does not update the source string.
CONNECT METHOD
Connects to a jBASE Database

COMMAND SYNTAX

Set jConnectionobject = jB.Connect([Target[,Options]])

JConnectionobject a variable that will be set to refer to the target database


Target a string expression that represents the connection to a machine on the same network. The
expression can be the name of the machine or an IP address. To connect to the local machine omit
this parameter. Note that it should not be necessary to open remote files by connecting to a remote
machine. Remote files should be opened from the local machine either through jRFS, F-pointers,
mapped network drives or UNC paths. Remote connections are only practical when there is some
subroutine or EXECUTE statement, which must be run on the remote system.
Options a string expression that is reserved. This optional value should be omitted (or set up as an
empty parameter) in this release of OBjEX.
CONVERT METHOD
Returns a string where all occurrences of a set of characters have replaced with the equivalent
character in the replacement set.

COMMAND SYNTAX

jB.Convert( Source, FromString,ToString)

Source a string expression that evaluates to the string to be modified.


FromString a string expression that evaluates to the set of characters to be replaced
ToString a string expression that evaluates to the set of replacement characters

REMARKS

Each character in the Source string is checked to see if it occurs in the FromString, if it does then
it is replaced with the character in the same position in the ToString If there is no corresponding
character in the ToString then the character is deleted from the string. If there are duplicate
characters in the FromString then only the first character will be used. This method returns a
modified string, it does not update the source string.
COUNT METHOD
Returns the number of times the delimiter string occurs in the source string.

COMMAND SYNTAX

jB.Count( Source, Delimiter)

Source a string expression that evaluates to the string to be examined.


Delimiter a string expression that evaluates to the desired delimiter.

REMARKS

If a multi-character delimiter is specified then they are only counted when they start after the end
of the prior delimiter occurrence. ie: delimiters cannot overlap.
DATE PROPERTY
Returns the current date in jBASE internal format

COMMAND SYNTAX

Object.Date()

REMARKS

Returns the date as an integer containing the number of days since December 31 1967
DCOUNT METHOD
Returns the number elements of a string that are separated by a delimiter string

COMMAND SYNTAX

jB.DCount( Source, Delimiter)

Source a string expression that evaluates to the string to be examined.


Delimiter a string expression that evaluates to the desired delimiter

REMARKS

If a multi-character delimiter is specified then they are only counted when they start after the end
of the prior delimiter occurrence. ie: delimiters cannot overlap. If the source string is NULL then
the function will return a value of zero, in all other cases this method will return one greater than
the Count method would.
FIELD METHOD
Returns multi-character delimited substrings from within a string.

COMMAND SYNTAX

jB.Field(Source,Delimiter,Occurrence,Count,BeforeCol,AfterCol)

Part Description
Source the string to search for the substring.
Delimiter the string that delimits substrings
Occurrence the optional starting substrings number. (default 1)
Count the optional count of substrings to extract. (default 1)
BeforeCol an optional long variable that returns the character position 1 before the extracted
substring(s)
AfterCol an optional long variable that returns the character position 1 after the extracted
substring(s)

REMARKS

This method encompasses the functionality provided by the jBASIC


statements “Field()”, “Col1()”, “Col2()” and Group()”
ICONV METHOD
Applies a jBASE input conversion code to the supplied data.

COMMAND SYNTAX

destvar = Object.IConv( sourcevar, convcode )

Part Description
destvar the name of a Variant that receives the data from the conversion
Object the jBASE Object or a jConnection Object.
Sourcevar a variant that contains the data to be converted
Convcode a string expression that evaluates to the desired conversion code

NOTES

For a list of available conversion codes, see OConv Method


INDEX METHOD
Returns the position of a character or characters within a string

COMMAND SYNTAX

Position = jB.Index(Source,SubString,Occurrence)

Source the string that you wish to search.


SearchString the sub string to find.
Occurrence a numeric expression that is the occurrence to be found

REMARKS

The function will return the character position of the first character of the specified occurrence of
the sub string or zero if it is not found.
MATBUILD METHOD
Creates a jDynArray from an Array of Variants

COMMAND SYNTAX

Set jDynArrayVar = jB.Matbuild(Source)

Part Description
jDynArrayVar the name of a jDynArray variable that receives a reference to the created object.
Source a Variant that contains the source data.

REMARKS

Matbuild takes a variant containing a string or an array and creates a jDynArray object from it. If
the variant is an array then each element of the array becomes a field in the created object. If any
element of the array is itself an array, then each element in that array becomes a value in that field.
The process is repeated for subvalues.
If the variant is a string or can be coerced to a string, then a jDynArray object containing a single
field is created.
OCONV METHOD
Applies a jBASE conversion code to the supplied data

COMMAND SYNTAX

destvar = Object.OConv( sourcevar, convcode )

Part Description
destvar the name of a Variant that receives the data from the conversion
Object the jBASE Object or a jConnection Object.
Sourceexp a variant that contains the data to be converted.
Convcode a string expression that evaluates to the desired
CONVERSION CODES
Conversion Action

Converts an internal date to an external date format. The numeric argument n


specifies the field width allowed for the year and can be 0 to 4 (default 4). The
D{n{c}}
character c returns the date in the form ddcmmcyyyy. If it is not specified, the
month name is returned in abbreviated form.

Allows the conversion of an external date to the internal format even though an
DI
output conversion is expected.

DD Returns the day in the current month.

DM Returns the number of the month in the year

.DMA Returns the name of the current month.

Returns the number of the day in the year (0


DJ
366).

DQ Returns the quarter of the year as a number 1 to 4

DW Returns the day of the week as a number 1 to 7 (Monday is 1).

DWA Returns the name of the day of the week.

DY{n} Returns the year in a field of n characters.

Given a prospective filename for a command such as CREATE


F FILE, this conversion will return a filename that is acceptable to the version of
Windows in which jBASE is running.

MCA Removes all but alphabetic characters from the input string .

Removes all but the NON


MC/A
alphabetic characters in the input string

.MCN Removes all but numeric characters in the input string.

Removes all but NON


MC/N
numeric characters in the input string.

MCB Returns just the alphabetic and numeric characters from input string.
MC/B Removes the alphabetic and numeric characters from input string.

MCC;s1;s2 Replaces all occurrences of string s1 with string s2.

MCL Converts all upper case characters in the string to lower case chars.

MCU Converts all lower case characters in the string to upper case chars.

MCT Capitalizes each word in the input string; i.e.: JIM converts to Jim.

Converts all nonprintable characters to a tilde character “~” in the input string.
MCP{c}
If the character “c” is supplied then this character is used instead of the tilde.

In the same manner as the MCP conversion, all nonprintable characters are
MCPN{n} replaced. However, the replacing character is followed by the ASCII
hexadecimal value of the character that was replaced.

Performs the opposite conversion to MCPN. The ASCII hexadecimal value


MCNP{n} following the tilde character is converted back to its original binary character
value.

MCDX Converts the decimal value in the input string to its hexadecimal equivalent.

MCXD Converts the hexadecimal value in the input string to its decimal equivalent.

Extracts x groups, separated by character c skipping n groups, from the input


Gncx
string

MT{HS Performs time conversions.

MD Converts the supplied integer value to a decimal value.

MP Converts a packed decimal number to an integer value.

MX Converts ASCII input to hexadecimal character


TIME PROPERTY
Returns the current time in jBASE internal format

COMMAND SYNTAX

Object.Time()

REMARKS

Returns the time as an integer containing the number of seconds since midnight.
TRIM METHOD
Returns a string with certain occurrences of a character removed

COMMAND SYNTAX

Result = jB.Trim( Source, Flags,Character)

Source a string expression that evaluates to the string to be trimmed.


Flags an optional expression that defines the type of trim to perform.
Character an optional character to specify the character to remove.

REMARKS

The default operation is to trim leading, trailing and redundant blanks. The optional parameters
can be used to modify the type of trimming performed. The possible values for the Flags
parameter are:

Symbol Action

TRIM_LEADING Remove leading blanks

TRIM_TRAILING Remove trailing blanks.

TRIM_REDUNDANT Replace consecutive blanks with single blank

TRIM_ALL Remove all blanks.


These values can be added together to achieve a combination of actions. If the optional Character
is specified then the actions will be performed on occurrences of that character rather than blank.

NOTE: a possible enhancement is to default to all white space rather than just blank so specify

the blank character if this would be a problem. This method returns a modified string, it does not
update the source string.

For Compatibility with OBjEX 1.0 the following jConnection methods are supported on jBASE
Objects
CREATEFILE METHOD
Creates a new file

COMMAND SYNTAX

Object.CreateFile filename,options

Part Description

Object the jBASE Object or a jConnection Object.


jBaseobject A variable of jBASE object data type that represents the jBASE object.
filename a string expression that is the name of a file and may include the path to the file.
options An optional string expression that supplies any desired modifiers to the file create
processor.

See jBASE documentation for details.


OPEN METHOD
Opens a specific file and, if successful, returns a reference to it.

COMMAND SYNTAX

Set jEDIobject = Object.Open(filename)

Part Description

jEDIobject a variable of a jEDI object data type that represents the file that you are opening.
Object the jBASE Object or a jConnection Object.
Filename a string expression that is the name of a file and may include the path to the file
JCONNECTION.OBJECT
The jConnection Object represents a connection to a specific machine on the network.
CALL METHOD
Calls a cataloged jBASIC subroutine

COMMAND SYNTAX

jConnectionObject.Call subroutine, parameters

Part Description

subroutine the name of a catalogued jBASIC subroutine.

Parameters up to 20 commas separated parameters to the called subroutine.

REMARKS

The number of parameters specified must match the number of parameters expected by the called
routine.

Parameters

The number of parameters specified must match the number of parameters expected by the called
routine.
All parameters are passed by reference and can be modified by the jBASIC subroutine unless they
are explicitly passed by value by the caller. To pass by value in Visual Basic, enclosing the
parameter in parentheses will create a temporary variable to hold the result of the expression in
parentheses. Parameters can be any of the valid OLE types including references to objects. OBjEX
will perform the necessary conversions between OLE and jBASIC variable types.

CREATEFILE METHOD
Creates a new file
COMMAND SYNTAX

Object.CreateFile filename,options

Part Description

Object the jBASE Object or a jConnection Object.


JBaseobject a variable of jBASE object data type that represents the jBASE object
Filename a string expression that is the name of a file and may include the path to the file
options an optional string expression that supplies any desired modifiers to the file create
processor. See jBASE documentation for details.
DATE PROPERTY
Returns the current date in jBASE internal format

COMMAND SYNTAX

Object.Date()

REMARKS
Returns the date as an integer containing the number of days since December 31 1967
DELETELIST METHOD
Deletes a previously stored list

COMMAND SYNTAX

jConnectionObject.DeleteList Name

Part Description
Name a string expression that evaluates to the name of the list to be deleted

.REMARKS

Lists are saved in the jBASE work file.


EXECUTE METHOD

Executes any other program from the command line

COMMAND SYNTAX

jConnectionObject.Execute
CommandLine,Options,[,Setting[,Capturing[,RtnList[,PassList]]]]

Part Description
CommandLine a string expression that evaluates to the command to be executed
Options a numeric expression available for future options – Use zero for now.
Setting a variable that will capture the output of any error messages generated by the command
Capturing a variable that will capture the terminal output generated by the command.
RtnList a variable that will reference a jSelectList Object created by the command.
PassList The name of a jSelectListobject to pass to the command.
GETLIST METHOD
Retrieves a previously stored list

COMMAND SYNTAX
Set jSelectList object = jConnectionObject.GetList( Name)

Part Description
Name a string expression that evaluates to the name of the list to be retrieved.
jSelectList object a variable of jSelectList data type that will be set up to reference the retrieved
select list.

REMARKS

Lists are saved in the jBASE work file.


ICONV METHOD
Applies a jBASE input conversion code to the supplied data.

COMMAND SYNTAX

destvar = Object.IConv( sourcevar, convcode )

Part Description

destvar the name of a Variant that receives the data from the Conversion.

Object the jBASE Object or a jConnection Object.


sourcevar a variant that contains the data to be converted.
Convcode a string expression that evaluates to the desired conversion code

NOTES

For a list of available conversion codes, see OConv Method for jBASE OBJECT.
OConv Method
Applies a jBASE conversion code to the supplied data

COMMAND SYNTAX

destvar = Object.OConv( sourcevar, convcode )

See Oconv Method for jBASE OBJECT


Open Method
Opens a specific file and, if successful, returns a reference to it.

COMMAND SYNTAX

Set jEDIobject = Object.Open(filename)

Part Description
JEDIobject a variable of a jEDI object data type that represents the file that you are opening
Object the jBASE Object or a jConnection Object.
filename a string expression that is the name of a file and may include the path to the file.
PRECISION PROPERTY
Returns or sets the current precision used for the Call method

COMMAND SYNTAX

precision =jConnectionObject.Precision()
jConnectionObject.Precision = precision

REMARKS
The precision is an integer between zero and nine. The default is four.
TIME PROPERTY
Returns the current time in jBASE internal format

COMMAND SYNTAX

Object.Time()

REMARKS
The time is returned as an integer containing the number of seconds since
midnight.
JEDI OBJECT

The jEDI Object represents an open file using the Open method of the jConnection object they are
closed when all references have been deleted.
METHODS

CLEARFILE METHOD
Deletes all records from the file

COMMAND SYNTAX

jEDIobject.ClearFile

Part Description

jEDIobject a variable of a jEDI object data type. This represents the file to which you are
referring
Copy Method
Creates a copy of an object

COMMAND SYNTAX

Set NewObject = Object.Copy()

Part Description

NewObject a variable to receive a reference to the newly created object


Object a reference to the object to be copied.

NOTES

jEDI objects are handles to open files. Copying the jEDI object creates a new handle to the same
file.
DELETE METHOD
Deletes specific record from a file

COMMAND SYNTAX

jEDIobject.Delete(recordKey)

Part Description

jEDIobject a variable of a jEDI object data type that represents the file that you are deleting from
recordkey a string expression that is the name of the record to be deleted.

REMARKS

If the record cannot be deleted then it returns an error status.


READ METHOD
Reads a specific record from a file into a new jDynArray object.

COMMAND SYNTAX

Set jDynArrayobject = jEDIobject.Read(recordkey)

Part Description
jEDIobject a variable of a jEDI object data type that represents the file that you are opening.
jDynArrayobject a variable of jDynArray type that will be receive a reference to the resulting
jDynArray object. recordkey a string expression that is the name of the record to be read.

REMARKS

If the record cannot be read then it returns an error status.


READU METHOD
Reads a specific record from a file into a new jDynArray object. If successful, the record is
locked.

COMMAND SYNTAX

Set jDynArrayobject = jEDIobject.ReadU(recordkey)

Part Description
jEDIobject a variable of a jEDI object data type that represents the file that you are opening.
JDynArrayobject a variable of jDynArray type that will be receive a reference to the resultant
jDynArray object.
Recordkey a string expression that is the name of the record to be read

REMARKS

If the record cannot be read then it returns an error status.


READV METHOD
Reads a specific field from a file into a variable.

COMMAND SYNTAX

destvar = jEDIobject.ReadV(recordkey, field number)

Part Description
destvar a variable of type VARIANT.
JEDIobject a variable of a jEDI object data type that represents the file that you are opening
Recordkey a string expression that is the name of the record to be read
field number a numeric expression that is the field number you want to read.

REMARKS

If the record cannot be read then it returns an error status.


READVU METHOD
Reads a specific field from a file into a variable. If successful, the record is locked.

COMMAND SYNTAX

destvar = jEDIobject.ReadVU(recordkey, field number)

Part Description

destvar a variable of type VARIANT.


jEDIobject a variable of a jEDI object data type that represents the file that you are opening.
recordkey a string expression that is the name of the record to be read.
field number a numeric expression that is the field number you want to read.

REMARKS

Returns an error status if it cannot read the record.


ReleaseAllLocks
Release all locks on records in a file.

COMMAND SYNTAX

jEDIobject.ReleaseAllLocks()

Part Description

jEDIobject a variable of a jEDI object data type that represents the file.
RELEASELOCK METHOD

Release the lock on a specific record in a file.

COMMAND SYNTAX

jEDIobject.ReleaseLock(recordkey)

Part Description

JEDIobject a variable of a jEDI object data type that represents the file
recordkey a string expression that is the name of the record to be unlocked.
SELECT METHOD
Returns a jSelectList object that represents all the record keys in the file

COMMAND SYNTAX

Set jSelectList object = jEDIobject.Select()


Set jSelectList object = jDynArrayobject.Select()

Part Description

jEDIobject a variable of a jEDI object data type that represents the file that you are opening.
jSelectList object a variable of jSelectList data type that will be set up to reference the created
select list.
WRITE METHOD
Write a jDynArray object into a file, releasing any locks held on the record.

COMMAND SYNTAX

jEDIobject.Write recordkey, jDynArrayobject

Part Description

jEDIobject a variable of a jEDI object data type that represents the file to which you are writing.
JDynArrayobject a variable of jDynArray data type that will be written to the file
Recordkey a string expression that is the name of the record to be written

REMARKS

If the record cannot be written it then returns an error status.


WRITEU METHOD
Write a jDynArray object into a file retaining any locks on the record.

COMMAND SYNTAX

jEDIobject.WriteU recordkey, jDynArrayobject

Part Description

jEDIobject a variable of a jEDI object data type that represents the file to which you are writing.
JDynArrayobject a variable of jDynArray data type that will be written to the file
Recordkey a string expression that is the name of the record to be written

REMARKS

If the record cannot be written then it returns an error status.


WRITEV METHOD
Update a specific field in a record, releasing any locks held on the record.

COMMAND SYNTAX

jEDIobject.WriteV recordkey, fieldnumber, replacementvalue

Part Description

jEDIobject a variable of a jEDI object data type that represents the file that you are updating.
recordkey a string expression that is the name of the record to be updated.
fieldnumber a numeric expression that specifies the field to be updated.
replacementvalue an expression that is the value to replace the specified field.

REMARKS

If the record cannot be read or written then it returns an error status.


WRITEVU METHOD
Update a specific field in a file, retaining any locks held on the record.

COMMAND SYNTAX

jEDIobject.WriteVU recordkey, fieldnumber, Replacement Value

Part Description

jEDIobject a variable of a jEDI object data type that represents the file that you are updating.
recordkey a string expression that is the name of the record to be updated.
fieldnumber a numeric expression that specifies the field to be updated.
Replacement Value an expression that is the value to replace the specified field.

REMARKS

If the record cannot be read or written then it returns an error status.


JDYNARRAY OBJECT

The jDynArray Object is a variable length string that uses embedded delimiter characters to
implement a three dimensional multi valued record structure.

Each record comprises any number of Fields. Each field can contain any number of Values. Each
value can contain any number of SubValues.

JdynArray Objects either are the result of methods on the jEDI Object or can be created
dynamically.
METHODS
CHANGE METHOD
Returns a string with all occurrences of a sub string replaced with another

COMMAND SYNTAX

jDynArrayobject.Change(Source, FromString,ToString)

jDynArrayobject the name of a jDynArray object that you wish to update.


DEL METHOD
Deletes an element from a jDynArray object

COMMAND SYNTAX

jDynArrayobject.Del Fieldno[,ValueNo[,SubValueNo]]

jDynArrayobject the name of a jDynArray object that you wish to update.


Fieldno a numeric expression that is the field number to be deleted.
ValueNo is an optional numeric expression that is the value number to be deleted.
SubValueNo is an optional numeric expression that is the subvalue number to be deleted.

REMARKS

Invalid numeric values for the expressions are ignored without warning. The command operates within the scope
specified, i.e. if only a field is specified, then the entire field (including its multivalues and subvalues) is deleted.
If a subvalue is specified, then only the subvalue is deleted, leaving its parent multivalue and field intact
EXTRACT METHOD
Returns the value of a specific field, value or subvalue

COMMAND SYNTAX

Destvar = jDynArrayVar.Extract(Fieldno,[ValueNo,[SubValueNo]])

DestVar is the name of a String or Variant that receives the extracted data.
JDynArrayVar the name of a jDynArray from where you extract data
Fieldno is a numeric expression that is the field number to extract.
ValueNo is an optional numeric expression that is the value number to extract.
SubValueNo is an optional numeric expression that is the subvalue number to extract.

REMARKS

If the extracted field or value comprises multiple values or subvalues, then the DestVar will contain embedded
delimiter characters.
EXTRACTDYNARRAY METHOD
Returns the value of a specific field or value as a jDynArray object

COMMAND SYNTAX

Set jDynArrayVar = jDynArrayobject.ExtractDynArray(Fieldno,[ValueNo])

jDynArrayVar is the name of a jDynArray variable that receives the extracted data.
jDynArrayobject the name of a jDynArray object from where to extract data
Fieldno is a numeric expression that is the field number to extract.
ValueNo is an optional numeric expression that is the value number to extract.
FIND METHOD
Allows the location of a specified string within a jDynArray object

COMMAND SYNTAX

jDynArrayobject.Find(SearchString,OccurenceNo,fieldVar,[ValueVar,[SubValueVar]])

jDynArrayobject is the name of a jDynArray object that you wish to search.


SearchString is the string to find.
OccurrenceNo is a numeric expression that is the occurrence to be found.
FieldVar is the name of a numeric or Variant that receives the field position in which the string was found.
ValueVar is an optional name of a numeric or Variant that receives the value position in which the string was
found.
SubValueVar is an optional name of a numeric or Variant that receives the sub-value position in which the
string was found.

REMARKS

The function has a Boolean return type that is set true if the string is found. This allows the method to be used in
an IF statement.
FINDSTR METHOD
Allows the location of a specified substring within a jDynArray object

COMMAND SYNTAX

jDynArrayobject.FindStr(SearchString,OccurenceNo,FieldVar,[ValueVar,[ SubValueVar]])

jDynArrayobject is the name of a jDynArray object that you wish to search.


SearchString is the substring to find.
OccurenceNo a numeric expression that is the occurrence to be found
FieldVar the name of a numeric or Variant that receives the field
position is the position in which the substring was found.
ValueVar is an optional name of a numeric or Variant that receives the value position in which the substring was
found.
SubValueVar is an optional name of a numeric or Variant that receives the sub-value position in which the
substring was found.

REMARKS

The function has a Boolean return type that is set true if the substring is found. This allows the method to be used
in an IF statement.
INS METHOD
Inserts elements into a jDynArray

COMMAND SYNTAX

jDynArrayobject.Ins ValueToInsert, Fieldno[,ValueNo[,SubValueNo]]

jDynArrayobject is the name of a jDynArray object into which you wish to insert the data.
ValueToInsert is the variable containing the value to be inserted.
Fieldno a numeric expression that is the field number to insert before
ValueNo is an optional numeric expression that is the value number to insert before.
SubValueNo is an optional numeric expression that is the subvalue number to insert before

REMARKS

The ValueToInsert can be either a jDynArray object or any other type of variable that can be coerced to a string.
Specifying a negative value to any of Fieldno, ValueNo, or SubValueNo will cause the element to append as the
last Field, Value, or Sub-Value rather than at a specific position. Only one of the expressions may be negative,
otherwise the first negative value is used correctly but the others are treated as the value 1. The statement will
insert NULL Fields, Values, or Sub-Values accordingly if any of the specified insertion points exceeds the
number currently existing.
LOCATE METHOD
Finds the position of an element within a specified dimension of a jDynArray object

COMMAND SYNTAX

jDynArrayobject.Locate( searchstring, positionvar [, ordercode[,startposition[, Fieldno[, Valueno]]]])

jDynArrayobject is the name of a jDynArray object that you wish to search.


searchstring is the string to find.
positionvaris the name of a long variable that receives the position.
ordercode is an optional string expression that specifies the ordering.
startposition an optional numeric expression that specifies the field, value or subvalue position from which the
search will begin.
Fieldno is an optional numeric expression that specifies the field position to search for a value.
Valueno is an optional numeric expression that specifies the value position to search for a sub value.

REMARKS

Specifing ordercode causes the search to expect the elements to be arranged in a specific order, which can
considerably improve the performance of some searches. The available string values for ordercode are:

AL Values are in ascending alphanumeric order

AR Values are in right justified, then ascending order

AN Values are in ascending numeric order

DL Values are in descending alphanumeric order

DR Values are in right justified, then descending order

DN Values are in descending numeric order

Positionvar will be set to the position of the Field, Value or Sub-Value in which searchstring was found if
indeed, it was found. If it was not found and ordercode was not specified then positionvar will be set to one
position past the end of the searched dimension. If ordercode did specify the order of the elements then
positionvar will be set to the position before which the element should be inserted to retain the specified order.

The function has a Boolean return type that is set true if the string is found. This allows the method to be used in
an IF statement. Matparse Method
MATPARSE METHOD
Builds an Array from a jDynArray

COMMAND SYNTAX

DestVar = jDynArrayVar.Matparse

DestVar the name of a Variant that receives the Array


JDynArrayVar the name of a jDynArray from which to create an Array

REMARKS

Matparse returns an array of variants with one element for each field in the jDynArray object. If any field
contains multiple values then the corresponding field will contain an array of variants with one element for each
value. The process is repeated for sub values. When the contents of a jDynArray object are a single field without
any embedded values, the DestVar is returned as a variant of type string . The Visual Basic function IsArray() is
useful for determining the presence of embedded values.
REPLACE METHOD
Replaces a specified Field, Value, or Sub-Value in a jDynArray

COMMAND SYNTAX

jDynArrayobject.Replace ReplacementValue,Fieldno[,ValueNo[,SubValueNo]]

jDynArrayobject is the name of a jDynArray object that you wish to update.


ReplacementValue is the variable containing the data that is to replace existing data.
Fieldno is a numeric expression that is the field number to be replaced.
ValueNo is an optional numeric expression that is the value number to be replaced.
SubValueNo is an optional numeric expression that is the subvalue number to be replaced.

REMARKS

The ReplacementValue can be either a jDynArray object or any other type of variable that can be coerced to a
string .
SELECT METHOD
Returns a jSelectList object that represents all the record keys in the file

COMMAND SYNTAX

Set jSelectList object = jEDIobject.Select()


Set jSelectList object = jDynArrayobject.Select()

JEDIobject is a variable of a jEDI object data type that represents the file that you are opening.
jSelectList object is a variable of jSelectList data type that will be set up to reference the created select list.
SORT METHOD
Sorts the elements of a jDynArray

COMMAND SYNTAX

jDynArrayobject.Sort

jDynArrayobject is the name of a jDynArray object that you wish to sort.

REMARKS

The SORT method will sort a dynamic array by the highest delimiter found in the array. This means that if the
jDynArrayobject contains multiple fields, it will sort by field; but if it contains only sub-values, it will sort by
sub-values.
TEXT METHOD
Converts jDynArray objects into text strings suitable for display

COMMAND SYNTAX

StringVar = jDynArrayObject.Text()

NOTES
The text method is especially useful for populating list boxes since each attribute is separated by a newline
sequence.
jSELECTLIST OBJECT
The Select method of the jEDI Object creates the jSelectList Object. It holds a list of record keys that the
Readnext method uses to supply the next record key.
ReadNext Method
Retrieves the next element from a jSelectList object

COMMAND SYNTAX

destvar = jSelectListobject.ReadNext

Destvar the name of a string that receives the element


JSelectListobject the name of a jSelectListobject to operate on

REMARKS

If there are no more elements in the list then ReadNext will return an error status.
WRITELIST METHOD
Stores a jSelectList in the jBASE work file

COMMAND SYNTAX
jSelectList object .WriteList Name

Name a string expression that evaluates to the name of the list to be written.
JSelectListobject the name of a jSelectListobject to operate on

REMARKS

By default, lists are saved in the jBASEWORK file.

ERROR HANDLING

Errors are reported using the standard OLE / ActiveX reporting technique.

REMARKS

All jBASE OBjEX methods return a standard result code to the calling program that indicates the success or
failure of the method and the cause any errors.
VISUAL BASIC
In Visual Basic the result, code is used to update the Err object and will cause certain actions to be taken
according to the use of the On Error statement.

If you don’t use an On Error statement, any run-time error that occurs is fatal; that is, an error message is
displayed and execution stops.

An “enabled” error handler is one that has been turned on by an On Error statement; an “active” error handler is
an enabled handler that is in the process of handling an error. If an error occurs while an error handler is active
(between the occurrence of the error and a Resume, Exit Sub, Exit Function, or Exit Property statement), the
current procedure’s error handler can’t handle the error. Control returns to the calling procedure; if the calling
procedure has an enabled error handler, it is activated to handle the error. If the calling procedure’s error handler
is also active, control passes back through previous calling procedures until an enabled, but inactive, error
handler is found. If no inactive, enabled error handler is found, the error is fatal at the point at which it actually
occurred. Each time the error handler passes control back to the calling procedure, that procedure becomes the
current procedure. Once an error handler in any procedure handles an error, execution resumes in the current
procedure at the point designated by the Resume statement.
jBASIC AND VISUAL BASIC GUIDE

This table is a cross reference between jBASIC Basic commands and the equivalent functionality in Visual Basic
using OBjEX. For each command that is applicable there is a reference to either a Visual Basic Intrinsic or to an
OBjEX method.

JBASIC Visual Basic with OBjEX

ABORT Stop/End

ABS() Abs()

ALPHA() Like

ASCII n/a

ASSIGNED() IsEmpty() / IsObject

BITCHANGE n/a

BITCHECK n/a

BITLOAD n/a

BITRESET n/a

BITSET n/a

BREAK Exit Do

CALL Call or to call a jBASIC Subroutine, Call Method

CASE Select Case

CHAIN n/a

CHANGE Change Method

CHAR() Chr()

CHDIR() ChDir

CHECKSUM() n/a

CLEAR n/a

CLEARFILE Clearfile Method

CLOSE Set = Nothing

COMMON jCommon

COL1() & COL2() Part of Field Method

COLLECTDATA n/a

CONTINUE n/a

CONVERT Convert Method

COS Cos()

COUNT() Count Method

CRT n/a

DATA n/a
DATE() Date Property

DCOUNT() DCount Method

DEBUG n/a

DEFC n/a

DEL Del Method

DELETE Delete Method

DELETELIST Deletelist Method

DIMENSION Dim

DTX() Hex()

EBCDIC() n/a

ECHO n/a

ENTER n/a

EQUATE #Const

EXECUTE Execute Method

EXIT() End

EXP() Exp()

EXTRACT Extract Method

FIELD() Field Method

FIND Find Method

FINDSTR FindStr Method

FOOTING n/a

FOR For

GETCWD() CurDir()

GETENV() Environ()

GETLIST Getlist Method

GOSUB Call()

GO(TO) GoTo

GROUP() Field Method

HEADING n/a

ICONV() IConv Method

IF If

IN n/a

INDEX() Index Method

INPUT n/a

INPUTNULL n/a

INS Ins Method

INT() Int() or Fix()


LEN() Len()

LN() Log()

LOCATE Locate Method

LOCK n/a

LOOP Do or While

MAT For Each or Erase

MATCH(ES) Like

MATBUILD Matbuild Method

MATPARSE MatParseDynArrays Method

MATREAD Read Method followed by MatparseDynArrays Method

MATREADU ReadU Method followed by MatparseDynArrays Method

MATWRITE Matbuild Method followed by Write Method

MATWRITEU Matbuild Method followed by Write Method

MOD() and REM() Mod()

NOT() Not

NULL n/a

NUM() Is Numeric()

OCONV() Oconv Method

ON . . . GOSUB On . . . GoSub

ON . . . GOTO On . . . GoTo

OPEN Open Method

OUT n/a

PAGE n/a

PERFORM Execute Method

PRECISION Precision Property

PRINT n/a

PRINTER
n/a
ON/OFF/CLOSE

PRINTERR n/a

PROCREAD n/a

PROCWRITE n/a

PROGRAM n/a

PROMPT n/a

PUTENV() n/a

PWR() ^ Operator

READ Read Method

READLIST Getlist Method


READNEXT Readnext Method

READT n/a

READU ReadU Method

READV ReadV Method

READVU ReadVU Method

REGEXP Like

RELEASE ReleaseLock Method and ReleaseAllLocks Method

REMOVE use Extract Method

REPLACE Replace Method

RETURN End Sub/Exit Sub

REWIND n/a

RND Rnd()

RQM n/a

RTNDATA n/a

SELECT Select Method

SENTENCE Command()

SEQ() Asc()

SIN() Sin()

SLEEP Call Sleep

SORT() Sort Method

SOUNDEX() n/a

SPACE() Space()

SQRT Sqr()

STOP Exit

STR() String()/(1st character only)

SUBROUTINE Sub

SYSTEM n/a

TAN() Tan()

TIME() Time Property

TIMEDATE() Now()

TRANSABORT TransAbort Method

TRANSEND TransEnd Method

TRANSQUERY TransQuery Method

TRANSTART TransStart Method

TRIM() Trim Method

TRIMB() Trim Method

TRIMF() Trim Method


UNASSIGNED IsEmpty()/IsObject

UNLOCK n/a

WEOF n/a

WRITE Write Method

WRITELIST Writelist Method

WRITET n/a

WRITEU WriteU Method

WRITEV WriteV Method

WRITEVU WriteVU Method

XTD() n/a

TRAPS AND PITFALLS


Some of the common problems encountered by Basic programmers migrating to VB and OBjEX

ERROR HANDLING
It is important to read the VB documentation and understand the way that errors are handled in Visual Basic. In
particular, when you disable the default error handler (which aborts the program) ensure that you can handle all
possible errors that can occur until you re-enable the default handler. One error to be particularly aware of is that
any attempt to access an uninitialized object reference will cause an error rather than a familiar message of the
form “Uninitialized variable - Zero Used”

Object References
Object variables that are declared in a VB program are just variables that can contain
references to objects. They are effectively uninitialized variables until they are set to reference
an object either as the result of a method on another object or as the result of a new operation.
Ensure you do not attempt to use them as source operands until they refer to an object that
actually exists.

THE SET STATEMENT


All references to objects have to be stored by the Set statement. If you omit the Set and create
just an assignment statement then VB will attempt to assign the current default value of the
object to the target variable.

EXAMPLE
Set MyDynArray = MyFile.Read(MyItemID)

Will refer to the jDynArray object that is created by the Read method If MyDynArray was referencing an object
prior to the Set statement then that object would be released if there were no other references to it.

MyDynArray = MyFile.Read(MyItemID)
Will assign the string value of the dynamic array to the MyDynArray variable if the MyDynArray actually
references an existing dynamic array then the existing data will be overwritten by the string data converted back
into a dynamic array. In effect the following will occur:

Set TempjDynArray = MyFile.Read(MyItemID) Creates a temporary object

TempString = TempjDynArray.Value() Takes string value of object

MyDynArray.Value = TempString Overwrites value with string

This may appear to be achieving the desired result but it will fail if the reference is null and is doing far more
work than it needs to.
NULL REFERENCES VS NULL DYNAMIC ARRAYS
A Basic program would typically initialize dynamic arrays to, and test for, the null value in many circumstances.
Using OBjEX , dynamic arrays are accessed through “references” that introduce a level of indirection creating
two possible ways of representing null dynamic arrays.

1. As a null reference.
Methods that return jDynArray Object references will return a null reference when they fail to obtain the
desired jDynArray (and cause an error). Code that tests for the existence of a record, for example, should use
the IsObject() function to check for null references rather than looking for null dynamic arrays. The Set
jDynArrayreference = Nothing statement should be used to set a reference to the null state.

2. as a reference to a jDynArray object with the value “.


Code that builds dynamic arrays from scratch should create the array using the new operator before accessing
it.

Set jDynArrayreference = New jDynArray

This statement will release the current object (if any), and create a jDynArray object and initialize it to the null
state.

COMPONENTS

File Description

OBjEX30.dll OBjEX dynamic link library

OBjEX30.tlb OBjEX type library

OBjEX30.gid OBjEX unique identifier

OBjEX30.hlp OBjEX help pages

OBjEX30.cnt OBjEX help contents


INTERNATIONALIZATION (I18N)

Implementing I18N
To use internationalization in the ObjEX, the following jBASE environment variables must be used.

• JBASE_I18N = 1

• JBASE_CODEPAGE=UTF-8

Setting these two variables will allow ObjEX to use UTF-8 characters in the jBASE database.
For example, if a Visual Basic program writes the French character ‘é’ (Character ‘0xE9’) to the database
through ObjEX, this would be stored in the underlying table as a UTF-8 Character string of ‘0xC3 0xA9’.

Using Markers in I18N mode


ObjEX is a COM component and ergo abides to the rules of COM technology. One of these rules states that
COM must use Unicode internally (as well as in the interface between the COM component and any
programming language used – e.g. Visual Basic). As Visual Basic is COM compliant, it uses Unicode internally.
Externally however, it does not use Unicode. When using the native controls (Text Boxes, Labels, List Boxes
etc..) and for any code written in the IDE, Visual Basic performs a Unicode to ASCII conversion. The front end
user is therefore forced to use ASCII and not Unicode. 1

Implementing an I18N compliant system means that the user must be able to use characters above the normal
ASCII range. Some of these characters are normally reserved as jBASE system markers specifically characters
248 to 255 (0xF8 to 0xFF).

Examine the following piece of code:

Dim MyDynArray as New jDynArray


Dim sAM as string

sAM = “þ” ‘CHR(254) Attribute mark


MyDynArray = “Att1” & sAM & “Att2”
If MyDynArray <> “Att1þAtt2”
Msgbox “Everything is OK”
Else
Msgbox “We Have Problems!”
End if

In previous versions of jBASE (and with the current version but I18N switched off), the above code would run
without any problems. However, with I18N mode switched on, the character ‘þ’ can no longer be used as an

1
This problem can be partially overcome by using the ‘Micorosoft Forms 2.0 Object Library’ (FM20.DLL)
which contains a set of standard controls (Text Box, Label etc..) that are Unicode compliant.
For further information about this, please refer to the Microsoft Knowledgebase article ‘HOWTO: Read and
Display Unicode strings on Visual Basic Form’ which can be found at :
‘http://support.microsoft.com:80/support/kb/articles/q193/5/40.asp&NoWebContent=1’
attribute marker as it may be a valid character in itself. Instead, the programmer is advised to only ever use the
routines supplied in the jBASE Object (AM,VM and SVM) and never use CHR(254/253/252) for system
markers. This is because ObjEX (in I18N Mode) does not use the character range 0xF8 to 0xFF as system
markers, but instead uses the character range 0xF8F8 to 0xF8FF (which are outside the range of any normal
text). These new characters are valid in Unicode and can therefore be used by Visual Basic. However, if at any
point the character is visually inspected (e.g “Debug.print jBase.AM”) then Visual Basic attempts to performs a
Unicode to ASCII conversion and converts these characters in to a question mark ‘?’2.

To implement the above code correctly for use in I18N and other modes, the following modifications should be
made.

sAM = jb.AM ‘Attribute mark which could be either 0xFE or 0xF8FE


MyDynArray = “Att1” & sAM & “Att2”
If MyDynArray <> “Att1” & jb.AM & “Att2”

2
The character actually becomes a question mark and not just displayed as a question mark.
MAPPING

Implementing a Mapping File


jBASE ObjEX now allows the mapping of characters. This means that a user can swap characters in ObjEX.
For Example, a user may swap the charcters ‘X’ and ‘V’ so that writing the string ‘XISION’ to the database
through ObjEX would actually result in ObjEX swapping the X’ character and the data ‘VISION’ being written
to the actual file.

The real advantage of Mapping is to allow the swapping of system markers. For example, if the character ‘þ’ was
required as data, the programmer could set up a mapping file to allow the characters ‘þ’ and ‘:’ to be wapped.

Imagine the following line of code: MyDynArray = “1þ1:2þ2:3þ3:4þ4”


Under normal circumstances, we would have the following:

MyDynArray .Extract(1) => 1 ‘Extract Attribute 1


MyDynArray .Extract(2) => 1:2 ‘Extract Attribute 2
MyDynArray .Extract(3) => 2:3 ‘Extract Attribute 3
MyDynArray .Extract(4) => 3:4 ‘Extract Attribute 4
MyDynArray .Extract(5) => 4 ‘Extract Attribute 5

However, with a mapping file to swap the characters ‘þ’ and ‘:’ would result in the following:

MyDynArray .Extract(1) => 1þ1 ‘Extract Attribute 1


MyDynArray .Extract(2) => 2þ2 ‘Extract Attribute 2
MyDynArray .Extract(3) => 3þ3 ‘Extract Attribute 3
MyDynArray .Extract(4) => 3þ3 ‘Extract Attribute 4

To use the mapping function in ObjEX, the following jBASE environment variables must be used.

• JBASE_OBJEX_MAPFILE = “c:\path\to\map\file.txt”

To check that a mapping file has been loaded, the new jConnection function ‘MappingFileLoaded’ will return a
value of ‘True’ if the file has been successfully loaded.

Notes
1. The mapping functions do not work when I18N is implemented as it is not required.
2. As with I18N mode, it is advised the AM/VM/SVM properties of the jBase Object be used instead of
chr(254/253/252)

Mapping File Format


The format of the mapping file should be:

#This is a comment line that will be ignored by jBASE ObjEX


#The next two lines swap the ‘þ’ and ‘:’ charcters
0x3A 0xFE
0xFE 0x3A

You might also like