The Graphical Object Tab Page

Main Characteristics of the Graphical Objects Tab Page

The Graphical Object Tab Page shows the hierarchy of the objects currently open in the GUI Designer.

In the Tree View, primary user interface objects, such as formsdisplays and menus, appear as top nodes.

Forms are the only children of displays

All other objects

 

 

 

The Database Tab Page

Main Characteristics of the Database Tab Page

 

The Database Tab Page displays all databases currently connected to the current session of Zim IDE.

Each connected database is represented as an expandable node containing all possible database object categories.

Each object category is also represented as an expandable node containing all objects of that category in the database.

To edit an object, right-click on its name to open it in the GUI Designer workspace;

To create an object, right-click on the category of the object you wish to create and enter the required information in the New Object Dialog;

 

 

Zim IDE Components

The Organization of Zim IDE

Zim IDE consists of eight separate visual components distributed within five different panels. Some panels are occupied by two different visual components, of which only one is displayed individually when selected by the designer.

The visual components of Zim IDE and their respective display panels are introduced below:

 

ComponentDisplay Area
Menu Area
Left Panel
Left Panel
Central Panel
Central Panel
Right Panel
Right Panel
Field View Panel

 

The following images show how the different areas of the Zim IDE fit together during the user interface design process:

Example 1: Connected databases and the structure of objects

In this image, the form fExample_Zim9 is being edited in the GUI Designer workspace, while the database Example_Zim9 + localhost are connected to this Zim IDE session as shown in the database tab page. the form opened in the GUI designer (fExample_Zim9) are shown in the Tree View Tab Page on the right, along with their respective fields.

 

 

Example 2: Form field attributes and objects available in the Tool Box tab page

In this image, the form fExample_Zim9 is being edited in the GUI Designer workspace. A Push Button is currently selected and its attributes are shown in the Attributes Tab Page. The Tool Box Tab Page is also visible, showing the available user interface objects that can be added to the form.

 

 

The Document Editor

Main Characteristics of the Document Editor

The Document Editor is where documents such as Zim programs, database parameters and configuration files are viewed and edited.

It occupies the same area as the GUI Designer

it offers syntax highlighting customized for the Zim programming language.

Documents can be opened and edited directly from the Database Tab Page:

Click on the Documents node under one of the connected databases and select the document you wish to open and edit.

 

 

 

 

The Menu Tool Bar

Main Characteristics of the Menu Tool Bar

The Toolbar contains shortcuts to menu items that are frequently used.  There are icons for the following menu items:

The Menu Tool bar is divided into the following menu areas:

The Main Menu

Contains file operations: NewOpenSaveSave As and Close.
Contains edit operations: CutCopyPaste.
Enable or Disable the Field View.
Enables the Preference Menu and the Test View.
Shows the Windows Menu.
Connects to the Online Help Library.

File

Edit

View

Tools

Windows

Help

The File Menu

Create a new object.
Save the current object.
Save all recently modified objects currently open.
Connect to another instance of a Zim database. Multiple simultaneous connections are supported.
Print the window, form or display currently open in the GUI Designer.

The Edit Menu

Undo the last action.
Redo the last undone action.
Cut the current selected object from the GUI Designer and place it on the clipboard.
Copy the current selected object from the GUI Designer and place it on the clipboard.
Paste the contents of the clipboard into the GUI Designer workspace.
Delete the selected object from the GUI Designer workspace.

The View Menu

Display the Properties Tab Page
Display the Tool Box Tab Page
Display the existing objects in all currently connected databases in the Database Tab Page
Display the Graphical Objects Tab Page
Display the Message Output Tab Page
Display the FieldView Tab Page
Display Start Page Tab Page

Tools

Display Internet Tab Page
Display Query Database Tab Page
Display Preferences Tab Page
Display Test Mode Tab Page

Windows

Float Tab Page
Dock Tab Page
Tab Page Auto Hide
Tab Page Auto Hide All
Tab Page Hide
Tab Page All Document Windows

Help

Zim Databases Canada website Tab Page
Zim Developer Library
Check for Update Zim
About Zim Development Environment

The Alignment Menu

