CHAPTER 1: System Tables


1.1 Introduction

All information about 4GL applications are stored in several system tables in the database. The names of the tables start with sys_4gl, and they do not show up when the SQL command DISPLAY DB is performed on the database. The tables are:
 
sys_4gl_application Stores information about applications.
sys_4gl_window Stores information about windows.
sys_4gl_form Stores information about forms
sys_4gl_field Stores information about fields.
sys_4gl_domain Stores information about domains.
sys_4gl_key Stores information about key scripts.
sys_4gl_script Stores information about subscripts.
sys_4gl_compile Stores the compiled code of applications.
sys_4gl_link Stores the code of linked applications.
 
There are also several tables which contain information about applications when using the Application Generator. The names of the tables start with sys_ag. All these tables, except sys_ag_definition, are used to hold temporary information while an application is being generated. The tables are:
 
sys_ag_definition Stores definitions of applications.
sys_ag_parameter Holds information about basic layout of application.
sys_ag_menu Holds definitions of menus.
sys_ag_menu_item Holds information about menu items.
sys_ag_function Holds information about functions.
sys_ag_table Holds information about tables used.
sys_ag_attribute Holds information about attributes used.
sys_ag_qual_list Holds a list of attributes used in qualifications.
sys_ag_qualification Holds information about qualifications.
sys_ag_screen Holds information about screen displays.
sys_ag_screen_attr Holds information about attributes displayed.
 
These tables have the following structures:
*** Table: sys_4gl_application ***
  Attributes:
    application_name     nlschar(32,1)    Not Null
    enter_script         nlstext(20,71,128,1)
    exit_script          nlstext(20,0,128,1)
    links                nlstext(20,42,64,1)
    global_keys          nlstext(20,42,64,1)
    module               char(1,1)
    lock                 char(1,1)
*** Table: sys_4gl_compile ***
  Attributes:
    application_name     nlschar(32,1)      Not Null
    segment              integer            Not Null
    compile              bulk(20,469,512,1) Not Null
*** Table: sys_4gl_domain ***
  Attributes:
    name              nlschar(32,1)         Not Null
    delimiter         nlschar(2,2)
    fill              char(1,1)
    video             nlschar(32,1)
    fixed             char(1,1)
    entry             char(1,1)
    pattern           nlstext(20,0,64,1)
    mode              char(1,1)
    data_type         nlschar(32,1)
    range             nlstext(20,0,64,1)
    application_name  nlschar(32,1)
*** Table: sys_4gl_field ***
  Attributes:
    name                 nlschar(32,1)         Not Null
    application_name     nlschar(32,1)         Not Null
    window_name          nlschar(32,1)         Not Null
    enter_script         nlstext(20,0,64,1)
    exit_script          nlstext(20,70,64,1)
    mode                 char(1,1)
    data_type            nlschar(32,1)
    next                 nlschar(32,1)
    previous             nlschar(32,1)
    number               integer               Not Null
    next_number          char(5,1)
    previous_number      char(5,1)
    save_name            nlschar(32,1)
    default_expression   nlstext(20,42,64,1)
    range                nlstext(20,42,64,1)
*** Table: sys_4gl_form ***
  Attributes:
    name                 nlschar(32,1)         Not Null
    compile              bulk(20,471,512,1)    Not Null
    application_name     nlschar(32,1)         Not Null
*** Table: sys_4gl_key ***
  Attributes:
    name                 nlschar(12,1)         Not Null
    application_name     nlschar(32,1)         Not Null
    key_context          nlschar(32,1)         Not Null
    script               nlstext(20,42,64,1)
    disable              char(1,1)
*** Table: sys_4gl_link ***
  Attributes:
    application_name     nlschar(32,1)        Not Null
    segment              integer Not Null
    compile              bulk(20,469,512,1)   Not Null
*** Table: sys_4gl_script ***
  Attributes:
    name                 nlschar(32,1)         Not Null
    application_name     nlschar(32,1)         Not Null
    script               nlstext(20,47,64,1)
    return_type          char(8,1)
*** Table: sys_4gl_window ***
  Attributes:
    name                 nlschar(32,1)         Not Null
    application_name     nlschar(32,1)         Not Null
    form_name            nlschar(32,1)         Not Null
    form_instance        nlschar(32,1)
    minrow               integer
    mincol               integer
    maxrow               integer
    maxcol               integer
    draw_box             char(1,1)             Not Null
    key_context          nlstext(20,42,64,1)
