Objectives
To understand the working of the jBase database and the directory structure of jBase.
To understand the environmental variables that control the jBase database
To understand the daemons that control the working of jBase
To understand the different types of files in jBase and the mechanism to create them.
To understand the jBase file resizing commands.
In a relational database you can link data from several different tables. Tables
are made up of records (tuples), which are further divided into fields. With a relational database,
you can normalize data. So for example if you have Customers and Orders you can establish a 1
to many relationships. One Customer can have many Orders and you can read the two files
together, linking them with a key. As such you only have 1 customer record, for all the orders with
that customer. This saves on inputting and maintenance time and on storage space. In a
relational database, fields are of a fixed length and each field can contain only 1 value.
jBase has a directory structure similar to that of Unix. Following are some of the
directories that get installed when jBase is installed.
jbase
bin Contains all the binary executables that make up the jBase system including the
compilers.
config contains various configuration files relating to the jPML daemon(discussed later
in this session), the configuration file for the creation of library files(Discussed in
the session ‘Infobasic Programming ‘) and other configuration files.
lib Contains the library files that are required for the working of jBase. This directory
contains all the libraries required for linking executing jBC compiled programs.
Shared or Dynamic libraries are also stored here.
tmp This is a general purpose temporary directory for runtime use.
jspooler This is the spool directory of jBase. It contains all the files that are required for
spooling to work in jBase
The jPML daemon is responsible for managing and licensing jBase processes
and ports. It registers and licenses jBase processes and allocates static or dynamic port
numbers. The jPML daemon also retains certain environment details. which can then be parsed
between related processes. The jPML daemon reads the configuration file, Config_jPML, from the
$JBCGLOBALDIR/config directory at startup time. This configuration file contains the ranges of
port numbers that the jPML daemon will allocate for processes running jBase background tasks,
and also for any jBase processes that it cannot allocate a relative port number. The configuration
file may also contain hard coded ttyname/port number entries. These entries will override any
other port number allocation scheme.
The configuration file also contains the text of the jBASE disconnect message and logon prompt
The lock arbiter is responsible for resolving all record locking conflicts for jBASE
processes. It runs in the background on your system and is commonly referred to as the lock
daemon1. If jRLA is not loaded, jBASE will use the normal UNIX system locks. This is acceptable
for small user populations, but the UNIX locking mechanism has limits on the number of locks
available, and on performance. Only enable the jRLA locking daemon when no other users are
executing jBASE programs, otherwise some applications will use UNIX system locks and others
will use the jRLA locking daemon. In most situations a process will take and release locks
autonomously and disregard both the lock daemon and other processes. However in certain
situations it must inform the daemon of events or ask the daemon for permission. These
situations only occur when there are clashes in locking such as when a process finds that a
record is already locked or that another process requires the same lock.
jRLA -ib
jPML –ib
jBTP –ib
jBTP –k
jPML –k
jRLA -k
5.1.1 JBCRELEASEDIR
It contains the path where jBase is installed. When jBase is installed, a link is
created for the directory where jBase has been installed to a file named jbc under the usr
directory. Therefore we can refer to /usr/jbc as the directory where jBase has been installed.
JBCRELEASEDIR = /usr/jbc
Example 1
ln –s /jbase /usr/jbc
A link is usually created to the directory where jBase has been installed in order to facilitate
smooth and convenient migration of users from one jBase environment to another. When users
who are currently working on one environment need to start working on another jBase
environment on the same server, then instead of changing the value of the environment variables
to point to the path of the other jBase environment, we could just remove the old link and make
the link point to the directory where other jBase environment resides. It is a convention to create
the link to /usr/jbc.
5.1.2 JBCGLOBALDIR
It contains the path of the Config directory (Discussed earlier in this section) of
jBase. jBase refers this variable when it needs to refer/read configuration files. Usually it points to
the same path as that of JBCRELEASEDIR as the config directory is present there.
JBCGLOBALDIR = /usr/jbc
It is a Unix variable used in jBase. In Unix, it contains the search path of Unix
executables. Here apart from containing the search path of Unix executables, it will also contain
the search path of jBase executables. As you would be aware, the bin directory under the
directory where jBase has been installed contains all the jBase executables. Therefore, this
variable would point to that bin directory.
PATH=$PATH:/usr/jbc/bin
Note that the search path of jBase executables has been appended to the
existing contents of the PATH variable.
5.1.4 LIBPATH
It contains the path of the jBase library files. As you would be aware by now, the
jBase library files are stored under the lib directory, which is under the directory where jBase has
been installed. Therefore this variable would point to that lib directory.
LIBPATH = /usr/jbc/lib
Note that the variable LIBPATH needs to be used only for AIX machines. Use
SHLIB_PATH for HP and LD_LIBRARAY_PATH for all other types of machines to store the path
of jBase executables.
5.1.5 JBCSPOOLERDIR
It contains the path of the spool files of jBase. As discussed earlier, the jspooler
directory under the directory where jBase has been installed holds all the spool files of jBase.
Therefore this variable would point to the jspooler directory.
JBCSPOOLERDIR=/usr/jspooler
5.1.6 JBCBASETMP
It contains the path of the jBase tmp directory. Every operating system and
database has its own tmp directory to store any temporary information. As mentioned earlier the
directory named ‘tmp’ that gets installed when jBase is installed is jBase’s tmp directory. It is the
decision of the system administrator whether to keep the tmp directory under the directory where
jBase has been installed or more it to a common location like /usr. In the first case, the tmp
directory becomes jBase release specific. All users working in that specific release of jBase would
be using that tmp directory. In the second case, irrespective of the release of jBase, which the
user is using, all of them will use a common tmp directory. In the below mentioned example, the
tmp directory has not been moved anywhere.
JBCBASETMP=/usr/jbc/tmp
Each jBase account has a vocabulary file called the VOC file. The VOC file
contains entries that identify every verb; sentence, paragraph, file, keyword, and menu that you
can use while you are in a jBase account. The command processor uses the VOC file to decide
what action to take when you enter a command.
The Voc (Vocabulary) file can also be called the MD, Master Directory
JEDIFILENAME_MD=$HOME/VOC
> LIST VOC WITH TYPE = “V” To see all the Verb Voc entries. You can also list the
Voc entries for the other entry types
For each VOC entry type run this command to list all
entries of that type, then use CT to look at them
CT VOC FBNK.CUSTOMER
FBNK.CUSTOMER Type of VOC entry. Denotes a file.
001 F Path of the data file with the actual truncated name
002 ../mbdemo.data/st/FBNK.CUST000
003 ../mbdemo.dict/F.CUSTOMER]D Path of the dict file with the actual truncated name
5.1.8 JBCLISTFILE
This is the environmental variable that contains the path of the &SAVEDLISTS&
directory. When a SELECT statement is issued from the database prompt, the output of the
SELECT statement can be saved using the SAVE.LIST command followed by the name of a file
that is to store the selected ids. This file created by SAVE.LIST will get stored under the
&SAVEDLISTS& directory and can be retrieved any time using the GET.LIST followed by the file
name.
Example:
>SAVE.LIST TEMENOS
501 record(s) saved to list 'TEMENOS'
>JED FBNK.CUSTOMER
The above JED command will open all the customer records that were selected using the SELECT
EMPLOYEE TABLE
In jBase, tables are referred to as files. Every file in jBase has two portions. The
DATA portion and the DICTionary portion. Unlike other databases, jBase stores
the data and the file structure separately. The actual data of a file (records) is stored in the DATA
portion of the file and the file structure(the fields and their definitions) are stored in the DICT
portion of the file. These two portions of the file may exist in the same physical location or could
exist in different physical locations.
For instance the CUSTOMER file in Globus would internally have 2 files. The
DATA file will have the name CUSTOMER and the DICT file would have the name
CUSTOMER.]D.
I. Non-hashed files
II. Hashed files
I. Non-hashed files
These files are nothing but UNIX directories. They are used store files /
programs. The file type for a non-hashed file is ‘UD’
Hashed files in jBase are used to store data files. All Globus data files are
hashed. Hashed files use Hashing algorithms to read and write data onto data files. Hashing
algorithms enable dynamic access (read and write) to data there by reducing the read and write
time. There are 2 types of hashed files namely, J3 and J4. The data portion of all hashed files are
divided into groups called ‘Modulos’. The default size of one modulo if it is a J3 type hashed file is
1024 bytes and if it is a J4 type hashed file it is 4096 bytes. All Globus hashed files are of type
J4.The size of the modulo is determined by ‘Separation’. Both modulo and separation are
specified for the DATA and the DICT portion of a file.
For instance, while creating a hashed file, if we specify the modulo as 4 and the
separation as 4 for both the DATA and the DICT portion of the file then the following will be the
layout of the file
Example 1
Dict Modulo : 3
Dict Separation : 2
Dict Secondary Buffer Size : 3
Data Modulo : 4
Data Separation : 3
Data Secondary Buffer Size : Default
Solution 1
Note :
When no value is supplied for the secondary buffer size like above then the default
value of 2 is taken.
Output
Example 2
Solution 2
Output
As you would be aware, a badly sized file will result in low performance of the
system. Therefore it is absolutely necessary to resize files periodically.
7.1.1 jstat
jstat is the command in jBase that is used to determine the statistics of a hashed file.
Example 1
jstat FBNK.ACCOUNT
Output
File ../mbdemo.data/ac/FBNK.ACCOUNT
Type=J4 , Hash method = 4
Groups = 9,Frame size = 4096 bytes ,Secondary Record Size = 8192 bytes
Record Count = 2001 , Record Bytes = 775029
Bytes/Record = 387 , Bytes/Group = 86114
Primary file space: Total Frames = 196 , Total Bytes = 775029
Secondary file space: Total Frames = 0 , Total Bytes = 0
Analysis
Find below the line by line analysis if the above output of jstat.
Line 1 : Displays the relative path of the file with the actual name of the file. Files could have
truncated names because of file name length restriction imposed by Unix.
Line 2 : Displays the type of the file (J3/J4). The default hash method for all jBase hashed files is
4, which is what is specified in ‘Hash Method’.
Line 3 :
Groups : Represents the modulo of the file when it was created
Frame Size : Represents the size of 1 modulo. Here the size of 1 modulo is 4096bytes
therefore the separation would have been 1 when the file was created, as it is a J4 file.
Secondary buffer size : Represents the size of the secondary buffer size. The value is
8192Bytes which is twice the size of 1 modulo. Therefore when the file was created the
secondary buffer size specified would have been 2.
When the file was created it was created as a J4 file with modulo 9, separation 1 and
secondary buffer size as 2.
Line 4 :
Record Count : Specifies the total number of records in the file at present
Record Bytes : Specifies the total number of bytes occupied by the file at present
Line 5 :
Total Frames : If this contains a value greater than the original modulo of the file then it
denotes that the file is badly sized and needs resizing. In this example, when the file was
created, it was created with a modulo of and ‘Total Frames’ now shows a value of 196.
This file needs to be resized. In the above example a value of 196 in ‘Total Frames’ does
not mean that the number of modulos have increased automatically. Any extra space
occupied by the file to hold its data is converted in terms of modulos and specified here.
Total Bytes : Specifies the total space occupied by the file in terms of bytes.
Following are the options that can be used along with jstat.
Example 2
jstat –r FBNK.ACCOUNT
Shows modulo wise data split of data. In this example, though the size of 1
modulo is only 4096 Bytes, each modulo seems to occupy more than 8000 Bytes of data. This
denotes a sure overflow of data and denotes the fact the file needs resizing.
Output
File ../mbdemo.data/ac/FBNK.ACCOUNT
Type=J4 , Hash method = 4
Groups = 9 , Frame size = 4096 bytes , Secondary Record Size = 8192 bytes
7.1.3
jrf
Example 1
Resize the FBNK.ACCOUNT file (discussed in the above examples) to avoid any
overflow of data.
Analysis
When deciding the modulo, the number of records that might get into the file on
an average need to be kept in mind and then calculated. In this case we could assume that this
Note :
A large separation could result in low performance as the hashing algorithms that are
used to store and retrieve data would only specify the modulo in which the record that is
requested (during a read) is present. Inside the modulo it is always a sequential search.
Therefore a huge separation will result in low performance. To determine the separation, the
average size of a record should be kept in mind.
Solution 1
The –S option with jrf is used to specify the new modulo for the file. Please note
that to resize the file the actual name of the file with the relative path (relative to the home
directory) of the file needs to be given. The relative path of the file and the actual name of the file
can be obtained from the output (1st line) of the jstat command.
Following are the options that can be used with the jrf command.
Note :
When using the D and the E option to downsize and resize empty file respectively they
need to be used in conjunction with the S option as follows
jrf –DS# filename
jrf –ES3 filename
Summary
Additional Information
VOC Entries
> CT VOC LIST Display the Voc entry for the verb LIST
V Descriptor
LIST Processor. (Name of the programme executed)
Q Dispatch Type. (Type of programme: Q=query)
S Processor Mode (Required setup: S = user select)
Reserved
Refer the ‘jGlobus’ course material for additional information and information
about installation of jBase, patch installation, printing in jBase, locking in jBase etc.