The capability to save a KB depends upon the license associated with your G2 product. For information about G2 licenses, see Chapter 48, Licensing and Authorization.
Note: KB files and KB snapshot files are fully portable across platforms.
Saving the Current KB to a KB File
You can save the current KB whether it is running, paused, or reset.
To save the current KB interactively:
Select Main Menu > Save KB.
To save the current KB programmatically:
Use the g2-save-kb system procedure, as described in the G2 System Procedures Reference Manual.
Save KB from the Main Menu causes G2 to display the Save KB dialog. In the edit area of this dialog, you compose a Save current KB command, as shown in this figure:
![]() |
As shown, G2 prompts with a default directory pathname and default KB file name. You can edit the default directory path and default filename, or you can enter a specified KB filename, shown in the figure above as
final-buttons.kb, after the parenthetical phrase. Filenames of KB Files
By default, G2 stores a KB file with a filename that has the extension .kb, or .KB on an operating system whose file system is not case-sensitive. When searching for KB files by specifying a name only, without an extension, G2 recognizes files whose filenames include the .kb or .KB extension. .kb~ filename suffix. On VMS platforms, G2 uses file version numbers. Syntax for KB Filenames
A KB's filename must be acceptable to the file system that stores the KB, and to the G2 dialogs that load, save, and merge KBs. To insure that KB filenames will work under all conditions, they should:
Both of these facilities are described under Saving Parameters.
Saving a Running Current KB
If you save a KB while it is running, G2 saves the permanent knowledge in the KB as of that moment in time, regardless of any changes made to the knowledge thereafter. The G2 scheduler allows KB processing to take place normally; G2 tasks of a higher priority take place before G2 tasks of lower priorities. Default-priority-for-runtime-saving attribute in the Saving Parameters system table.
Note: The default value of the Default-priority-for-runtime-saving attribute is priority 8, which causes saving while running to execute as a relatively low priority task, known as a background task.
For example, when you save a KB while it is running, G2 processes rules normally, because the default priority for processing rules is priority 1. Saving the State of Workspaces
A KB file or KB snapshot file stores the following information about your KB workspaces:
Supporting Source-Code Control Systems
When you save a KB to the same KB file from which it was loaded, G2 updates only a portion of the KB file itself. This allows an industry-standard source-code control system (SCCS) to detect which characters in the updated file represent the most recent changes.
Note: When checking out a KB file using a SCCS, do not use keyword expansion, otherwise the KB file will be corrupted. For example, if you use the RCS application, specify the -ko argument when checking out a KB file.