1 /* BEGIN INCLUDE FILE mdbm_db_model.incl.pl1 -- jaw, 10/2/78 */
  2 
  3 
  4 /****^  HISTORY COMMENTS:
  5   1) change(79-02-01,Gray), approve(), audit(), install():
  6      modified to save space occupied by model
  7   2) change(80-11-03,Gray), approve(), audit(), install():
  8      to add mdbm_secured bit in db_model
  9   3) change(82-04-09,Davids), approve(), audit(), install():
 10      collapsed the following into an unused_offset array:
 11        chng_before_path_ptr  chng_err_path_ptr  chng_after_path_ptr
 12        copy_before_path_ptr  copy_err_path_ptr  copy_after_path_ptr
 13        dsply_before_path_pt  dsply_err_path_pt  dsply_after_path_ptr
 14        accs_before_path_ptr  accs_err_path_ptr  accs_after_path_ptr
 15        unused_1
 16      Also changed the name of unused_2 to restructuring_history_offset
 17      and changed the comment on the changer structure to indicate
 18      that it will contain on database creation information.
 19   4) change(82-04-14,Davids), approve(), audit(), install():
 20      used one of the unused_offsets to point to a message which indicates
 21      why the db is inconsistent. The offset will be null when the db is created
 22      and set the first time the message is used. this is so it will be
 23      consistent with existing data bases. Also added the message structure.
 24   5) change(82-04-28,Davids), approve(), audit(), install():
 25      added the undo_request element to the message structure
 26   6) change(82-05-04,Davids), approve(), audit(), install():
 27      changed unused_offset (12) to last_restructruring_history_offset and
 28      changed restructuring_history_offset to first_restructuring_history_offset
 29   7) change(82-08-19,Davids), approve(), audit(), install():
 30      changed the meaning of db_type from 1 => relational and 2 => CODASYL to
 31      1 => vfile database and 2 => page_file database. Up to this point all
 32      database types were equal to 1.
 33   8) change(83-02-14,Davids), approve(), audit(), install():
 34      changed db_type from a fixed bin unal to a substructure of 18 bit (1) unal
 35      flags. This will allow information about transactions and dm_file
 36      concurrency to be independent of the db_type, i.e. vfile or dm_file. The
 37      change is compatable with all datamodels created by the released version
 38      of mrds.
 39   9) change(83-02-15,Davids), approve(), audit(), install():
 40      added the rollback_on flag to the db_type_flags since it appears that you
 41      can have a dmfile database that requires transactions but does not have any
 42      journalizing. Also switched the order of the transactions_needed and
 43      concurrency_on flags - this makes the change compatable with existing
 44      dmfile databases except when displaying the model since concurrency_on and
 45      rollback_on will be off in the model even though the dmfile relations had
 46      them on during creation.
 47  10) change(83-02-22,Kubicar), approve(), audit(), install():
 48       Removed ctl_file_path_ptr.
 49  11) change(85-11-08,Spitzer), approve(85-12-03,MCR7311),
 50      audit(86-09-02,Blair), install(86-10-16,MR12.0-1187):
 51       used 1 unused offset for unreferenced attribute linked lists in db_model,
 52       1 unused bit flag in domain_info to indicate an unreferenced domain, 1 bit
 53       in the flag word for rmdb copying.
 54                                                    END HISTORY COMMENTS */
 55 
 56 
 57 /* this include file contains the structures that go into the make up
 58    of the "db_model" segment in the model for the database.
 59    in addition there file_model.m segments, 1 for each database file(see mdbm_file_model.incl.pl1)
 60 
 61    the db_model structure goes at the base of the segment, and contains items unique to
 62    the whole databse. in addition, it has an area of size to fill the
 63    rest of a segment, that holds the lists of files and domains in the database.
 64    these lists are singly forward linked lists. all "pointers" in the database model
 65    are maintained as offsets(bit (18)) from the base of the particular model segment
 66    since actual pointers are process dependent on segment number.
 67    the remaining structures are first a path_entry one to save pathnames in,
 68    and the stack_item and constent structures, used to save a boolean
 69    expression in polish form, with the stack represented by a linked list.
 70    the final structure is one for identifying the status of version information */
 71 
 72      dcl     1 db_model             aligned based (dbm_ptr),/* base of db_model segment, allocated once per database */
 73                2 version            unal fixed bin,         /* data base version, currently 4 */
 74                2 db_type_flags      unal,
 75                  3 copy_good        bit (1) unal,           /* "1"b => copy of the db_model is the valid copy */
 76                  3 unused           (13) bit (1) unal,
 77                  3 rollback_on      bit (1) unal,           /* "1"b => before journaling is to be done */
 78                  3 concurrency_on   bit (1) unal,           /* "1"b => dm_file concurrency is being used */
 79                  3 transactions_needed bit (1) unal,        /* "1"b => transactions are needed to reference data */
 80                  3 vfile_type       bit (1) unal,           /* "1"b => vfile type relations, "0"b => dm_file type relations */
 81                2 uniq_sw_name       char (32),              /* per database unique attach switch name for files */
 82                2 consistant         bit (1) unal,           /* ON => correctly created/restructured database, ok to open */
 83                2 mdbm_secured       bit (1) unal,           /* on => database has been secured */
 84                2 reserved           bit (34) unal,          /* reserved for flags */
 85                2 blk_file_id_len    unal fixed bin,         /* no. bits required for blocked file id. */
 86                2 unblk_file_id_len  unal fixed bin,         /* number of file id bits, unblocked file */
 87                2 num_blk_files      unal fixed bin,         /* number of blocked files defined in db */
 88                2 num_unblk_files    unal fixed bin,         /* number of unblocked files defined in db */
 89                2 num_rels           unal fixed bin,         /* number of relations defined in db. */
 90                2 num_domains        unal fixed bin,         /* number of domains defined */
 91                2 num_dyn_links      unal fixed bin,         /* no. dynamic links defined */
 92                2 max_max_tuples     unal fixed bin (35),    /* maximum max_tuples across all files */
 93                2 pad_1              unal fixed bin (35),    /* for future use */
 94                2 pad_2              unal fixed bin (35),    /* for future use */
 95                2 version_ptr        bit (18),               /* offset to version structure */
 96                2 file_ptr           unal bit (18),          /* offset to first in threaded list of file_infos */
 97                2 domain_ptr         unal bit (18),          /* offset to first in list of domain_infos */
 98                2 unreferenced_attribute_ptr unal bit (18),  /* offset to first in list of unreferenced attr_infos */
 99                2 unused_offsets     (11) unal bit (18),     /* extra offsets if needed */
