Jobjex
Jobjex
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.
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:
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
UPPERCASE Italic In syntax, italic indicates information that you supply. In text,
italic also indicates UNIX commands and options, filenames,
and pathnames.
Courier Bold Courier Bold In examples, courier bold indicates characters that
the user types or keys (for example, <Return>).
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.
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:
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
REMARKS
This method returns a modified string it does not update the source string.
CONNECT METHOD
Connects to a jBASE Database
COMMAND SYNTAX
COMMAND SYNTAX
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
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
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
COMMAND SYNTAX
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
COMMAND SYNTAX
Position = jB.Index(Source,SubString,Occurrence)
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
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
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
Allows the conversion of an external date to the internal format even though an
DI
output conversion is expected.
MCA Removes all but alphabetic characters from 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.
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.
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.
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
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
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
COMMAND SYNTAX
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
Part Description
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
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
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
COMMAND SYNTAX
Part Description
destvar the name of a Variant that receives the data from the Conversion.
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
COMMAND SYNTAX
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
Part Description
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
COMMAND SYNTAX
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
COMMAND SYNTAX
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
COMMAND SYNTAX
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
COMMAND SYNTAX
Part Description
REMARKS
COMMAND SYNTAX
jEDIobject.ReleaseAllLocks()
Part Description
jEDIobject a variable of a jEDI object data type that represents the file.
RELEASELOCK METHOD
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
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
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
COMMAND SYNTAX
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
COMMAND SYNTAX
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
COMMAND SYNTAX
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
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)
COMMAND SYNTAX
jDynArrayobject.Del Fieldno[,ValueNo[,SubValueNo]]
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
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]])
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]])
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 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
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:
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
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]]
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
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
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
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
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.
ABORT Stop/End
ABS() Abs()
ALPHA() Like
ASCII n/a
BITCHANGE n/a
BITCHECK n/a
BITLOAD n/a
BITRESET n/a
BITSET n/a
BREAK Exit Do
CHAIN n/a
CHAR() Chr()
CHDIR() ChDir
CHECKSUM() n/a
CLEAR n/a
COMMON jCommon
COLLECTDATA n/a
CONTINUE n/a
COS Cos()
CRT n/a
DATA n/a
DATE() Date Property
DEBUG n/a
DEFC n/a
DIMENSION Dim
DTX() Hex()
EBCDIC() n/a
ECHO n/a
ENTER n/a
EQUATE #Const
EXIT() End
EXP() Exp()
FOOTING n/a
FOR For
GETCWD() CurDir()
GETENV() Environ()
GOSUB Call()
GO(TO) GoTo
HEADING n/a
IF If
IN n/a
INPUT n/a
INPUTNULL n/a
LN() Log()
LOCK n/a
LOOP Do or While
MATCH(ES) Like
NOT() Not
NULL n/a
NUM() Is Numeric()
ON . . . GOSUB On . . . GoSub
ON . . . GOTO On . . . GoTo
OUT n/a
PAGE n/a
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
READT n/a
REGEXP Like
REWIND n/a
RND Rnd()
RQM n/a
RTNDATA n/a
SENTENCE Command()
SEQ() Asc()
SIN() Sin()
SOUNDEX() n/a
SPACE() Space()
SQRT Sqr()
STOP Exit
SUBROUTINE Sub
SYSTEM n/a
TAN() Tan()
TIMEDATE() Now()
UNLOCK n/a
WEOF n/a
WRITET n/a
XTD() n/a
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.
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:
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.
This statement will release the current object (if any), and create a jDynArray object and initialize it to the null
state.
COMPONENTS
File Description
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’.
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).
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.
2
The character actually becomes a question mark and not just displayed as a question mark.
MAPPING
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.
However, with a mapping file to swap the characters ‘þ’ and ‘:’ would result in the following:
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)