Database homecontents start chapter top of pagebottom of pagenext page indexSchema

Schema Commands

There are commands to
create a new database or to connect an existing database. Passwords can be supplied with the PASSWORD command. Attaching a database and supplying passwords is normally done through menus or with the Execution Parameters.

There are numerous commands to define the specific features of a database. A set of commands which corresponds to the definition of the attached database can be written to a file using WRITE SCHEMA and edited. The schema definition can then be executed as any other SIR2002 procedure.

A report on the definition of the attached database can also be produced with the SCHEMA LIST command.

The complete database can be deleted. Individual record definitions can also be deleted provided that there is no data for that record.

The format of schema commands is the same as other SIR2002 commands, that is new commands must begin at the start of a line and continuation lines for a command must have blanks at the start of the line. Individual clauses within a command must be separated by slashes.

Overall database commands precede record definition commands. There may be many sets of record definition commands (one set for each record type) and, within a record definition, there is an order for the various types of commands.

Secondary index definitions may follow a record definition. A secondary index is defined with a single CREATE DBINDEX command. These can be done before or after any initial data loading. Defining an index builds the index automatically if there is existing data in the record.

Overall Commands

The overall database commands specify whether there is a case structure, and what data is held for each case, size estimates, security, and any documentary text. The commands are:

[NO] CASE ID

Defines whether this database has a case structure or is a caseless database. This is the only required command to define a database.

COMMON SECURITY

Specifies default security on COMMON VARS.

COMMON VARS

Specifies variables in the Common Information Record (CIR).

DOCUMENT

Stores text about the database in the data dictionary.

MAX INPUT COLS

Specifies the longest batch input record length.

MAX KEY SIZE

Specifies the maximum key size.

MAX REC COUNT

Specifies maximum number of records of one type.

MAX REC TYPES

Specifies maximum number of record types.

N OF CASES

Specifies maximum number of cases for case structured databases.

N OF RECORDS

Specifies maximum number of records for caseless databases.

READ SECURITY

Sets security passwords for read access levels.

RECS PER CASE

Specifies the average number of records per case.

RECTYPE COLS

Specifies which columns contain the record type for Batch Data Input.

SYSTEM SECURITY

Sets security passwords for specific DBA utilities.

SYSTEM SECURITY LEVEL

Sets the security level for specific DBA utilities.

TEMP VARS

Specifies temporary variables used during Batch Data Input.

WRITE SECURITY

Sets security passwords for write access levels.

Record Definition

The record definition commands specify the name and number of the record, the key fields and any documentary text together with the name, type, and size of each variable. A further set of information may be specified for each record type which relates to the Batch Data Input utilities. This specifies how data is loaded from serial files, including any computations and logical accept/reject clauses.

Within a record definition, there is an order for commands. The example record definition shows some of the most commonly used record definition commands.

The following commands are used to specify records.

ACCEPT REC IF

Specifies acceptance tests for batch data input.

CAT VARS

Specifies variables are categorical.

CHARACTER*n

Defines new character variables and their length. n may be from 1 to 4094.

COMPUTE

Specifies computations in batch data input.

CONTROL VARS

Specifies that numeric variables are control variables not observation variables. By default, numeric variables defined with a set of VALID VALUES or VALUE LABELS are control variables. To specify other numeric variables as control variables, also define a VAR RANGE for them.

DATA LIST

Defines new variables and their external formats. Alternative to the INPUT FORMAT/VARIABLE LIST format.

DATE VARS

Specifies variables are date variables and defines the external date format.

DOCUMENT

Stores text about the record in the data dictionary.

END SCHEMA

Specifies the end of this record definition.

IF

Computes values conditionally in batch data input.

INPUT FORMAT

Specifies the external format of variables defined by the VARIABLE LIST.

INTEGER*n

Defines new integer variables with an internal length of 1, 2 or 4.

KEY FIELDS

Specifies the variables which are keys for a record.

MAX REC COUNT

Specifies the number of records of this type that can be held.

MISSING VALUES

Specifies missing values for variables.

OBSERVATION VARS

Specifies that numeric variables which have valid values or value labels are observation variables instead of control variables.

REAL*n

Defines new floating point variables with an internal length of 4 or 8.

REC SECURITY

Sets default security levels for variables in this record.

RECODE

Specifies recodes performed by batch data input.

RECORD SCHEMA

Begins the record definition and names the record.

REJECT REC IF

Specifies acceptance criteria for batch data input.

SCALED VARS

Specifies integer variables are scaled and defines the scaling factor.

SEQUENCE CHECK

Specifies sequence checking for batch data input.

SEQUENCE COLS

Specifies position of sequence numbers for batch data input.

TIME VARS

Specifies variables are time variables and defines their external format.

VALID VALUES

Defines valid values for variables.

VALUE LABELS

Defines value labels for variables.

VARIABLE LIST

Defines variables. Used with INPUT FORMAT as alternative to DATA LIST.

VAR LABELS

Defines labels for variables.

VAR RANGES

Defines ranges of valid values for variables.

VAR SECURITY

Defines read and write security levels for individual variables.


Format of Commands

Start new schema commands in column 1. Continue commands by leaving column 1 blank. Comments and general listing control statements can appear between any commands but not between the clauses of a single command.

When the same command applies to several variables, use a single command and delimit the specifications for each variable with a slash. For example,

VALID VALUES CODE1 (1 2 3) / CODE2 (1 2)
VALUE LABELS CODE1 (1) 'Tested'
                   (2) 'Preliminary'
                   (3) 'Passed'/
             CODE2 (1) 'Domestic'
                   (2) 'Overseas' 

TO Lists

Define lists of variables on a
DATA LIST, VARIABLE LIST, COMMON VARS and TEMP VARS by using a pair of identical variable names with a numeric suffix in ascending sequence separated by the keyword word TO. For example, to define ten variables named VAR01, VAR02, ... VAR10:

VARIABLE LIST VAR01 TO VAR10

Once variables have been defined, they can be referenced as a list in other commands by using a pair of variable names separated by the word TO , regardless of the format of the variable names. The sequence of the variables included in the list is determined by the sequence in which the variables were defined. The TO list is inclusive and backwards references are not allowed. For example, suppose the following variables were defined on a variable list:

VARIABLE LIST ID EMPNO NAME STATUS1 TO STATUS3 GENDER

A reference on another command (such as MISSING VALUES) could be ID TO GENDER to include all the variables, or NAME TO STATUS3 to include NAME and the three STATUS fields. For example:

MISSING VALUES EMPNO TO GENDER (BLANK)


Order of Commands

Record definition commands follow database definition commands. The record definition commands of each record occur together. You do not have to define records in any particular order. The KEY FIELDS command and the DATA LIST or INPUT FORMAT / VARIABLE LIST can only occur once per record. Other commands may occur multiple times.

Within each record, there is a general order that must be followed. The commands to do with the overall record structure come first, then the definition of the variables and then additional specifications referring back to the defined variables. It is normal for the definition of all variables to precede the optional specifications for all variables, but this is not required. It is required that the definition of a particular variable precedes the specification for that variable.

GroupCommands
1RECORD SCHEMA *
DOCUMENT
KEYFIELDS/SORT IDS
MAX REC COUNT
REC SECURITY
SEQUENCE CHECK/COLS