Left align all currently selected objects with the first object that was selected.
Right align all currently selected objects with the first object that was selected.
Top align all currently selected objects with the first object that was selected.
Bottom align all currently selected objects with the first object that was selected.
Vertically align all currently selected objects with the first object that was selected.
Horizontally align all currently selected objects with the first object that was selected.
If multiple objects are overlapping, the currently selected object is brought to the top of the stack.
If multiple objects are overlapping, the currently selected object is pushed to the bottom of the stack.
Horizontally spaces multiple selected objects evenly apart.
(Ctrl + left arrow) Slightly increases the horizontal space between multiple selected objects.
(Ctrl + right arrow) Slightly decreases the horizontal space between currently selected objects.
Vertically spaces multiple selected objects evenly apart.
(Ctrl + up arrow) Slightly increases the vertical space between multiple selected objects
(Ctrl + down arrow) Slightly decreases the vertical space between multiple selected objects.
Sets multiple objects to the same width as the first object that was selected.
Set multiple objects to the same height as the first object that was selected.

The Search Menu

Find all objects in the current database by name
Find Previous
Find and Replace
Toggle Bookmark
Next Bookmark
Previous Bookmark
Clear Bookmark

 

File Management and Distribution

Zim uses the operating system’s file management system to store entity sets, relationships, programs (source and compiled), database definitions, ZIM directories, and work files. By default, all files are stored in the same area of your file system. You can however, change the locations of the various types of files by, for example, moving the files to different disks, to improve the performance of your application. Zim provides methods for controlling the files that it uses.

 

Zim Server Performance Tuning

To optimize Zim Server performance, it’s crucial to fine-tune the configuration settings in the zimconfig.srv file. Here are detailed technical guidelines for each of the three key factors:

1. Maximize Shared Memory Usage

  • Buffers and Areas Allocation: Increase the number of buffers and areas allocated in shared memory. This reduces the need for frequent memory allocation and deallocation, which can be costly in terms of performance.
    • Configuration Options:
    • SHARED_MEMORY_BUFFERS: Set this to a high value to ensure ample buffer space.
    • SHARED_MEMORY_AREAS: Increase this to allow more areas to be stored in shared memory.
    • Example: ini
      SHARED_MEMORY_BUFFERS=1024
      SHARED_MEMORY_AREAS=256

2. Balance Shared Memory Usage

  • Avoid Over-Allocation: While maximizing shared memory usage is beneficial, it’s important not to exceed system-defined limits. Over-allocating can lead to overheads, such as increased context switching and memory paging, which degrade performance.
    • Configuration Options:
    • MAX_SHARED_MEMORY: Set this to a value that balances usage without exceeding system limits.
    • SHARED_MEMORY_THRESHOLD: Define a threshold to prevent over-allocation.
    • Example: ini
      MAX_SHARED_MEMORY=2048MB
      SHARED_MEMORY_THRESHOLD=80%

3. Reduce Input and Output Operations

  • Minimize I/O Operations: Excessive I/O operations can significantly slow down the server. Optimizing these operations can lead to substantial performance improvements.
    • Configuration Options:
    • IO_OPERATION_LIMIT: Set a limit on the number of I/O operations.
    • CACHE_SIZE: Increase the cache size to reduce the frequency of I/O operations.
    • Example: ini
      IO_OPERATION_LIMIT=1000
      CACHE_SIZE=512MB

Additional Tips

  • Monitoring and Tuning: Regularly monitor the performance metrics of your Zim Server and adjust the configuration settings as needed. Tools like top, htop, or custom monitoring scripts can help you keep track of memory usage and I/O operations.
  • Documentation and Support: Refer to the official Zim Server documentation for detailed descriptions of each configuration option. If you encounter issues, consider reaching out to the Zim Server support community for advice and best practices.

By carefully adjusting these settings, you can achieve a well-balanced and high-performing Zim Server environment.

Checkpoint Buffers and Checkpoint Transactions

These options define the size of the checkpoint file, which is either the number of blocks or transactions that Zim Server will process before physically committing to disk. Both options refer to transactions that were effectively committed, meaning transactions that successfully finished.

Key Concepts

  1. Optimized Checkpoint Mechanism: Zim Server’s checkpoint mechanism ensures that only the last occurrence of a block is written to disk. This means that larger checkpoint files can lead to more efficient performance due to reduced input and output operations.
  2. Balancing Checkpoint Size: While larger checkpoint files can improve efficiency, they also mean that Zim Server will spend more time processing blocks and less time handling ongoing transactions. Additionally, larger checkpoint sizes can lead to longer wait times before the checkpoint file is produced and committed to disk.

Configuration Guidelines

To achieve optimal performance, it’s important to balance these options based on the size of your database and the number of users.

Small Databases

For small databases or a small number of users, use the following settings:

checkpoint buffers = 1000        # Small checkpoint file
checkpoint transactions = 100000 # Unlikely to reach this limit
  • Explanation: These settings instruct Zim Server to update the database files after 1000 blocks are committed or after 100000 transactions are committed. Given the low activity, the 1000 blocks threshold will be reached frequently, ensuring efficient performance despite frequent checkpoints.
