JBASE OBJECT

Man Page Index


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 ease of 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")

 

METHODS

CHANGE METHOD

Returns a string with all occurences of a substring replaced with another.

 

SYNTAX

jB.Change( Source, FromString,ToString)
Source A string expression that evaluates to the string to be modified.
FromString A string expression that evaluates to the substring to be replaced
ToString A 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.

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.

 

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.

 

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.

 

SYNTAX

Object.Date()

REMARKS

The date is returned 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.

 

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 0, 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.

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 substring 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 jBC
statements "Field()", "Col1()", "Col2()" and Group()"

ICONV METHOD



Applies a jBase input conversion code to the supplied data.

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

 

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 0 if it is not found.

 

MATBUILD METHOD



Creates a jDynArray from an Array of Variants.

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.

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
code.

CONVERSION CODES

Conversion Action

D{n{c}} 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 character c causes the date to be returned in the
form ddcmmcyyyy. If it is not specified, the month name is returned in
abbreviated form.

DI Allows the conversion of an external date to the internal format
even though an 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.

DJ Returns the number of the day in the year (0-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.

F Given a prospective filename for a command such as CREATE-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 .

MC/A Removes all but the NON alphabetic characters in the input string.

MCN Removes all but numeric characters in the input string.

MC/N Removes all but NON 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.

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

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

MCNP{n} Performs the opposite conversion to MCPN. The ASCII
hexadecimal value 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.

Gncx Extracts x groups, separated by character c skipping n groups, from
the input 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.

 

SYNTAX

Object.Time()

 

REMARKS

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

 

TRIM METHOD

Returns a string with certain occurrences of a character removed.

 

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.

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.

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.


OBJEX
Copyright (c) 2001 TEMENOS HOLDINGS NV. All rights reserved.