2DATA LIST or
VARIABLE LIST/
INPUT FORMAT*
INTEGER VARS
REAL VARS
CHARACTER VARS

3CAT VARS
CONTROL VARS
DATE VARS
MISSING VALUES
OBSERVATION VARS
TIME VARS
SCALED VARS
VALID VALUES
VALUE LABELS
VAR LABELS
VAR RANGES
VAR SECURITY

4ACCEPT REC IF
COMPUTE
IF
RECODE
REJECT REC IF

5END SCHEMA

The * commands (RECORD SCHEMA and either DATA LIST or VARIABLE LIST/INPUT FORMAT) are mandatory and must be supplied. All other commands are optional.


Example Record Specification

The typical definition of a record with no batch data input processing consists of :

RECORD SCHEMA
KEY FIELDS
DATA LIST or VARIABLE LIST/INPUT FORMAT
DATE VARS & TIME VARS
MISSING VALUES
VALID VALUES
VALUE LABELS
VAR LABELS
END SCHEMA.

For example:

RECORD SCHEMA 1,PATIENT
KEY FIELDS     ID
VARIABLE LIST  ID,LNAME,FNAME,DOB,SEX,STATUS
INPUT FORMAT   (I4,A40,A40,DATE'MM/DD/YYYY',I1,I1)
MISSING VALUES  LNAME to STATUS (BLANK)
VALID VALUES    SEX    (1,2) /
                STATUS (1,2,3)
VALUE LABELS    SEX       (1) 'Male'
                          (2) 'Female'/
                STATUS    (1) 'Inpatient'
                          (2) 'Outpatient'
                          (3) 'No Longer Attending'
VAR LABELS      ID        'Patient Id'/
                LNAME     'Last Name'/
                FNAME     'First Name'/
                DOB       'Date of Birth'/
                STATUS    'Current Status'
END SCHEMA

In the above example the following commands were used:

RECORD SCHEMA

Specifies the record number and name, and begins the specification of a record type.

KEY FIELDS

Specifies the key field variables for the record type in order from major to minor key. This immediately follows the RECORD SCHEMA command.

VARIABLE LIST
INPUT FORMAT

The VARIABLE LIST names the variables; the INPUT FORMAT defines the data type, size and format. The variable names are simply listed in the order they are to appear in the database, separated by blanks or commas. Variables are held in the order they are defined. The format specification is enclosed in parentheses and commas are used as separators. "I" specifies integers, "A" specifies alphanumeric. Date formats consist of D(day), M(month), Y(year) and I(ignore) specified as a quoted string.

MISSING VALUES

Up to three missing values may be specified for any variable. The keyword BLANK specifies that blank input is treated as missing. When the same value is to be assigned to a set of variables the variable list format can be used. This consists of the two variable names which define the start and end of the list and the word "to".

VALID VALUES

Valid values or ranges of valid values may be specified for variables. Values which do not match these and are not a valid missing value can never appear in the data. Attempts to store an invalid value result in the system missing value (undefined).

VAR LABELS

Variable labels may be up to fifty-eight characters and are used as the name of the variable on screens, column headings on reports and generally as the label for the variable.

VALUE LABELS

Value labels associate a label with a given value. The label can be displayed in place of the value. Value labels are up to forty characters long. The specification for each variable is separated by a slash. There is no separator between different values of a variable.

END SCHEMA

Ends a record schema definition set of commands.


CREATE DATABASE

CREATE DATABASE database_name
        [JOURNAL  = {ON | OFF} /]
        [PASSWORD = database_password /]
        [PREFIX   = database_directory]

Creates a new database. (NEW FILE is a synonym.) A database name is up to 8 characters long and the first character must be alphabetic. To connect to an existing database, use the CONNECT DATABASE command.

JOURNAL

Controls whether journalling is performed for the new database. The default is ON.

PASSWORD

Defines the database password for the new database. This option lists the password in the output listing. The database password can also be supplied with the PASSWORD command which does not list the password in the output listing. If a password is not defined for a database, the password is set to blank. If a database has no password, future connections to the database need not specify a password. The UNLOAD FILE utility can change the database name and password.

PREFIX

Specifies the database directory. If not specified, the database is created in the current directory.


CONNECT DATABASE

CONNECT DATABASE database_name
        [JOURNAL  = {ON | OFF}  /]
        [PASSWORD = db_password /]
        [PREFIX   = database_directory /]
        [SECURITY = {read_pw | *} [{write_pw | *}] /]
        [CREATE]

Connects the specified existing database. (OLD FILE is a synonym.) A database must be connected before it can be used. The last connected database is the default database. Al processes and utilites run on the default database.

A pre-compiled VisualPQL program can connect a database when it runs, but, if you need to compile a VisualPQL program which references a database, the database must be connected first.

JOURNAL

Turns journalling on or off. Journalling is a database characteristic and remains as it was last set and need not be re-specified.

PASSWORD

Specifies the password which is required to access to the database. This is not required if the database has no password. This option shows the password in the output listing.

The database password can also be supplied with the PASSWORD command which does not list the password in the output listing.

PREFIX

Specifies the database directory. This is not required if the database is in the current directory.

SECURITY

Specifies the read and write security passwords.

It is only necessary to specify the write security password when updating the database. To specify a write password when the read password is null, specify the read passowrd as an asterisk (*).

If the read password matches the highest (30) level of security, then the user has Data Base Administrator (DBA) level access to the database and can run all utilities. If the database does not have any read passwords assigned, then any connected user has DBA access. See READ SECURITY

CREATE.

Creates a new database when used with the CONNECT DATABASE command. CREATE makes CONNECT DATABASE act identically to the CREATE DATABASE command.


DISCONNECT DATABASE

DISCONNECT DATABASE database_name
Disconnects a database. If this is the default database, the procedure file is set to SYSPROC.


SET DATABASE

SET DATABASE database_name
Sets a previously connected database as the default.

SHOW DATABASE

SHOW DATABASE
Writes a viewable list of connected databases.

LIST DATABASE

LIST DATABASE
Sends WDL a list of connected databases.


PASSWORD

PASSWORD database_password

Supplies the database password. This command must be preceded by either the CREATE DATABASE or CONNECT DATABASE command.

When used with CREATE DATABASE, this command defines the database password.

When used with CONNECT DATABASE, this command supplies the password needed to connect the database. If the database has no password, this command need not be specified. If an incorrect password is specified, access to the database is denied.

This command does not print the password in the output listing.


SECURITY

SECURITY read_pw , write_pw

SECURITY supplies the read and write passwords. If an incorrect password is specified, level 0 (zero) security is assigned.

This command does not print the passwords in the output listing.


PURGE SIR FILE

Deletes the database. Use this utility to delete the current database before restoring it for recovery or restructuring. The database files are completely deleted from the disk.

PURGE SIR FILE
    [/JOURNAL = KEEP | PURGE]
    [/PROC    = KEEP | PURGE]
JOURNAL

KEEP specifies that the journal file is not deleted and is the default. PURGE specifies that the journal file is also deleted when the database is deleted.

PURGE SIR FILE JOURNAL = PURGE

