Jbase Editor
Jbase Editor
This learning
unit will help you to work with JR files
•Describe JR files
•Analyze the features of JR files
•Create a JR file
•Describe the header information of a JR file
•Analyze how to read and write records in a JR file
•Explain INTMODS
•Create a huge record
•Analyze the purpose of MINSPLIT
•Health check utility for JR files
•Analyze the environment variables related to CREATE.FILE command
1. Use the command CREATE.FILE to create the file. Following the CREATE.FILE
command, you will specify the file name. In this example the file name is
TRAINING.JR. The file name will be followed with the file type. To create a
resilient file, the file type will be JR.
1.2 On executing the command, a data file and a dict file will get created. The
name of the data file is TRAINING.JR and name of the dict file is
TRAINING.JR]D. Creating a JR file is similar to creating any other type of
file in jBASE.
2. After creating the JR file TRAINING.JR, if you check the size of the file, it will be
4096 bytes. Yes, on creating a JR file, jBASE will allocate only 4k of space for the
file. In the coming few slides, you will learn what is the purpose of this 4k space is
and also how a JR file grows.
When a JR file is created, the initial size of the file is 4k. This 4k (4096 Bytes) is meant
for the header of the file.
File Path : Holds the full path and the name of the file
File Type : JR signifies that the file is a resilient file
Hash Method : Default hash method for JR files is 5. This will tell you the hashing
algorithm being used for this file. There are many hashing algorithm available.
Created : Holds the date and time when the file was created
Frame size : Size of a frame that will be created to hold data
jBASE maintains an internal table to store pointers to data frames that it creates. The
first internal table is referred to as 'Group 0' and will contain 3 internal modulo to
store pointer information. When a record needs to be inserted into the file, jBASE
calculates a hash value based on the ID of the record. Since there are 3 modulo
available in 'Group 0', jBASE will return a value in the range 1 to 3. Based on the
value returned, the appropriate modulo in 'Group 0' is locked. A data frame of size
4096 Bytes is created and the record is placed there. The address of the data
frame is written on to the locked modulo. Lock on the modulo is then released.
Record Bytes : Holds the size of the records in the file at present. In this case, holds
the size of the 1st record that was input
Record Count : Holds the number of records in the file. In this case, it is one.
Bytes/Record : Holds the average size of a record. Since there is only one record in
the file now, the ‘Record Bytes’ and ‘Bytes/Record’ are the same
Bytes/Group : Size of each data frame.
Data Frames : Holds the number of data frames allocated. This is the most crucial
point to understand. To store the one record that we input, a data frame of size 4096
bytes has been allocated. Note that space gets allocated as and when required and
not at the time of creating the file like J4 files.
By now you should understand that for each internal modulo one data frame will be
created as and when required.
Like J4 files, data will always be evenly spread and stored across data frames pointed
by internal hash table ('Group 0'). Since there are 3 internal modulo in group 0,
there can be a maximum of 3 data frames at this level. Each data frame can
contain data (records) up to the size of 4096 bytes. Each internal modulo holds
pointers to its data frame. As you would have noticed, data frames get created as
and when required and not at the time when the file is created. As you can see,
there is no upper limit for the file size. We haven’t specified any file size until now.
The statistics say that till now ten records have been stored in the JR file and up to
three data frames have been used.
Now that you have understood how records are stored in the JR files. Now let us see
what happens when records are deleted from a JR file.
2. Now delete a record from the file. The command to delete records from a file is
DELETE. This command is followed by the file name and then the record id. In our
example , the command will be DELETE TRAINING.JR 1
3. Now check the size of the file again. If you notice the file size would not have
changed. In jBASE, once space is allocated for a file, it will not be de-allocated on
deleting any record.
The value of Data Frames is 6. As you already know that it contains the number of
frames that actually contain data. In our example, two frame belongs to ‘Group 0’ and
four frame belongs to ‘Group 1’.
If you take a look at the Record Count you now have eight records in the file.
The Free Space contains the value one to denote the data frame that initially
contained data has now been marked as free for future use. This is the data frame
whose data has been rehashed into four new data frames.
'Group 1': When the data frames pointed by the first hash table became full, the data
frames were re-hashed and a second set of internal hash table were created with
seven modulo each.
'Group 2': Likewise, when the data frames pointed by the second hash table became
full, the data frames were re-hashed and a third set of internal hash tables were
created with 19 modulo each.
Data Frames : There are 12 data frames that contain data now
Record Count : We have 17 records in the file now
Free Space : There are no free frames now. The data frame that was marked as free
has now been used by jBASE and hence the value ‘0 frames’
2. Similarly, when data cannot be fit into the frames that belong to ‘Group 1’, data
will be re-hashed into data frames of ‘Group 2’
2.1 Maximum data frames that can exist at ‘Group 2’ level is 19 for each of the
7 ‘Group 1’ internal modulo
This slide represents data frames that can get created for internal hash table 'Group 2'
and shows linkages only for the first part
Once data frames for 'Group 2' modulo have been created you can have unto a
maximum of 399 data frames each of size 4096 bytes. That is 3 * 7 * 19 = 399 data
frames. File Size would be 399 frames * 4096 Bytes = 1634304 Bytes.
Note : The above command has been executed on Windows to state the fact that JR
files work the same on Windows as well as Unix
P1, P2 and P3 represent pointers to data frames 1, 2 and 3 respectively. Each OOG
Frame will be of size 4096 bytes like other data frames. Depending on the size of the
record, required number of OOG frames get created and data is split and stored
across these OOG frames. When data is stored in more than one OOG frame, the
OOG frames maintain pointers to the other OOG frames that have been created to
store the record (Like a link list)
The OOG Frames value you see above get marked to 0 to denote that there are no
OOG frames for the file now
Frames allocated to a JR file are never de-allocated unless the file is deleted. The
OOG frames have now been marked as free frames for re-use
Compare the size of the file on disk with the screen shot in the previous slide. Note
that the size on disk is not the same in both
In the screenshot shows the result of jrscan on FBNK.SECTOR. This file has 45
records with 3 data frames.
Remember that value specified in this variable takes more precedence over the value
supplied in command line for the CREATE.FILE command.
1. This variable is the same like JEDI_PREFILEOP, If you set some value to the
environment variable JEDI_POSTFILEOP, it gets defaulted while using the
CREATE.FILE command. But you should remember that value specified in this
variable can be overridden using the CREATE.FILE command.
2. Let us understand this with an example.
1.1 Set a value “TYPE=JR LOG=NO” to this variable, you can use the
command export JEDI_POSTFILEOP = “TYPE=JR LOG=NO” if you are
working on UNIX.
3. Now create a file using the CREATE.FILE command followed by a file name,
also specify the file type as J4. Let us consider for example CREATE.FILE
TRAINING.TEST TYPE=J4 1 1
2.1 Now check if you have got the values set in the environment variable. Use
the jstat to do this. If you notice, though you have set JEDI_POSTFILEOP
to TYPE=JR, the file type of the file you created just now is J4, this is
because you have given TYPE=J4 in the CREATE.FILE command. As
already said, the value specified in the CREATE.FILE command takes
more precedence when compared to the variable JEDI_POSTFILEOP
Backup: When set to YES, file will be backed up when the jbackup command is
executed, the default value is YES. You can change this value by issuing the
command jchmod +B <File Name> to grant and jchmod –B <File Name> to revoke
backup feature.
Log: When set to YES, any DML (Data Manipulation Language) on the file will be
recorded by jBASE Transaction Journaling, provided jBASE Transaction Journaling is
started. Its default value is YES. You can change this value by issuing jchmod +L
<File Name> to grant and jchmod –L <File Name> to revoke log feature.
Rollback: The Rollback flag indicates if a file is subject to transaction boundaries. Its
default value is YES. If unset, it will have an impact on the way jBASE Transaction
Journaling journals data. To grant Rollback use the command jchmod +T <File
Name> and to revoke use the command jchmod –T <File Name>
Network: It is set for files that are NFS mounted so that jBASE can place byte locks
on them. Its default value is NO. It is not used by JR files as JR files use jDLS for
locking. Applicable only for J4 files. The command to grant this feature is jchmod +N
<File Name> and to revoke the command is jchmod –N <File Name>.
Secure: The file is flushed at critical junctures such that any file update will rely only
on a single disk write. This maintains the file structure in the event of system failure.
Set so that file structure never gets corrupt. Its default value is NO. It is applicable only
to JR files. It can affect performance if set. The command to grant this feature is
jchmod +S <File Name> and to revoke it is jchmod –S <File Name>
•Describe JR files
•Analyze the features of JR files
•Create a JR file
•Describe the header information of a JR file
•Analyze how to read and write records in a JR file
•Explain INTMODS
•Create a huge record
•Analyze the purpose of MINSPLIT
•Health check utility for JR files
•Analyze the environment variables related to CREATE.FILE command