Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

More

Format

Examples

name

path-name

text

field-attributes

RDB/VMS Relational Database Operator DEFINE_FIELD — VMS RDB_4.2

 Creates a global field definition.

 When the DEFINE FIELD statement executes, Rdb/VMS adds the field
 definition to the physical database.  A field definition includes a
 name, a data type, and a set of optional clauses.

 Example:

      DEFINE FIELD LABEL
         DATATYPE IS TEXT SIZE IS 8 CHARACTERS
         MISSING_VALUE IS "Not here"
         VALID IF LABEL =  "Good"       OR
                  LABEL =  "Bad"        OR
                  LABEL =  "Mediocre"   OR
                  LABEL MISSING
         QUERY_HEADER FOR DATATRIEVE IS "Column"/"Label".

Additional information available:

MoreFormatExamples

More

 To define a field using the DEFINE FIELD statement, you must have the
 Rdb/VMS DEFINE privilege for the database.

 If you have invoked the database with the PATHNAME specification, the
 field definition is also added to the data dictionary.  Once you have
 defined a field globally, any relation can use the field definition
 by using the field name in the DEFINE or CHANGE RELATION statement.

 You can copy a shareable field definition from the data dictionary
 into the database.

 You must execute this statement in a read/write transaction.  If
 there is no active transaction and you issue this statement, Rdb/VMS
 starts a read/write transaction implicitly.

 Other users are allowed to be attached to the database when you issue
 the DEFINE FIELD statement.

Format

 DEFINE FIELD ─────────> name ────────────────────>────────────────────┐
                                                                       │
 ┌───────────────────────────────<─────────────────────────────────────┘
 │
 └─┬────> 
F

R

O

M

P

A

T

H

N

A

M

E
───────────────> path-name ──────>───────┬────> . │ │ └─┬───────────────>───────────────┬───> field-attributes ─────┘ └─> 
D

E

S

C

R

I

P

T

I

O

N
typebox (I)typebox (S) typebox (/)typebox (*) text */ ──┘

Additional information available:

namepath-nametextfield-attributes

name

 Name of the field you want to create.  You must use a field name that
 conforms to VMS naming conventions.

path-name

 A full or relative data dictionary path name specifying the source of
 the field definition.  You must invoke the database by path name if
 you plan to copy a shareable field definition from the data
 dictionary.

 The name you give to the field must match the name of the field in
 the data dictionary.  You cannot rename a shareable field.

text

 A text string that adds a comment to the field definition.

field-attributes

 A list of definitions that indicate what type of data you can store
 in the field and how Rdb/VMS uses that data.  The field attributes
 include the data type and the following optional clauses:

  o  VALID IF
  o  MISSING_VALUE
  o  DATATRIEVE support clauses

 Do not use multiple, conflicting clauses in a field definition.

 For a complete description of field attributes, ask for HELP on
 Field_attr.

Examples


 Example 1:  Using DEFINE FIELD

 DEFINE FIELD STANDARD_ID_NUMBER
     DATATYPE IS SIGNED LONGWORD.

 This statement gives a name to the field and specifies its data type.


 Example 2:  Using DEFINE FIELD with VALID IF

 DEFINE FIELD SEX
    DATATYPE IS TEXT SIZE IS 1
    VALID IF SEX = "M" OR SEX = "F".

 This definition provides validation criteria.  When a user tries to
 enter a value other than "M" or "F" in a field that refers to this
 definition, Rdb/VMS returns an error message.


 Example 3:  Using DEFINE FIELD with DATATRIEVE Support

 DEFINE FIELD SALARY_AMOUNT
     DATATYPE IS SIGNED LONGWORD
     DEFAULT_VALUE FOR DATATRIEVE IS 0
     EDIT_STRING FOR DATATRIEVE IS "$$$$,$$9.99".

 This example adds a DATATRIEVE edit string and default value to the
 name and data type.

 Example 4:  Copying a Field from the data dictionary

 DEFINE FIELD SALARY_AMOUNT
   FROM PATHNAME 'DISK1:[CDDPLUS.DEFS]PERS.SALARY_AMOUNT'.

 This example copies the shareable field, SALARY_AMOUNT, from the
 dictionary.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026