PROC

KEEP specifies that the procedures are not deleted. When a new database is created or a database is reloaded, the old procedure file can be used as part of that database. This keeps the procedures from a corrupt database when a restore cannot be accomplished. PURGE specifies that the Procedure File is deleted and is the default.

PURGE SIR FILE PROC = KEEP


DELETE SCHEMA

Deletes the schema of a record that has no data. Select the appropriate record.

DELETE SCHEMA recname | recnum

Deletes the record schema name or number from the database definition. DELETE SCHEMA only operates if there are no records for this record type. This is a DBA security level command.

When defining and redefining a record type, it is sometimes simpler to DELETE SCHEMA and redefine it through a complete new RECORD SCHEMA than to modify it over and over again.

When defining and testing a new database and wish to delete all of the test data for record type n prior to delete schema the following simple VisualPQL program does this (omit the case commands if it is a caseless database):

RETRIEVAL UPDATE
PROCESS CASE
PROCESS REC n
DELETE REC
END PROCESS REC
END PROCESS CASE
END RETRIEVAL


CASE ID

CASE ID varname [(A)|(D)] |
[NO] CASE ID

CASE ID varname establishes the database with a case structure and specifies the name of the variable used on every record as the case identifier.

NO CASE ID establishes the database without a case structure.

Either CASE ID or NO CASE ID is required to set up the database and this command must be used prior to any other definition. Once the case specification and case id have been defined, these cannot be modified.

The case variable may be any data type. However REAL should be avoided for keys due to the difficulty of specifying exact numbers in floating point.

D specifies descending sort order for cases. If order is not specified, ascending is assumed. When all cases are processed sequentially, they are retrieved in this sequence.


COMMON SECURITY

COMMON SECURITY rlevel, wlevel

Specifies the default minimum security levels for all common variables.

Rlevel (read level) and wlevel (write level) are integers between 0 (zero) the lowest, and 30, the highest. If no security levels are defined, level 0, the lowest, is assigned. Further security restrictions for individual common variables can be specified at the record level using the VAR SECURITY command. See READ SECURITY for an explanation of security levels.

Common security levels can be changed. Note, this affects only the security levels for new common variables that are defined or redefined. It does not affect the security levels of currently defined common variables.


COMMON VARS

COMMON VARS [varname | varlist] [(format)]

Specifies variables in the Common Information Record or CIR. Common variables are typically those that are used repeatedly in retrieving data from the database. These variables can be referenced at any time regardless of the record type being processed. CIR entries can be updated directly when processing a case, or can take the value of the last entry in a given record type.

Note that common vars, except for the case id on a case structured database, cannot be used as key variables in a secondary index in a record as they are not stored as part of a record.

The format may be specified here or may be taken from a reference to this variable on a subsequent record definition.

New common variables can be added to the list of currently defined common variables. The CIR is physically created when data is first entered into the database. If a common variable has been specified without a format, then no space is reserved for that variable. A subsequent definition of the variable after the CIR is created requires an UNLOAD / RELOAD.

The format applies to a single variable or to a list of variables. Note that the definition of variable format here is slightly different than on the record definition. Format can be:

(A,n)
A character string n long.

(I,n)
An integer where n is the external length of the number.

(F)
A single-precision floating point number.

(D)
A double-precision floating point number.

(DATE)
A date variable.

(TIME)
A time variable.

(CAT,n)
A categorical variable with n entries.


DOCUMENT

DOCUMENT text

Specifies that the text following the command is commentary. This text is stored in the dictionary describing the overall database.

The text cannot be partially modified. To alter the text, run the DOCUMENT command with new text. The new document text completely replaces the old.


MAX INPUT COLS

MAX INPUT COLS n

Specifies the length of the largest input line for any record type in the database. N is rounded up to a number evenly divisible by eight. This command is necessary when there is any record type with a batch input format longer than 80. The MAX INPUT COLS can be increased at any time, but cannot be decreased once any record types have been defined.


MAX KEY SIZE

MAX KEY SIZE n

Specifies the maximum key size required for any record type in the database. The default is the size of the largest key currently defined for any record type in a database and is calculated automatically.

Only specify an explicit key size if you expect to define a new record type with a larger key than the current largest key after loading data into the database. If MAX KEY SIZE is set to the largest expected key, it avoids having to UNLOAD and RELOAD the database.

The keys for a record are: the Case Id, the record number and the key fields. The current MAX KEY SIZE can be obtained from the database statistics.

The absolute maximum key size possible, whether defined through this command or calculated from the keys specified, is 320 characters.


MAX REC COUNT

MAX REC COUNT n

For case structured databases, this specifies the default MAX REC COUNT for individual record definitions. The overall MAX REC COUNT sets the default maximum of a record type for any one case in the database. The number specified for an individual record type may be larger than specified here. The default value is 100.

For caseless databases, use the command N OF RECORDS to specify the maximum number of records that the database can hold.


MAX REC TYPES

MAX REC TYPES n

Specifies the maximum number of different record types that can be defined in the database. The default value is 30.

No record type number can exceed the value specified on the MAX REC TYPES command. For example, if MAX REC TYPES is 10, a record type 11 is not allowed, even if there are fewer than ten record types defined.

This number affects the size of the CIR. Space is reserved in the CIR for counts for as many record types as defined in MAX REC TYPES. The case level MAX REC COUNT determines how much space is held for the count of any record type as yet unspecified. For example, if there is a MAX REC TYPES of 30 and a MAX REC COUNT of 100, 30 bytes are reserved for record counts in each CIR. With a MAX REC TYPES of 100 and a MAX REC COUNT of 1,000,000, 400 bytes are reserved.

Changing this number requires a database UNLOAD / RELOAD once data has been loaded.


N OF CASES

N OF CASES n

Specifies the maximum number of cases, n, that can be entered in the database. The maximum number of cases is an integrity constraint which limits the number of cases that can be held in the database

The N OF CASES is an absolute value; it cannot be increased without doing an UNLOAD / RELOAD and so the value should be specified carefully to allow for the maximum number of cases ever wanted in the database.

N OF CASES is multiplied by the RECS PER CASE to establish the total number of records the database can handle. This limit cannot be exceeded and can only be changed with an UNLOAD / RELOAD.

There is no overhead with specifying a large value, the only constraint is that total number of records is a number which can be stored in one integer. This number is 2,147,483,648.

The default N OF CASES is 1000.

Not valid for caseless databases.


N OF RECORDS

N OF RECORDS n

Specifies the maximum number of records, n, that can be entered in a caseless database.

The N OF RECORDS is an absolute value; it cannot be exceeded and so the value should be specified carefully to allow for the maximum number of records ever wanted in the database. This limit can only be changed with an UNLOAD / RELOAD.

There is no overhead with specifying a large value, the only constraint is that total number of records is a number which can be stored in one integer. This number is 2,147,483,648.

The default N OF RECORDS is 1,023,000.

Not valid for case structured databases.


READ SECURITY

READ SECURITY (leveln) password ....