Large Databases

For larger databases or higher user activity, use these settings:

checkpoint buffers = 10000       # Medium size checkpoint file
checkpoint transactions = 100000 # Unlikely to reach this limit
  • Explanation: These settings will result in less frequent checkpoints due to the higher block threshold, but the increased database activity will still ensure efficient performance.
Further Tuning

For even larger databases, consider increasing the checkpoint buffers value further:

checkpoint buffers = 50000       # Larger checkpoint file
checkpoint transactions = 100000 # Unlikely to reach this limit
  • Explanation: Testing different values can help you find the optimal configuration for your specific use case. Larger values for checkpoint buffers can lead to improved performance by reducing the frequency of checkpoints, but it’s important to monitor and adjust based on actual performance metrics.

Conclusion

By carefully adjusting the checkpoint buffers and checkpoint transactions settings, you can optimize Zim Server performance for both small and large databases. Regular monitoring and testing different configurations will help you achieve the best balance for your specific environment.

Maximum Data Blocks

This option specifies the number of data blocks that Zim Server will keep in shared memory simultaneously. It significantly impacts Zim Server efficiency by optimizing the number of input and output operations. The larger this option, the more efficient Zim Server will be. However, it requires a substantial amount of shared memory. If insufficient real memory is available, the operating system will start swapping, which can drastically reduce performance.

Maximum Databases

This option determines how many Zim databases will be processed concurrently. The default is 3, but reducing this number to the minimum necessary will decrease the amount of shared memory required.

Maximum Tables

This option indicates the number of Zim tables (entity sets and relationships with fields) that will be processed across all databases. Keeping this number as low as possible will minimize shared memory usage.

Maximum Users

This option sets the maximum number of users allowed to connect to Zim Server, up to the number of Zim licenses purchased. Reducing this number to the minimum needed will conserve shared memory.

Object Sleep, Object Timeout, Pending Sleep, and Pending Timeout

These parameters define the wait and timeout durations when attempting to acquire various Zim Server internal objects. Lower values result in faster reactions to resolve issues (usually by deadlocking), allowing other users to proceed. Use the suggested values in the configuration files below.

Scatter Table Entries

This option specifies the maximum sizes of transactions in blocks that all users connected to Zim Server can perform simultaneously. If there are 10 users connected but only 5 performing transactions, only these will count. For example, if the average number of blocks processed is 500, the number of entries used will be 2,500. Once a transaction is finished, all entries used in that transaction are released. This number cannot be smaller than Scatter Table Links. A good approach is to calculate 3 to 5 times that number.

This option sets the maximum size for a transaction in blocks, allowing transactions to process different blocks of data up to this limit. For instance, an ADD statement creating a very large Zim file (e.g., 500 MB) will require this parameter to be at least 500,000. However, such commands are not common daily, suggesting a specific configuration for large operations. The larger this number, the more efficient Zim Server will be. A good reference is to multiply Maximum Data Blocks by two or three. This parameter cannot be smaller than Maximum Data Blocks.

Configuration Files

Small Size Database Configuration File

blocks per read = 8
buffers per user = 1000
checkpoint buffers = 1000
checkpoint transactions = 100000
datablock timeout = 1
files per transaction = 20
first file to reclaim = 100
maximum blocks per user = 2000
maximum data blocks = 20000
maximum databases = <number>
maximum file locks = 200
maximum locks = 10000
maximum record groups = 2000
maximum tables = <number>
maximum users = <number>
object sleep = 1
object timeout = 1
pending sleep = 5
pending timeout = 5
processors = 1
quick locks = 10
reclaim object size = 1000
record group size = 256
scatter table entries = 70000
scatter table links = 50000
scatter table size = 100
secondary lock group size = 20
secondary lock groups = 7500
server port number = 6002

Medium Size Database Configuration File

blocks per read = 8
buffers per user = 1000
checkpoint buffers = 10000
checkpoint transactions = 100000
datablock timeout = 1
files per transaction = 20
first file to reclaim = 100
maximum blocks per user = 2000
maximum data blocks = 50000
maximum databases = <number>
maximum file locks = 200
maximum locks = 10000
maximum record groups = 2000
maximum tables = <number>
maximum users = <number>
object sleep = 1
object timeout = 1
pending sleep = 5
pending timeout = 5
processors = 1
quick locks = 10
reclaim object size = 1000
record group size = 256
scatter table entries = 150000
scatter table links = 100000
scatter table size = 100
secondary lock group size = 20
secondary lock groups = 7500
server port number = 6002

Large Size Database Configuration File

