Subschema Considerations

A subschema is a program view of the database; it typically defines a subset of the records and record elements that are contained in the schema. The following rules apply to subschema usage:
idmscu19
A
subschema
is a program view of the database; it typically defines a subset of the records and record elements that are contained in the schema. The following rules apply to subschema usage:
  • Any number of subschemas can be associated with a single schema.
  • Any number of programs can share a subschema.
  • A program can have only one subschema.
Comparing Subschema and Schema
The following table compares the features and characteristics of subschemas and schemas.
Subschema
Schema
One or more per database
One per database
A program view of the database (subset of records and record elements)
Complete database description (all records and record elements)
Source description resides in the DDLDML area of the dictionary
Source description resides in the DDLDML area of the dictionary
Source description that is used at DML program compile time
Source description that is not used at DML program compile time
A load module resides in the DDLDCLOD area of the dictionary or in a load (core-image) library
No load module
Load module that is used at run time
Not used at run time
Subschema Access Restrictions
The subschema may place restrictions on the DML statements that can be used to access database records. For example, you may be able to retrieve a record but not modify or erase it.
DBA-designated access restrictions, which are defined in the subschema, control program access to the database. Restrictions can be placed on:
  • Areas
    -Access restrictions that are placed on areas prevent programs from readying them in specified usage modes (see Area Usage Modes).
    For example, a subschema with an update access restriction on the ORG-DEMO-REGION area
    can prevent
    programs from readying that area in any update mode.
  • Records
    -Access restrictions that are placed on records prohibit programs from performing one or more of the following DML functions against the specified record types:
    • CONNECT
    • DISCONNECT
    • ERASE
    • FIND
    • GET
    • KEEP
    • MODIFY
    • STORE
  • For example, ERASE IS NOT ALLOWED for the OFFICE record type prohibits a program using the subschema from erasing OFFICE record occurrences.
    The DML OBTAIN statement is a combination of FIND and GET; access restrictions on either FIND or GET affect the use of OBTAIN.
  • Sets
    -Access restrictions that are placed on sets prohibit programs from performing one or more of the following DML functions against record occurrences in the specified set:
    • CONNECT
    • DISCONNECT
    • FIND
    • KEEP
    For example, DISCONNECT IS NOT ALLOWED for the JOB-EMPOSITION set prohibits a program from disconnecting EMPOSITION occurrences from the JOB-EMPOSITION set.
If your program issues a DML statement that is prohibited in the subschema, the DBMS returns a status of
nn
10 in the ERROR-STATUS field in the IDMS communications block. The IDMSRPTS utility (discussed next) produces listings of any access restrictions that apply to a given subschema.
Program Registration
The DBA can specify in the subschema that each program that uses the subschema must be defined in the dictionary before compilation under one of the precompilers. If program registration is in effect, you should ensure that the name that is listed in the PROGRAM-ID statement (for COBOL) matches the program name that is registered with IDD.
IDMSRPTS Utility
The IDMSRPTS utility produces listings that describe the database definition (that is, the schema and all associated subschemas). These reports are useful in all phases of program development; they provide the following information:
  • Names of all records, sets, and areas included in the subschema
  • Names, attributes, and positions of all elements included in each subschema record
  • Storage mode of each record
  • Access restrictions
  • Set characteristics
IDMSRPTS Parameters
The following table lists the parameters of the IDMSRPTS utility that are most useful to applications programmers.
Parameter
Requested information
RECDES
All records and record elements that are defined in the schema
SETDES
Set name, owner, membership options, and linkage options for all sets that are defined in the schema
SUBREC
All records and record elements that are defined in the subschema; access restrictions that are placed on records
SUBSET
Set name, owner, membership options, and linkage options for all sets that are defined in the subschema; access restrictions that are placed on sets
SUBAREA
Usage modes applicable to subschema areas, default usage modes; access restrictions that are placed on areas
For more information about the IDMSRPTS utility, see IDMSRPTS.