Establishes the read security levels and associated passwords. There are 31 levels of security, from 0 (zero), the lowest, to 30, the highest. Repeat the complete specification for each password. Database passwords are a SIR2002 name and must conform to the name format. That is, names are no longer than 8 characters, begin with an alphabetic character and can contain alphanumeric characters and the four special characters # $ @ _. For example
READ SECURITY (1) CLERK (2) SUPER (3) MANAGER

When a user logs in to the database, they specify a Read Security Password. If this matches a password in this list, then they are assigned that security level. If they do not login with a valid read security password, they are assigned level zero.

If security passwords are not defined, anyone who logs on to the database is assigned level 30 (database administrator) read permission.

One level is associated with one password. That is, there may be a password for level 1, a password for level 2, and so on. There cannot be two passwords for the same level. Read access at a particular level grants read access for all lesser levels.

A security level and associated password must be defined before that security level can be specified on a record type or variable.


RECS PER CASE

RECS PER CASE n

Specifies an average number of records per case. The default is 1023.

This is used to calculate the total number of records in the database. The product of N OF CASES multiplied by RECS PER CASE forms an upper bound on the total number of records (not including CIRs) that can be stored in the database.

The default N OF CASES is 1000 which means that 1,023,000 is the default total number of records for a database.

This can be updated once records have been entered without an UNLOAD / RELOAD.

This command has no meaning for caseless databases.


RECTYPE COLS

RECTYPE COLS n[,m]

When using Batch Data Input utilities, the input file can contain records of different types and an input record type is identified by its record type number. The record type number is an integer and must appear in the same position on all input records regardless of record type.

RECTYPE COLS specifies the columns that contain the record type number. 'n' specifies the start column 'm' specifies the last column. If the record type is in one column, ie MAX REC TYPES is less than 10, just specify the start column.

The columns specified must be within the range specified on the MAX INPUT COLS command. The record type number must be on the first line of any multi-line input records. (If records on input files are all of one type, the RECTYPE= clause can be used for the batch data input run and the record type number omitted.)

The number of columns should be large enough to hold the value of the maximum record number. For example, if up to 99 record types are allowed, specify two columns.

The default is columns 79 and 80.


SYSTEM SECURITY

SYSTEM SECURITY readpw, writepw

Specifies the passwords associated with the SYSTEM SECURITY LEVEL, if specified. Log on to the database with these passwords to access the system utilities. Currently, only UNLOAD FILE is restricted by the SYSTEM SECURITY LEVEL and therefore this command is not usually specified.

Logging on with a password which is associated with the system security level gives access to all functions.

SYSTEM SECURITY LEVEL

SYSTEM SECURITY LEVEL n

N specifies the security level at which a user can perform a set of DBA-only commands. Log on to the database with the write password associated with this level to access the system utilities. The default system security level is 30.

Currently, only UNLOAD FILE is restricted by the SYSTEM SECURITY LEVEL and therefore this command is not usually specified.


TEMP VARS

TEMP VARS varlist

Names temporary variables for use in computations during entry of data with the Batch Data Input utilities. Computations include COMPUTE, RECODE, IF, ACCEPT REC and REJECT REC commands.

Temporary variables are not stored in the database.


WRITE SECURITY

WRITE SECURITY (leveln) password ....

Establishes the write security levels and associated passwords. There are 31 levels of security, from 0 (zero), the lowest, to 30, the highest. Repeat the complete specification for each password. Database passwords are a SIR2002 name and must conform to the name format. That is: names are no longer than 8 characters, begin with an alphabetic character and can contain alphanumeric characters and the four special characters # $ @ _. For example:

WRITE SECURITY (1) CLERK (2) SUPER (3) MANAGER

When a user logs in to the database, they specify a Write Security Password. If this matches a password in this list, then they are assigned that security level. If they do not login with a valid write security password, they are assigned level zero.

If security passwords are not defined, anyone who logs on to the database is assigned level 30 (database administrator) write permission.

One level is associated with one password. That is, there may be a password for level 1, a password for level 2, and so on. There cannot be two passwords for the same level. Write access at a particular level grants write access for all lesser levels.


ACCEPT REC IF

ACCEPT REC IF (logical expression)

Only applies to batch data input

Specifies the criteria for accepting records using the Batch Data Input utilities. When the logical expression is TRUE, the record is entered into the database. Multiple ACCEPT REC IF commands can be defined to specify multiple acceptance criteria. If a record passes any one test, it is accepted. If ACCEPT REC IF is specified, all records which do not pass a test are rejected.

ACCEPT REC IF (AGE GE 16 AND LE 65)

(For a full explanation of logical expressions, please see Conditions.)


CAT VARS

CAT VARS varname ('value' .... ) / ....

Specifies string variables that are held as categorical integers and defines the set of string values that can be input for the variable.