blocks per read = 8
buffers per user = 1000
checkpoint buffers = 50000
checkpoint transactions = 100000
datablock timeout = 1
files per transaction = 20
first file to reclaim = 100
maximum blocks per user = 2000
maximum data blocks = 100000
maximum databases = <number>
maximum file locks = 200
maximum locks = 20000
maximum record groups = 4000
maximum tables = <number>
maximum users = <number>
object sleep = 1
object timeout = 1
pending sleep = 5
pending timeout = 5
processors = 1
quick locks = 10
reclaim object size = 1000
record group size = 256
scatter table entries = 800000
scatter table links = 250000
scatter table size = 100
secondary lock group size = 20
secondary lock groups = 7500
server port number = 6002

By carefully adjusting these settings, you can optimize Zim Server performance for different database sizes. Regular monitoring and testing different configurations will help you achieve the best balance for your specific environment.

Foreign Directories

Each Zim database has its own object dictionary. All objects (i.e. entity sets, forms, variables, and so on) that are described in the object dictionary are created in a Zim directory. Normally, an application developer creates the Zim directories that are used within one particular database. A foreign directory, on the other hand, is a Zim directory that is defined by one database, but is used by other databases. By accessing a foreign directory, you gain access to all objects created in that directory.

Why Use a Foreign Directory?

There are many situations in which a foreign directory can be useful. One common example is the toolbox, a database containing application programs that are useful in, and therefore shared among, many different databases.

For example, while developing an application, you might have created a directory containing utility programs. These utilities could be useful in other situations, but you do not want to re-create them for each new database. By following the procedures described below, the utility directory can be defined as foreign in the other databases. The directory can then be used in databases other than the one in which it was created.

How Foreign Directories are Used

The procedure described below is an overview of how foreign directories are used. The remainder of this section describes this in more detail.

In general, the use of a directory from one database (the host database) within another database (the connecting database) involves five steps:

  1. In the Object Dictionary of the host database, define the target directory, including a special directory ID number. Create the directory, using the CREATE command.
  2. In the Object Dictionary of the connecting database, define the target directory again. This definition should be identical to that in the host database, except that the directory should be defined as foreign.
  3. In the connecting database, create the directory, using the CREATE command.
  4. At the operating system level, switch to the operating system directory that contains the connecting database. Use your text editor to edit the foreign directories file (called dirs.zim), adding an entry that gives the location of the foreign directory within the file system. You can also use the “Update Dirs.Zim” button on the Directories window in DC to edit the file directly.
  5. Return to Zim and the connecting database. Use the ACCESS command to access the foreign directory.

 

Note: A connecting database can access many foreign directories simultaneously, provided each directory has a unique directory ID number (dirID). A single directory can be accessed as a foreign directory simultaneously by many databases.

 

Note2: If a single ZimServer manages different databases and at least one of them has foreign directories, all directories, local or foreign, must have unique dirID across all databases.

Defining a Foreign Dictionary – Detailed Description

A foreign directory consists of two components. The first component is the original directory created in the host database. It is this directory that is accessed by users of other databases. The second component is a directory that is created as foreign in the connecting database.

In the host database

If a particular directory is to be used from within other databases, the directory must be created in the host database, using the procedure described below. The directory is created essentially in the normal way; however, it must be assigned a special directory ID number.

  1. Add a record to EntitySet Directories in the Object Dictionary. This record must set
    • DirName to the name of the directory
    • DirId to the directory ID number. This number should be between 1 and 240. The DirId should not conflict with the DirId of any other directory to which a user might connect at the same time.
    • Foreign to NO
  1. Create the directory in the normal manner, using the CREATE command. If the foreign directories (dirs.zim) file belonging to the host database contains an entry that matches this directory’s DirId, then the operating system file that corresponds to this directory is relocated to that entry.

Note: The root directory (namely Zim) cannot be used as a foreign directory. You should ensure that the directory to be used in other databases is a sub-directory.

In the Connecting database

To enable users of another database to connect to an existing (foreign) directory, continue the above procedure with the following steps:

  1. In the connecting database, add a record to entity set Directories in the Object Dictionary. This record must set
    • DirName to the name of the foreign directory
    • DirId to the directory ID of the foreign directory
    • Foreign to YES
  1. Create the directory in the normal manner. Because the Foreign field in the Directories record has been set to Yes, no files are created for this new directory.

Note: The DirName and DirId of the foreign directory must be the same as the DirName and DirId in the host database.  

At the Operating System level