100                2 last_restructuring_history_offset unal bit (18), /* offset to last restructuring history entry */
101                2 inconsistent_message_offset unal bit (18), /* offset to message indicating why db is inconsistent */
102                2 first_restructuring_history_offset unal bit (18), /* offset to first restructuring history entry */
103                2 changer_ptr        unal bit (18),          /* offset to information about db creation */
104                2 dbm_area           area (sys_info$max_seg_size - fixed (rel (addr (db_model.dbm_area))) - 1);
105 
106      dcl     dbm_ptr                ptr;
107 
108 /* the files in the database each have a file_info containing
109    their name, the file_model for each file is found by initiating the
110    segment "file_name.m" (i.e. the file's name with suffix ".m")
111    the file_info list is a singly linked list in definition order */
112 
113      dcl     1 file_info            aligned based (fi_ptr), /* list of file names and numbers */
114                2 file_name          char (30),              /* name of file */
115                2 file_id            bit (36),               /* id number of file */
116                2 fwd_ptr            unal bit (18),          /* thread to next in list */
117                2 unused             unal bit (18);          /* for future expansion */
118 
119      dcl     fi_ptr                 ptr;
120 
121 /* each domain used in the database will have a domain info saved in the db_model
122    segment. it describes the domain of the given name, and it's options.
123    the domain_info's form a singly linked list in definition order */
124 
125      dcl     1 domain_info          aligned based (di_ptr), /* one for each domain defined */
126                2 name               char (32),              /* name of domain */
127                2 db_desc_is_ptr     bit (1) unal,           /* on if descriptor is pointer to real desc. */
128                2 user_desc_is_ptr   bit (1) unal,           /* on if user desc is ptr */
129                2 no_conversion      bit (1) unal,           /* if no conversion allowed */
130                2 procedures_present bit (1) unal,           /* on => ids type procedures present */
131                2 unreferenced       bit (1) unal,           /* on => this domain is not used in any attribute */
132                2 reserved           bit (31) unal,
133                2 db_desc            bit (36),               /* desc. for item in db, or ptr to it */
134                2 user_desc          bit (36),               /* desc. for user-visible attr, or ptr */
135                2 ave_len            fixed bin (35),         /* average length of  varying string */
136                2 nck_items          unal fixed bin,         /* no. items in check stack */
137                2 fwd_thread         unal bit (18),          /* offset to next in list */
138                2 check_path_ptr     unal bit (18),          /* integ. check proc. */
139                2 ck_stack_ptr       unal bit (18),          /* to check stack */
140                2 encd_path_ptr      unal bit (18),          /* encode procedure */
141                2 decd_path_ptr      unal bit (18),          /* decode procedure */
142                2 str_before_path_ptr unal bit (18),         /* proc paths and entries */
143                2 str_err_path_ptr   unal bit (18),
144                2 str_after_path_ptr unal bit (18),
145                2 get_before_path_ptr unal bit (18),
146                2 get_err_path_ptr   unal bit (18),
147                2 get_after_path_ptr unal bit (18),
148                2 mod_before_path_ptr unal bit (18),
149                2 mod_err_path_ptr   unal bit (18),
150                2 mod_after_path_ptr unal bit (18),
151                2 unused_1           unal bit (18),          /* for future expansion */
152                2 unused_2           unal bit (18),
153                2 changer_ptr        unal bit (18);          /* pointer to change_id and chane_time structure */
154 
155      dcl     di_ptr                 ptr;
156 
157 /* information necessary for attributes that are not used in any relation */
158 
159      dcl     1 unreferenced_attribute aligned based (ua_ptr),
160                2 name char (32),                            /* name of attribute */
161                2 domain_ptr bit (18) unal,                  /* to domain_info */
162                2 fwd_thread bit (18) unal,                  /* to next in list */
163                2 unused (2) bit (18) unal;
164 
165      dcl     ua_ptr ptr;
166 
167 
168 /* space saving pathname$entryname structure, to be allocated
169    only when a path$entry has to be saved, else only a bit(18)
170    offset takes up space in the main model structure */
171 
172      declare 1 path_entry           based (path_entry_ptr),
173                2 path               char (168),             /* pathname portion of desired path$entry */
174                2 entry              char (32),              /* entryname portion of desired path$entry */
175                2 reserved           unal bit (36);          /* for future use */
176 
177      declare path_entry_ptr         ptr;
178 
179 
180 
181 
182 
183 /* declarations for model of postfix stack holding the check option boolean expression
184    the following encoding values indicate the corresponding type of stack element
185 
186    1  =
187    2  ^=
188    3  >
189    4  <
190    5  >=
191    6  <=
192 
193    10  and
194    20  or
195    30  not
196 
197    40  - (minus)
198 
199    50  domain variable(same name as domain)
200 
201    60  constant(number, bit string, or character string)
202 
203 */
204 
205 
206      declare 1 stack_item           based (stack_item_ptr), /* element of stack model list */
207                2 next               bit (18),               /* link to next in list */
208                2 type               fixed binary,           /* code for this element type */
209                2 value_ptr          bit (18);               /* pointer to variable holding value,
210                                                                if this is a constant element type */
211 
212      declare stack_item_ptr         ptr;                    /* pointer to a stack element */
213 
214 
215 
216      declare 1 constant             based (constant_ptr),   /* variable size space for constant's value storage */
217                2 length             fixed bin (35),         /* length allocated to hold value */
218                2 value              bit (alloc_length refer (constant.length)) aligned; /* value for this constant */
219 
220      declare constant_ptr           ptr;                    /* pointer to constant's value space */
221 
222      declare alloc_length           fixed binary (35) internal static; /* amount of space to allocate for constant's value */
223 
224 /* version structure, giving status of source for CMDB/RMDB,
225    status of model, and status of resultant */
226 
227 /* version number is in form MM.N.Y
228    where MM is the major version number, N is the minor version alteration,
229    and Y is the lastest modification to that alteration,
230    where M and N represent numbers 0-9, and Y is a letter */
231 
232      declare 1 version_status       unal based (version_status_ptr),
233                2 cmdb_rmdb,
234                  3 major            fixed bin,
235                  3 minor            fixed bin,
236                  3 modification     char (4),
237                2 model,
238                  3 major            fixed bin,
239                  3 minor            fixed bin,
240                  3 modification     char (4),
241                2 resultant,
242                  3 major            fixed bin,
243                  3 minor            fixed bin,
244                  3 modification     char (4);
245 
246      declare version_status_ptr     ptr;
247 
248 
249 /* maintains information only about the db creation */
250 
251      declare 1 changer              unal based (changer_ptr),
252                2 id                 char (32),
253                2 time               fixed bin (71),
254                2 next               bit (18);               /* to next in the singly linked list */
255 
256      declare changer_ptr            ptr;
257 
258 
259      dcl     01 message_str         unal based (message_str_ptr), /* general purpose structure to hold messages */
260                02 len               fixed bin,              /* length of the message */
261                02 text              char (message_str_len refer (message_str.len)), /* actual message */
262                02 name              char (32),              /* name of thing that set the message */
263                02 undo_request      char (100),             /* rmdb request that will undo the operation
264                                                                that caused the database to become inconsistent */
265                02 mbz               bit (36);               /* for possible extensions, like an offset to another message */
266 
267      dcl     message_str_ptr        ptr;                    /* pointer to the message_str structure */
268 
269      dcl     message_str_len        fixed bin;              /* initail length of the text string in message_str */
270 
271 /* END INCLUDE FILE mdbm_db_model.incl.pl1 */
272 
273