The values in the value list are each enclosed in single quote marks (') and the list for a variable is enclosed in parentheses. Specifications for multiple variables are separated with a slash (/).

Within the database, categorical variables are held as integers which are the position of the string in the value list. For example:

CAT VARS SEX   ('MALE' 'FEMALE' )/
         STATE ('AL' 'AK' ....'WY')
Specifies that the variable SEX is categorical. On input 'MALE' is converted to a 1, 'FEMALE' to a 2.

The variable STATE definition illustrates a list of abbreviations of American states. On input 'AL' is converted to a 1, 'AK' to a 2, etc.

When entering data into a CAT VARS, the string value is input, not the code. Note the difference to value labels, where a code is input and a string is associated with the code.


CHARACTER

CHARACTER*n varname ....

Specifies variables as character. n may be from 1 to 4094.

Example:

CHARACTER*40 NAME


COMPUTE

COMPUTE variable = expression

Only applies to batch data input

COMPUTE performs arithmetic or string transformations on common, record or temporary variables in Batch Data Input as each record is read. If the computed variable has not been defined, a new database variable is created at the end of the record. It is recommended that computed variables are defined with the appropriate command.

Case and Key variables cannot be computed.


CONTROL VARS

CONTROL VARS variable ....

Declares a list of variables that are Control variables for the TABULATE procedure. These variables must be numeric and must have either Valid Values or Variable Ranges defined. By default, variables that have Valid Values or Value Labels are Control Variables. All other numeric variables are Observation Variables, that is variables with continuous values.


DATA LIST

DATA LIST [(num-lines)]
  [/line-no]   varname  from-column [- to-column] [(type)]
  [/line-no]   varlist  from-column [- to-column] [(type)]....
Defines the variables and input format for a record. You can either use the DATA LIST or the
VARIABLE LIST / INPUT FORMAT to define the record.

The definition consists of the name, batch data input column locations and data type for each variable. The order in which the variables are specified determines the order in which they are held. This determines the order in "to" lists and the sequence of the variables wherever they are referenced, regardless of the physical order on the batch data input record.

If the complete batch data input record is contained on more than one physical record (line) then the num-lines defines the number of lines which make up the complete record and the line-no defines which line each variable is on. When the input record is only one line, omit the number of lines and line number. The line-no can be omitted for any subsequent variables on the same physical input record.

The from-column determines the start position of the variable.

The to-column specifies the ending position for variables that are longer than one column.

The data type of each variable is defined as follows:

A
String.
I
Integer.
Fn
Single precision floating point. On batch data input, n columns at the right of the input field comprise the decimal component of the number. An explicit decimal point on input overrides the format specification.

Dn
Double precision floating point. On batch data input, n columns at the right of the input field comprise the decimal component of the number. An explicit decimal point on input overrides the format specification.

DATE
Date variable in the given date format. The specification consists of the word DATE and the date format, all enclosed in parentheses. The date format consists of a combination of the letters M(month), D(day), Y(year), and I(ignore). Like characters must be kept together, e.g a format such as (DATE 'MYYYM') is illegal. Julian dates, using a combination of year and day-number (1-365), are allowed. A Julian date has 3 or more D's and no M's. e.g. (DATE 'DDDYY'). "I" is used to ignore separators such as slashes.

TIME
Time variable in the given format. The specification consists of the word TIME and the time format, all enclosed in parentheses. The time format consists of a combination of the letters H(hour), M(minute), S(second), and I(ignore). Like characters must be kept together, e.g. a format such as (TIME 'HMMH') is illegal.

If the type is omitted, the default is floating point with zero decimal portion.

Example:

DATA LIST  (2)
        /1 ID        1 - 4   (I)
           POSITION  6 - 7   (I)
           STARTDAT  8 - 15  (DATE,'MMIDDIYY')
           STARTSAL  17 - 20 (F2)
           DIVISION  21      (I)
        /2 NAME      6 - 30  (A)
           GENDER    31      (I)
           MARSTAT   32      (I)
           SSN       33 - 43 (A)
If a varlist is specified, (that is either a list of variable names or a list in the form varname to varname), multiple variables, all of the same size and type, can be defined. The columns specified to contain these variables must be evenly divisible by the number of variables in the list.


DATE VARS

DATE VARS varname .... ('date_format') / ....

Specifies that previously defined character variables are date integers with a given date format.

Date integers are a number of days since October 15, 1582.

Date formats may be specified directly on the DATA LIST or INPUT FORMAT commands. If using DATE VARS, the variable is specified as a character string on the DATA LIST or INPUT FORMAT commands.

Multiple variables in the same format can be defined with one format specification; additional specifications must be separated by slashes.

The date format string is a combination of the letters D(day), M(month), Y(year) and I(ignore). The M, D and Y strings can not be split; for example, the format ('YIMMIY') is illegal.

You can define input date formats where some portion of the year has to be computed. This is done as follows:

Julian Dates (year plus days from 1 - 366) are specified with a format with no months and 3 or more characters for the day. Example:

DATE VARS   BEGNDATE ENDDATE ('MMIDDIYYYY') /
            JULDATE          ('YYDDD')


DOCUMENT

DOCUMENT text

Specifies that the text following the command is commentary. This text is stored within the database and can be printed using the utility LIST SCHEMA.

When DOCUMENT is placed within record definition commands, it becomes part of the definition for that record type.

DOCUMENT text cannot be partially modified. To update the text, run the command with new text. The new document text completely replaces the old.


END SCHEMA

END SCHEMA

Specifies the end of the commands for a record set. If it is not specified, the end of the commands, START TASK or END TASK or the start of a new RECORD SCHEMA or MODIFY SCHEMA terminates definition of the record type. Any other commands are treated as record definition commands.


IF

IF (logical-condition) varname = expression; ....

Only applies to batch data input

Assigns the result of an expression to a variable if the logical condition is true. Multiple variables can be assigned values on a single condition. Variables referenced must be within this record or must be common vars. If the computed variable has not been previously defined, it is added to the defined database variables. For example:

IF (JOBCODE = 1) REVDATE = TODAY(0) + 365


INPUT FORMAT

INPUT FORMAT (format specifications)

INPUT FORMAT is associated with, and immediately follows, the VARIABLE LIST command.

Specify a data type, size and format for each variable on the VARIABLE LIST.

An input file may have multiple lines of data for each database record. Lines in an input record may be any length up to the length specified on MAX INPUT COLS. Specify a slash (/) to indicate the start of the second and subsequent line of data. The slash can also be used to skip one or more lines of an input record.

Separate each format specification by a comma or a space. If the format specifications require more than one line, continue the specification on the next line leaving column one blank.

Specify a single format and a repetition factor for multiple variables with the same format or groups of variables with the same format. To repeat a format, specify the number of times to repeat it, followed by either a single format or a group of formats enclosed in parentheses. For example:

VARIABLE LIST VAR01 TO VAR50
INPUT FORMAT (10I2, 20(I1,I4))

The VARIABLE LIST with the TO format defines 50 integer variables named VAR01, VAR02, ... VAR50.

The first repeating format (10I2) defines the first 10 variables which results in VAR01 to VAR10 as two digit integers.
The repeating group of formats, 20(I1,I4), defines 20 sets of two alternate variables. This results in VAR11, VAR13 and subsequent odd numbered variables as one digit integers (I1) and VAR12, VAR14 and subsequent even numbered variables as four digit integers (I4).

Enclose the whole format specification in parentheses. The individual format specifications are as follows:

Fw.d or Dw.d
A floating point variable. "F" is single precision, "D" is double precision. On batch data input the variable occupies "w" positions on the input file with the rightmost "d" positions as the decimal component. A decimal component must be specified; zero is valid. If Batch Data Input is not used the decimal component has no effect. Specifying a physical decimal point on input overrides any specification. For example:
VARIABLE LIST TEMP SALARY
INPUT FORMAT (F5.3, D8.2 )

Iw
An integer variable occupying "w" positions on batch data input. For example:
VARIABLE LIST STATUS, AGE
INPUT FORMAT ( I1 ,  I2 )

Aw
A character (alphanumeric) variable occupying "w" positions. For example:
VARIABLE LIST NAME ADDRESS
INPUT FORMAT ( A25 , A40 )

nX
A positioning operator for Batch Data Input utilities. It skips "n" columns of an input data record. For example:
VARIABLE LIST NAME ADDRESS
INPUT FORMAT ( A25 , 4X , A40 )

This defines two alphanumeric variables. NAME occupies positions 1 through 25 of the input record. 4X skips the next 4 columns (after NAME). ADDRESS is 40 characters long beginning in position 30.

Tn
A positioning operator for Batch Data Input utilities. It tabs to a specific column "n". The next variable begins in column "n". The "T" specification can be used to move forward or backward over the current input line and can be used to reread a particular field. For example
VARIABLE LIST NAME ADDRESS PHONE AREACODE
INPUT FORMAT (T3,A20,T25,A40,T72,A12,T72,A3)
This defines four string variables using the T operator to locate the beginning of each variable. Note that the variables PHONE and AREACODE both begin in column 72.

DATE 'date format'
Describes an input character variable as a date according to the specified date format. The date format is a combination of the letters D(day), M(month), Y(year) and I(ignore). The M, D and Y specifications can not be split; for example, the format ('YIMMIY') is illegal.

You can define input date formats where some portion of the year has to be computed. This is done as follows:

  • If only two digits of the year are entered, they are tested against the century split parameter CENY. This is 1920 by default and can be set at run time. Two digit years greater than the century split are set to the specified century; two digit years less than this are set to the next century. e.g 99 becomes 1999; 02 becomes 2002. This calculation is not dependant on the current date in the system and therefore does not alter at any particular point in time.
  • If the year is omitted completely it is taken as the current year.

Julian Dates (year plus days from 1 - 366) are specified with a format with no months and 3 or more characters for the day.

The date is held internally as the number of days since the start of the Gregorian calendar.

TIME'time format'
Describes an input character variable as a time according to the specified time format. Time format is a combination of the letters H(hours), M(minutes), S(seconds) and I(ignore). The time format is used by the system to interpret the string at input time. The units cannot be split; for example, ('HMMH') is an illegal format. HH is the 24-hour clock. Time is converted and stored internally as the number of seconds from midnight. For example:
VARIABLE LIST NAME BIRTHDAY BIRTHTIM
FORMAT (A25, DATE 'MMIDDIYY', TIME 'HHIMM')

This example defines three variables for a record type. NAME is in the first 25 positions; BIRTHDAY is in the next eight positions and is a date variable; BIRTTIM is a time variable. The first two characters are Hours (24 hour clock), the third character is ignored and the last two are minutes.


INTEGER

INTEGER*n varname ....

Specifies variables as integer which can hold positive or negative numbers. n may be 1, 2 or 4 and refers to the internal storage size in bytes. 1 byte holds numbers up to 123; 2 bytes holds numbers up to 32,763; 4 bytes holds numbers up to 2,147,438,643.

If this is subsequently defined as a SCALED VAR, the internal integer must be able to store the significant digits needed for the number. For example if Scale (-2) is specified, the largest number that can be held in I*4 is 21,474,386.43

Example:
INTEGER*4 SALES VAR1 to VAR5


KEY FIELDS

KEY FIELD[S] varname [(A|D|I)] ....

Defines the keys for the record. Any record type which has more than one single physical record per case on a case structured database and every record type with more than one single physical record in a caseless database must have a key.

The KEY FIELD command must be before the DATA LIST or VARIABLE LIST.

The key fields must appear in the DATA LIST or VARIABLE LIST

Key field variables cannot be created or modified by COMPUTE, IF or RECODE commands.

The sort specification applies to each variable individually.

Example:

CASE ID         ID
RECORD SCHEMA   3 REVIEW
KEY  FIELDS     POSITION  REVDATE (D)
VARIABLE LIST   ID POSITION REVDATE          RATING  NEWSAL IDSUPER
INPUT FORMAT   (I4 I2       DATE('MMIDDIYY') I2      F8.2   I4)


MAX REC COUNT

MAX REC COUNT n

For a case structured database this command specifies the maximum occurrences of a record type for any one case in the database. If a value is not specified for a record type, the MAX REC COUNT from the database specification is used. The number specified for a record type may be larger or smaller than specified at the database level. The default value is 100.

Counts are kept for each record type in a case in the CIR for that case. They are stored as 1, 2, or 4 byte integers depending on the count specified. A count of less than 124 takes 1 byte, less than 32,763 takes 2, and larger numbers take 4. If MAX REC COUNT is modified after data for that record type has been loaded, and the new number takes the same size integer, restructuring is unnecessary. If a larger size integer is needed, the database must be restructured.

For caseless databases, MAX REC COUNT specifies the maximum number of records of this type that the database can hold. The default value is 1,023,000. This limit cannot be exceeded but can be changed without a database restructure. There is no overhead with specifying a large value, the only constraint is that total number of records is a number which can be stored in one integer. The total number of records allowed is 2,147,483,648.


MISSING VALUES

MISSING VALUES varname (value1 [value2 [,value3]] )/ ....
               varlist (value1 [,value2 [,value3]] )/ ....
Specifies up to three values which are missing values for the variable(s). Missing values are excluded from
statistical procedures and functions. When the variable is input or modified, and one of the specified values is input, the appropriate missing value is set.

The value can be a numeric constant, a string constant, or the keyword BLANK. If BLANK is specified as a missing value for a numeric variable, then a blank field on input results in a missing value, otherwise a blank numeric field is translated to zero.

Any variable can be missing and has a system missing value. When a record is written to the database, a variable is assigned the system missing value when it cannot be assigned a legal value or a specified missing value. This happens when:

Specify any missing values for string, categorical, date and time variables as strings. If the variable is longer than the missing value, then the variable is set to missing values if the leftmost characters match the specified missing value.

Specify any missing values for scaled variables as the unscaled value with the decimal point specified where necessary.

Example:

MISSING VALUES ID POSITION DIVISION (BLANK)
               STARTDAT ('01/01/01')


OBSERVATION VARS

OBSERVATION VARS varname ....

Specifies variables which the TABULATE procedure uses as observation variables. An observation variable is one that is aggregated rather than treated as a control. By default, variables that have VALID VALUES or VALUE LABELS are Control Variables. OBSERVATION VARS makes these observation variables.


REAL

REAL*4 varname ....
REAL*8 varname ....

Specifies variables as real. n may be 4 or 8.

Example:
REAL*8 SALARY


REC SECURITY

REC SECURITY rlevel , wlevel

Defines the default minimum security levels required for reading (rlevel), or writing (wlevel), any variable in the record. The read and write levels are integers between 0 (zero), the lowest and 30, the highest.

This command sets the minimum VAR SECURITY for each variable in the record type. Individual variables within a record type can be assigned higher security levels using the VAR SECURITY command.

The default is 0 level security.

Example:

REC SECURITY 10,30

The variables in this record type can be read by anyone logged in with a read security password which has level 10 security or higher. Write access is restricted to personnel logged in with a write security password which has level 30 security.


RECODE

RECODE variable specification (recode specification)

Only applies to batch data input

RECODE changes the values of a string or numeric variable into new values. A variable can be recoded into itself or the content of the original variable can be left unchanged and a value assigned to another variable.

The RECODE has two parts the Variable specification and the Recode specification.

Variable Specification

The variable specification takes four forms:

Recode Specification

A recode specification follows the variable specification and consists of a number of clauses, one per new value to assign. Enclose each clause in parentheses. These can take a number of forms:

Note the sequence of the variables in the variable specification and the sequence of values in the recode specification:

Recode Examples:

RECODE A (1,3,5,7,9=1)(2,4,6,8=2)
This sets A to 1 if it is odd, 2 if it is even, and leaves zero and missing values as is.

RECODE B = A (1,3,5,7,9=1)(2,4,6,8=2)
This sets B to 1 if A is odd, 2 if A is even and zero if A is zero. If A is missing, B is set to the value of A (whether this is a missing value for B or not). A is unchanged.

RECODE B = A (1,3,5,7,9='O')(2,4,6,8='E')
This sets B (which is a string) to 'O' for odd values of A, 'E' for even values of A and to the value of A if A is missing or has any other values.

RECODE STATUS = AGE (LO THRU 18 = 1) (19 THRU 21 = 2)
                    (22 THRU 65 = 3) (66 THRU HI =4)
This sets STATUS depending on the AGE of the subject. STATUS is 1 for ages 18 or under, 2 for ages 19 thru 21, 3 for 22 to 65 and 4 for over 65.

RECODE STATUS1 to STATUS10 =  TEST1 to TEST10(1 THRU 49=1)
                                             (50 thru 99=2)
This sets up ten status fields depending on the result of 10 tests.


RECORD SCHEMA

RECORD SCHEMA record number, record name [/LOCK]

Begins the set of commands to define a database record. This defines the name and number of the record and is a required command to define a record type.

LOCK

Specifies that the record type may be locked if the changes to the record definition would need a database restructure. Most changes to a record definition do not require a restructure.

A restructure may be required when modifying the key structure definition of a record type which already has data loaded into it. If the LOCK parameter is omitted and changes are specified that would cause a locked record type, a warning is issued and the schema changes do not take place. This means that a restructure is only done when expected.

It is good practice not to specify lock on the record schema statements except when the change is expected to lock the record and you are prepared to do a restructure.


REJECT REC IF

REJECT REC IF (logical condition)

Only applies to batch data input

Defines criteria for rejection of records during Batch Data Input. When the condition is true, the record is rejected and not entered into the database. Multiple REJECT REC IF commands can be specified.

The alternative method of specifying consistency criteria is with ACCEPT REC IF.

The record must pass all specified tests before being added to the database.


SCALED VARS

SCALED VARS varname (power) ....

Specifies that the previously defined integer variables are scaled. SCALED VARS are stored in the database as integers. This saves space and can be more accurate for fixed format numbers since it avoids the inherent inaccuracies of floating point representation.

POWER is a positive or negative number representing the power of ten by which the variables are scaled.

POWER is a positive or negative number representing the power of 10 by which the variable is scaled. The full, unscaled number, including the decimal point where necessary, is specified whenever the number is input by the user.

The scaled number is expected on batch data input.

Examples:

DATA LIST    VAR1      1-3 (I)
             VAR2      4-11 (I)
SCALED VARS  VAR1 (6) /
             VAR2 (-2)
This declares two variables as scaled variables. If these were later used in a program:

COMPUTE VAR2 = 345.67  (results in 34567 being stored)
COMPUTE VAR1 = 1000000 (results in 1 being stored)
COMPUTE VAR3 = VAR1 * 3
WRITE          VAR3    (results in 3000000 being printed)
If the batch data input file contained 123 in positions 1 to 3 and 00001234 in positions 4 to 11, then VAR1 would have an equivalent value of 123,000,000 and VAR2 would have an equivalent value of 12.34.


SEQUENCE CHECK

SEQUENCE CHECK ON | OFF

Only applies to batch data input

Sets the default for sequence checking of each line of input for this record type during Batch Data Input.

The default is OFF.

SEQUENCE COLS

SEQUENCE COLS n, m

Only applies to Batch Data Input

Specifies the column or range of columns that contain sequence information when batch data input for a record type has multi-line input.

If there is only one sequence column, the ending column number may be omitted and the command may be shortened to SEQUENCE COL.

These commands are obsolete for normal input of data from files.


TIME VARS

TIME VARS varname (time format) / ....

Declares string variables as times. Time format is a combination of the letters H(hours), M(minutes), S(seconds) and I(ignore). The time format is used by the system to interpret the string at input time. The units cannot be split; for example, ('HMMH') is an illegal format. HH is the 24-hour clock. Time is converted and stored internally as the number of seconds from midnight.

Example:

TIME VARS   ELAPSED       ('HHIMM')/
            MIN1 to MIN10 ('MMISS')


VALID VALUES

VALID VALUES varname  (value, .... )/
             varlist  (value, .... )/ ....
Defines the set of valid values for a variable. Valid values can only be specified for numeric variables. (Use the
CAT VARS command to create a list of valid values for string variables.)

The specified valid values are checked whenever a variable is input or modified.

If a value is assigned to the variable that is not in the VALID VALUES list or in the MISSING VALUES list, the value is not stored and the variable is set to undefined.

The varlist may be a specific list of variables or may be in the format VARA to VARX which specifies all the numeric variables between the named variables (listed in sequential order) in the record schema.

Example:

VALID VALUES JOBCODE          (1,3,4,5)/
             TEST1 to TEST9   (1,2,3,4,5,9)/
             TYPE KIND REASON (1,2,3,9)


VALUE LABELS

VALUE LABELS  varname1  (value1) 'label1'
                        (value2) 'label2' .... /
              varlist   (value1) 'label1' .... / ....
Specifies labels for particular values of a variable.

Each value for a variable is enclosed in parentheses. The value may be numeric or character depending on the variable type. Character strings are enclosed in quotes. The keywords UNDEFINED and BLANK can be used as a value to assign labels to the system missing value (undefined) or blank missing values.

The label is up to 40 characters long. It is good practice to enclose the label in quotes as this is a character string. If the label contains slashes or brackets then the label must be enclosed in quotes.

The varlist may be a specific list of variables or may be in the format VARA to VARX which specifies all the numeric variables between the named variables (listed in sequential order) in the record schema.

Example:

VALUE LABELS  GENDER         (1) 'Male'
                             (2) 'Female'/
              MARRIED        ('Y') 'Married'
                             ('N') 'Not Married' /
              TEST1 to TEST9 (1) 'Passed'
                             (2) 'Failed'


VARIABLE LIST

VARIABLE LIST varname1 varname2 ....

Names the variables on the input record for a given record type. Together with the INPUT FORMAT, this describes the input record. There is a one-to-one correspondence between the variables on the VARIABLE LIST and the format specifications on the INPUT FORMAT.

The order of the variables on the VARIABLE LIST defines the order in which they are held on the database.

Variable names can be separated by spaces or commas. To continue the list on multiple lines, leave column one blank on each subsequent line.

Example:

VARIABLE LIST ID JOBCODE REVDATE SALARY


VAR LABELS

VAR LABELS
       varname1 short-label [;extended-label]/
       varname2 short-label [;extended-label]/ ....
Specifies labels for variables.

The label can be in two parts. The first part is up to 56 characters. This is used by SIR2002 instead of the variable name wherever it is appropriate, for example, on report headings, screen layouts, etc. The second part is used by the data dictionary to describe the variable on listings and displays. To split the label into these two parts, separate them with a semi-colon. The dictionary uses the whole label; that is the short label plus the string after the semi-colon. It is good practice to enclose each portion of the label in quotes.

Example:

VAR LABELS  ID        'Identification Number'/
            POSITION  'Position Level'/
            STARTDAT  'Starting date'; 'this level'/
            STARTSAL  'Starting salary'; 'this level'/
            DIVISION  'Division'/
In this example, "Starting date" is printed or displayed instead of "STARTDAT" and "Starting salary" instead of "STARTSAL"


VAR RANGES

VAR RANGES varname (min,max) / ....

Specifies the range of values for a variable. The ranges defined for a variable are checked whenever that variable is input or modified. Input values outside the specified range are set to undefined.

Example:

VAR RANGES  POSITION (1 18)/
            STARTSAL (10000 90000)/
            DIVISION (1 3)/
            STARTDAT ('01/01/80', '01/01/99')
If both VAR RANGES and
VALID VALUES are specified, both specifications apply. Only values consistent with both specifications are allowed into the database. Normally, only one of these would be specified.


VAR SECURITY

VAR SECURITY varname (rlevel, wlevel) / ....

Defines security level values for reading and writing individual variables.

Rlevel and wlevel are integers between 0 (zero) the lowest, to 30 the highest. The VAR SECURITY assigned to an individual variable must be higher than the security level assigned to the record through REC SECURITY. (Assigning a lower level is possible but has no effect.)

Example:

RECORD SCHEMA ....
REC SECURITY 0 5
  .
VAR SECURITY SALARY (6 10)
In this example, anyone can read the data in this record type, but only users logged in with passwords at level 5 or above for write security can write data. The variable SALARY is made more secure, since it requires that read access is at level 6 or above and write security at least at level 10.


CREATE DBINDEX

CREATE [UNIQUE] DBINDEX index_name
        ON [database.]recname
        (var_name [ASC|DESC] [UPPER] [, ...] )
CREATE DBINDEX creates the index structure. If the command is part of a schema definition, it must follow the complete definition for the record type referenced. There may be multiple indexes for a given record type.

If the record type already contains data, the index is automatically built from the values of any existing records. As records are added, deleted or modified through any of the SIR2002 modules including VisualPQL, batch data input, Forms and SQL, the index is automatically maintained. VisualPQL and PQLForms are the only modules that process database records using secondary indexes.

Indexes are maintained across cases in a case-structured database and, if a record is retrieved using a secondary index, the appropriate case is automatically found. Index variables can be any record variable plus the case id. Common vars cannot be used in an index.

Indexes are rebuilt whenever the database is recovered i.e. from an Import or a Reload. The backups contain only the index definition not the index data.

UNIQUE
Specifies the index can only contain unique values. If data already exists and a non-unique value is found, the index cannot be built. If an attempt is made to add or modify a data record such that a non-unique value would result, the update is rejected.

index_name
The index name can be up to 32 characters and must follow the rules for SIR2002 32 character names. (The first character must be alphabetic. Characters can be letters, digits or special characters ($, #, @, _). Names are translated to upper case so uppercase and lowercase letters are equal. If you wish to use a name which does not conform to these rules, the name must be enclosed in quotes using correct upper and lower case letters as necessary.)
The index name must be unique within the database.

ON recname
Specify the record name or number, qualified by a database name if this is not the default database. The database must be connected.

var_name
Specify the name(s) of the variable(s) used for this index. These must be variables in the named record (not common vars except for the case id).

Specify the keyword DESC to maintain the index in descending sequence of the variable.

Specify the keyword UPPER to use an uppercase representation of a character variable in the index.

DROP DBINDEX

DROP DBINDEX index_name ON [database.]recname | ALL
DROP DBINDEX deletes either a specific index or all indexes for a database.


SIR SCHEMA LIST

SIR SCHEMA LIST
    [FILENAME= fileid /]
    [DETAILED|LABELS|REGULAR /]
    [LONG|SHORT /]
    [STRUCTURED /]
    [CIR /]
    [RECTYPES={recname|recnum} [(variable list)]... /]
Produces a listing of the current data definitions. The FILENAME specifies the output file. If this is omitted, the output is displayed in the scrolled output window.

By default, all record types in the database are listed. By default, all variables in the record type are listed. Each variable has a label that describes the variable and its position within the record. Positions are shown as Cnnn, Rnnn, or Tnnn where C stands for common variable, R for record variable and T for temporary variable. The nnn denotes the position of the variable within the record.

The exact format of the report depends on the options specified:

Examples: To list the name and labels of all the variables in record type 1 and the specified variables in record 3.

SIR SCHEMA LIST LABELS/
                RECTYPES = 1 , 3 (POSITION REVDATE RATING)
To list all the variables in all record types without value labels.
SIR SCHEMA LIST

Example Output:

1.1      LIST SCHEMA LONG     07/09/01  10:05:57
        *** RECORD 1 (EMPLOYEE) DEFINITION ***
        Record Type 1 contains demographic information.
        There is one record per employee.  The record contains
        current position level and salary and the date
        on which the salary was last changed.

MAXIMUM NUMBER OF RECORDS/CASE        1
NUMBER OF THIS TYPE IN FILE           20
LINES IN EACH INPUT RECORD            1
ENTRY USE COUNT                       1
SEQUENCE CHECK                        OFF
CASE IDENTIFIER:                      ID       (A)

        *** INPUT VARIABLE DEFINITIONS ***
C1.     ID,       Identification Number
        INPUT  ON LINE:  1
               COLUMNS:  1 - 4
                FORMAT:  I4
        DATA TYPE:       I*2
        MISSING VALUE:   (BLANK)

R1.     NAME,     Name
        INPUT  ON LINE:  1
               COLUMNS:  6 - 30
                FORMAT:  A25
        DATA TYPE:       A*27
        MISSING VALUE:   (BLANK)

R2.     GENDER,   Gender
        INPUT  ON LINE:  1
                COLUMN:  31
                FORMAT:  I1
        DATA TYPE:       I*1
        RANGE:           1/2
        MISSING VALUE:   (BLANK)
        VALUE LABELS:    (1) Male
                         (2) Female


WRITE SCHEMA

WRITE SCHEMA
    [FILENAME= fileid/]
    [RECTYPES= rectype list/]
    [CIR/]
    [FORMS/]
         [BOOLEANS/]
         [COMPUTES/]
    [MASKPW/]
    [NOINDEX/]
    [NOMAXKEY/]
    [PASSWORD/]
    [PQLFORM/]
         [NOUPDATE/]
         [SUBROUTINE/]
    [SECURITY/]
Writes a text file containing the schema definition. This might be used to recreate the database without data or procedures or, if it is the schema for a single record type, as the starting point to update that record definition. If mass changes are required to a database definition, it is sometimes easier to create a schema file and use a text editor to do global changes rather than modifying individual records through menus.

With the PQLFORMS parameter, this utility creates a default PQLForm.

With the FORMS parameter, this utility creates a default old Form.

If no record types are specified, the database definition and all record definitions are written excluding passwords.

FILENAME

Specifies the output file. If this is omitted, the output is displayed in the scrolled output window.

RECTYPES

Specifies the record types for which record or form definitions are generated.

CIR

Specifies that a record definition is written for the CIR.

FORMS

Creates a default old style form. Unless otherwise specified, the CIR (Common Information Record) is not included in the form definition. Specify the keyword BOOLEANS to use any ACCEPT REC IF or REJECT REC IF specifications to generate appropriate commands in the output form. Specify the keyword COMPUTES to use any COMPUTE and IF commands to generate appropriate commands in the output form.

MASKPW

Specifies that an asterisk (*) is written instead of passwords.

NOINDEX

Specifies that index definitions are not written so that the schema can be used by earlier versions of SIR.

NOMAXKEY
Suppresses the writing of a specific MAX KEY command to the output file. This option allows the system to recalculate the maximum key size and should be selected whenever schema modifications have been made unless a larger key is required for future expansion.

PASSWORD

Specifies that the database password is written to the file.

PQLForms

Creates a default PQLForm. Unless otherwise specified, the CIR (Common Information Record) is not included in the PQLForm definition. Specify the keyword NOUPDATE for a read-only PQLForm. Specify the keyword SUBROUTINE for a PQLForm that compiles and saves as a sub-routine.

SECURITY

Specifies that the database security level passwords are written to the file.

homecontents start chapter top of pagebottom of pagenext page index