*** Table: sys_ag_definition ***
  Attributes:
    AG_name          nlschar(32,1)
    type             char(1,1)
    compile          bulk(20,469,512,1)
    link             char(1,1)
    lock             char(1,1)



1.2 sys_4gl_application

This table contains a record for each application that exists in the database.
 
Table 1-1
 
sys_4gl_application Attributes
application_name Name of application.
enter_script Application enter script.
exit_script Application exit script.
links Names of link libraries.
global_keys Names of Global Key Contexts.
module Reserved for future use.
lock Set to y if the application is being edited.



1.3 sys_4gl_compile

This table contains the p-code that is generated when applications are compiled. Depending on the size of the application, the compiled code may be stored in several records. A sequence number is used to identify the order of the records.
 
Table 1-2
 
sys_4gl_compile Attributes 
application_name Name of application.
segment Sequence number.
compile Compiled p-code.



1.4 sys_4gl_domain

This table contains one record for each domain, defining a set of field characteristics.
 
Table 1-3
 
sys_4gl_domain Attributes
name Name of domain.
delimiter Characters to be placed at the beginning and at the end of the field.
fill Fill flag: n (no fill) or y (fill).
video Field video type: normal, reverse, nohilite ...
fixed Fixed flag: 
n - accept data larger than field size. 
a - go to next field when a character is typed on the last position of field. 
f - overwrite last character when typing in last position of field. 
b - ignore extra characters.
entry Field entry: l (left entry) or r (right entry).
pattern Edit pattern restricting the entry of data. Also used as format for display.
mode Field mode: w (write), r (read-only), s (skip).
data_type Data type of contents of field.
range Range definition to restrict the values that can be entered in the field.
application_name Name of application. 



1.5 sys_4gl_field

This table contains at least one record for each field in an application. There may be more than one for a multi-field.
 
Table 1-4
 
sys_4gl_field Attributes
name Name of field. 
application_name  Name of application. 
window_name Name of window which contains this field.
enter_script Field enter script.
exit_script Field exit script.
mode Field mode: w (write), r (read-only), s (skip).
data_type Data type of contents of field.
next Name of next field. The NEXT FIELD function will move the cursor to that field.
previous Name of previous field. The PREVIOUS FIELD function will move the cursor to that field.
number Field number. Usually 1, except for multi-fields.
next_number Next field number.
previous_number Previous field number.
save_name If several fields have the same save name, they will have the same save value.
default_expression Used to specify a default value for the field.
range Range definition to restrict the values that can be entered in the field.



1.6 sys_4gl_form

This table contains one record for each form in an application.
 
Table 1-5
 
sys_4gl_form Attributes
name Name of form.
compile Compiled definition of form.
application_name Name of application.



1.7 sys_4gl_key

This table contains definitions of key contexts. There is a record for each key label used in each key context.
 
Table 1-6
 
sys_4gl_key Attributes
name Key label.
application_name Name of application.
key_context Name of key context.
script Key script.
disable Disable flag: n or y (to disable field exit script). 



1.8 sys_4gl_link

This table contains the p-code for linked applications. It contains records similar to those in the sys_4gl_compile table.
 
Table 1-7
 
sys_4gl_link Attributes
application_name Name of linked application.
segment Sequence number.
compile Compiled p-code.



1.9 sys_4gl_script

This table contains a record for each subscript in an application.
 
Table 1-8
 
sys_4gl_script Attributes
name Name of subscript.
application_name Name of application.
script Contents of subscript.
return_type Data type of return value.



1.10 sys_4gl_window

This table contains a record for each window in an application.
 
Table 1-9
 
sys_4gl_window Attributes
name Name of window.
application_name Name of application.
form_name Name of form used by window.
form_instance  Name of form instance.
minrow Top left corner row number.
mincol Top left corner column number.
maxrow Bottom right corner row number.
maxcol Bottom right corner column number.
draw_box Box around window: n (no) or y (yes).
key_context List of key contexts associated with that window.



1.11 sys_ag_definition

This table contains a record for each application created using the Application Generator.
 
Table 1-10
 
sys_ag_definition Attributes
AG_name Name of application.
type Type: D (data entry) or M (menu).
compile Compiled p-code of application.
link Reserved for future use.
lock Set to y if the application is being edited.