Before a user of the connecting database can employ the ACCESS command to connect to a foreign directory, the connecting database must contain a foreign directories (dirs.zim) file with an entry describing the location of each foreign directory. To create this file, use a text editor at the operating system level. The file should be stored in the operating system directory that contains the connecting database.

Each entry in the foreign directories file has the format:

dirid file# path

where

dirid is the dirid of the foreign directory

file# is the number of the file that corresponds to the directory in the host database (i.e. nnnn to zimnnnn). To determine the file#, run the ZIMFILES utility against the host database or use the command

output $filename (directory-name)

For example, the entry

11 126 usrtools

means that the directory whose dirid is 11 can be found in the file usrtoolszim0126.

Accessing a Foreign Directory

Once a foreign directory has been defined and created in the host and connecting databases, and the foreign directories file exists with the appropriate entry, the foreign directory is accessible from within the connecting database. To access the foreign directory, use the following procedure:

  1. Invoke Zim in the connecting database.
  2. Use the ACCESS command to access the foreign directory by name, as shown in the following example:

access Utilities read

All objects defined in the foreign directory are now available from within the connecting database.

Note: Foreign directories can be accessed only in read mode.

The Location of Files Associated with a Foreign Directory

The dirs.zim file specifies the location of the operating system (OS) file that corresponds to the foreign directory. But where does the system look for the files that correspond to the entity sets, relationships, programs and so on that are defined in the foreign directory?

By default, Zim looks for these files in the path specified in the dirs.zim file for the foreign directory file itself. It is possible, however, to distribute these files to other parts of the file system by using an areas file with special document file names in the host database. The procedure for using an areas file in a host database is exactly as described for independent databases in Distributing Database Files.

An areas file for a foreign directory can distribute some or all of the associated database files (i.e. EntitySets, relationships, compiled programs, and so on). Documents defined in a foreign directory can use the special file name prefixes – including the double quotation mark and the right parenthesis – to locate associated files in the database directory and work directory belonging to the connecting user.

Example

To illustrate, let’s look at a Utilities example. Consider the following background information:

  • The directory Utilities in the host database is defined in the operating system directory D:UTILPROG. The directory ID for Utilities is 30.
  • In directory Utilities, three documents are defined as shown below:

>list all docs

Docname        FileName       DirName

DictReport     dict.rep       Utilities

ReportOut      )report.out    Utilities

UserLog        “user.log      Utilities

  • In directory Utilities, two entity sets are also defined as shown below:

UtilEnt1 (stored in operating system file ZIM0129)

UtilEnt2 (stored in operating system file ZIM0130)

  • The host database has an associated file that is located, with directory Utilities, in operating system directory D:UTILPROG. The areas file contains the entry

129 C:UTZIM

  • The connecting database has an associated foreign directories file that contains the entry

30 117 D:UTILPROG

  • The connecting user’s work directory is C:APPLDIRUSER1.

Given this situation, the connecting and host databases both contain an areas file that relocates the files associated with entity sets. In the connecting database, a foreign directories file establishes D:UTILPROG as the default location for all files associated with objects in the foreign directory Utilities. The foreign object ReportOut (a document) is defined as being located in the connecting user’s work directory; similarly, UserLog is defined as being located in the connecting user’s database directory.

Accessing Foreign EntitySets

By connecting to a foreign directory, you gain access to the data in the EntitySets and relationships with fields that are defined in that directory.

To obtain read/write access to foreign database fields, you can declare those files as non-shared in the areas file associated with the host database. For example, to obtain read/write access to a foreign EntitySet called UtilEnt whose corresponding operating system file has the name ZIM0185, you would place the entry

185  D:UTILPROG       % This is a Zim on Windows example.

185 /usr3/utilprog/   % This is a Zim on UNIX example.

in the areas file associated with the host database.

In Zim 9, foreign databases can be read or written as any normal database.

Limitations on Foreign Directories

The following limitations apply to the user of foreign directories:

  1. Each directory accessed by an application must have a directory ID unique among all directories being accessed at the same time. Directories, in this case, include sub-directories of foreign directories.
  2. One database cannot connect to the root directory (Zim directory) of another database (i.e. the root directory cannot be a foreign directory).
  3. A foreign directory cannot be updated using the COMPILE, UNCOMPILE, CREATE, ERASE, PERMISSION, or RENAME command. You cannot update the definition of objects defined in a foreign directory.
  4. A connecting database cannot connect to foreign directories defined within the foreign directory of the host database.
  5. Foreign database files that have been encrypted with an ENCRYPT command can be accessed from a connecting database only if the connecting and host databases were both initialized using the same encryption key. The encryption key is specified when the ZIMINIT utility is executed to initialize a new Object Dictionary.
en_CAEnglish