Previous Topic: RECORD (REPORT/TRANSACTION)Next Topic: RECORD ELEMENT Substatement


RECORD Statement

Syntax

RECORD (REPORT) (TRANSACTION) statement

►►─┬─ ADD ─────┬─┬─ RECord ──────┬─ name is record-name ──────────────────────►
   ├─ MODify ──┤ ├─ REPort ──────┤
   ├─ REPlace ─┤ └─ TRAnsaction ─┘
   └─ DELete ──┘

 ►─┬────────────────────────────────────────────┬─────────────────────────────►
   └─ Version is ─┬─ version-number ──────────┬─┘
                  └─┬─────────┬─┬───────────┬─┘
                    └─ NEXt ──┘ ├─ HIGhest ─┤
                                └─ LOWest ──┘

 ►─┬─────────────────────────────────────────────────────────┬────────────────►
   └─┬─ PREpared ─┬─ by user-id ──┬────────────────────────┬─┘
     └─ REVised ──┘               └─ PASsword is password ─┘
 ►─┬────────────────────────────────────┬─────────────────────────────────────►
   └─ ENTIty type is ─┬─ RECord ──────┬─┘
                      ├─ REPort ──────┤
                      └─ TRAnsaction ─┘

   ┌────────────────────────────────────────────────────────────────────────┐
 ►─▼┬──────────────────────────────────────────────────────────────────────┬┴─►
    └ SAMe as ┬ RECord ─────┬ record-name ┬───────────────────────────────┬┘
              ├ REPort ─────┤             └ Version is ┬ version-number ─┬┘
              └ TRAnsaction ┘                          ├ HIGhest ────────┤
                                                       └ LOWest ─────────┘
   ┌──────────────────────────────────────────────────────────────────────────
 ►─▼─┬────────────────────────────────────────────────────────────────────────►─
     └─ COPY ─┬─ ALL COMments TYPes ─┬────────────────────────────────────────
              ├─ COMments ───────────┤
              ├─ DEFinition ─────────┤
              ├─ ATTributes ─────────┤
              ├─ USERS ──────────────┤
              ├─ RECords ────────────┤
              ├─ REPorts ────────────┤
              ├─ TRAnsactions ───────┤
              ├─ comment-key ────────┤
              └─ relational-key ─────┘

  ─────────────────────────────────────────────────────────────────────────┐
─►───────────────────────────────────────────────────────────────────────┬─┴──►
  ── FROm ┬───────────────┬ record-name ┬───────────────────────────────┬┘
          ├─ RECord ──────┤             └ Version is ┬ version-number ─┬┘
          ├─ REPort ──────┤                          ├─ HIGhest ───────┤
          └─ TRAnsaction ─┘                          └─ LOWest ────────┘
 ►─┬─────────────────────────────┬─┬──────────────────────────────────────┬───►
   └ NEW NAMe is new-record-name ┘ └ Version is ─┬─ version-number ─────┬─┘
                                                 └─ NEXt ─┬─ HIGhest ─┬─┘
                                                          └─ LOWest ──┘

 ►─┬───────────────────────────────────────────┬──────────────────────────────►
   └─ NEW Version is ─┬─ new-version-number ─┬─┘
                      └─ NEXt ─┬─ HIGhest ─┬─┘
                               └─ LOWest ──┘

 ►─┬──────────────────────────────────────────────────────┬───────────────────►
   └─┬───────────────┬─ DEScription is description-text ──┘
     ├─ record ──────┤
     ├─ report ──────┤
     └─ transaction ─┘
   ┌─────────────────────────────────────────────────────────────────┐
 ►─▼─┬─────────────────────────────────────────────────────────────┬─┴────────►
     └─┬─ INClude ◄ ─┬─ USEr is user-id ──┬──────────────────────┬─┘
       └─ EXClude ───┘                    └─ user-specification ─┘

(for complete user-specification syntax, see USER clause)

 ►─┬──────────────────────────────────────────────────────┬───────────────────►
   └─ PUBlic access is ─┬───────────┬─ for ─┬─ ALL ◄ ───┬─┘
                        └─ ALLOwed ─┘       ├─ NONe ────┤
                                            ├─ UPDate ──┤
                                            ├─ MODify ──┤
                                            ├─ REPlace ─┤
                                            ├─ DELete ──┤
                                            └─ DISplay ─┘

 ►─┬────────────────────────────────────────────────────┬─────────────────────►
   └──┬─ RECord ──────┬─ STOrage is storage-indicator ──┘
      ├─ REPort ──────┤
      └─ TRAnsaction ─┘
 ►─┬─────────────────────────────────────────────┬────────────────────────────►
   └─ FORmat is ─┬─ PRIMAry ◄ ─────────────────┬─┘
                 └─ alternate-format-keyword ──┘

 ►─┬────────────────────────────────────┬─────────────────────────────────────►
   └─ OCCurrences are occurrence-count ─┘

 ►─┬──────────────────────────────────────────────────────────────────────────►─
   └─┬ INClude ◄ ─┬ WIThin FILe file-name ┬───────────────────────────────┬───
     └ EXClude ───┘                       └ Version is ┬ version-number ─┬┘
                                                       ├ HIGhest ────────┤
                                                       └ LOWest ─────────┘
─►──────────────────────────────────────────────────┬─────────────────────────►
  ───┬────────────────────────────────────────────┬─┘
     │ ┌────────────────────────────────────────┐ │
     └─▼─ KEY is element-name ─┬──────────────┬─┴─┘
                               ├─ ASCending ──┤
                               └─ DEScending ─┘

   ┌────────────────────────────────────────────────────────────────────────┐
 ►─▼┬──────────────────────────────────────────────────────────────────────┬┴─►
    └┬─ INClude ◄ ┬┬ LANguage ──┬ is attribute-name ─┬────────────────────┬┘
     └─ EXClude ──┘├ MODe ──────┤                    └ TEXt is user-text ─┘
                   └ class-name ┘
   ┌──────────────────────────────────────────────────────────────────────────
 ►─▼─┬────────────────────────────────────────────────────────────────────────►─
     └┬ INClude ◄ ─┬┬─ RECord ─────┬ name SYNonym is ─────────────────────────
      └ EXClude ───┘├─ REPort ─────┤
                    └─ TRAnsaction ┘

  ───────────────────────────────────────┐
─►─────────────────────────────────────┬─┴────────────────────────────────────►
  ─┬─────────────────────────────────┬─┘
   └─ record-synonym-specification ──┘

(expanded record-synonym-specification syntax follows this syntax diagram)
   ┌──────────────────────────────────────────────────────────────────────────
 ►─▼─┬────────────────────────────────────────────────────────────────────┬───►─
     └─┬ INClude ◄ ─┬─ relational-key is ─┬─ RECord ──────┬─ record-name ─┘
       └ EXClude ───┘                     ├─ REPort ──────┤
                                          └─ TRAnsaction ─┘

  ───────────────────────────────────────────────────────────────────┐
─►─────────────────────────────────────────────────────────────────┬─┴────────►
  ─┬────────────────────────────────────┬──┬─────────────────────┬─┘
   └─ Version is ─┬─ version-number ─┬──┘  └─ TEXt is user-text ─┘
                  ├─ HIGhest ────────┤
                  └─ LOWest ─────────┘

   ┌───────────────────────────────────────────────────────────────┐
 ►─▼─┬───────────────────────────────────────────────────────────┬─┴──────────►
     │                            ┌────────────────────┐         │
     └─ EDIt ─┬─ COMments ──────┬─▼─ edit-instruction ─┴─ QUIT ──┘
              ├─ DEFinition ────┤
              ├─ OLQ header ────┤
              ├─ CULprit header │
              └─ comment-key ───┘
   ┌──────────────────────────────────────────────────┐
 ►─▼─┬──────────────────────────────────────────────┬─┴───────────────────────►◄
     └─┬─ COMments ───────┬─ is ─┬─ NULl ─────────┬─┘
       ├─ DEFinition ─────┤      └─ comment-text ─┘
       ├─ OLQ header ─────┤
       ├─ CULprit header ─┤
       └─ comment-key ────┘

Expansion of record-synonym-specification

►►─── record-synonym-name ────────────────────────────────────────────────────►

 ►─┬───────────────────────────────────────────┬──────────────────────────────►
   └─ Version is ─┬─ version-number ─────────┬─┘
                  └─┬────────┬─┬─ HIGhest ─┬─┘
                    └─ NEXt ─┘ └─ LOWest ──┘

 ►─┬──────────────────────────────────────────────────────────────────────────►─
   └─┬─ INClude ◄ ─┬─ FOR FILe synonym file-synonym ──────────────────────────
     └─ EXClude ───┘
─►───────────────────────────────────────┬────────────────────────────────────►
  ─┬───────────────────────────────────┬─┘
   └─ Version is ─┬─ version-number ─┬─┘
                  ├─ HIGhest ────────┤
                  └─ LOWest ─────────┘

 ►─┬──────────────────────────────────┬───────────────────────────────────────►
   └──┬─ PREfix ─┬─ is ─┬─ prefix ─┬──┘
      └─ SUFfix ─┘      ├─ suffix ─┤
                        └─ NULl ───┘

 ►─┬────────────────────────────────────────────────────────────────┬─────────►◄
   └─┬─ INClude ◄ ─┬─ LANguage is language ─┬─────────────────────┬─┘
     └─ EXClude ───┘                        └─ TEXt is user-text ─┘

DISPLAY/PUNCH RECORD (REPORT) (TRANSACTION) statement (for a single record)

►►─┬─ DISplay ─┬──┬─ RECord ──────┬─ name is record-name ─────────────────────►
   └─ PUNch ───┘  ├─ REPort ──────┤
                  └─ TRAnsaction ─┘

 ►─┬───────────────────────────────────┬──────────────────────────────────────►
   └─ Version is ─┬─ version-number ─┬─┘
                  ├─ HIGhest ────────┤
                  └─ LOWest ─────────┘

 ►─┬───────────────────────────────────────────────────┬──────────────────────►
   └─ PREpared by user-id ─┬─────────────────────────┬─┘
                           └─ PASsword is password ──┘
  ┌────────────────────────────────────────────────────────┐
►─▼─┬────────────────────────────────────────────────────┬─┴─────────────────►
    │                  ┌───────────────────────────────┐ │
    └─┬─ WITh ──────┬──▼─┬─ ALL ─────────────────────┬─┴─┘
      ├─ ALSo WITh ─┤    ├─ ALL COMment TYPes ───────┤
      └─ WITHOut ───┘    ├─ ATTRibutes ──────────────┤
                         ├─ COBol ───────────────────┤
                         ├─ COMments ────────────────┤
                         ├─ DEFinitions ─────────────┤
                         ├─ CULprit headers ─────────┤
                         ├─ DETails ─────────────────┤
                         ├─ ELements ────────────────┤
                         ├─ FILes ───────────────────┤
                         ├─ HIStory ─────────────────┤
                         ├─ MAPs ────────────────────┤
                         ├─ NONe ────────────────────┤
                         ├─ OLQ headers ─────────────┤
                         ├─ PICture OVErrides ───────┤
                         ├─ PROgrams ────────────────┤
                         ├─ RECELems ────────────────┤
                         ├─ RECords ─────────────────┤
                         ├─ REPorts ─────────────────┤
                         ├─ SAMe AS ─────────────────┤
                         ├─ SCHemas ─────────────────┤
                         ├─ SUBOrdinate ELements ────┤
                         ├─ SUBSChemas ──────────────┤
                         ├─ SYNonyms ────────────────┤
                         ├─ TRAnsactions ────────────┤
                         ├─ USErs ───────────────────┤
                         ├─┬─ USEr DEFINED COMments ─┤
                         │ └─ UDCs ──────────────────┤
                         ├─┬─ USEr DEFINED NESts ─┬──┤
                         │ └─ UDNs ───────────────┘  │
                         ├─ VIEws ───────────────────┤
                         └─ WHEre USED ──────────────┘
 ►─┬──────────────────────────────────────────────────────────────────────────►─
   └─ TO ─┬─ SYSpch ──────────────────────────────────────────────────────────
          └─ MODule module-name ─┬───────────────────────────────────┬────────
                                 └─ Version is ─┬─ version-number ─┬─┘
                                                ├─ HIGhest ────────┤
                                                └─ LOWest ─────────┘

─►──────────────────────────────────────────────────────────────────────────┬─►
  ─────────────────────────────────────────────────────────────────────────┬┘
  ─┬──────────────────────┬┬──────────────────────────────────────────────┬┘
   └ LANguage is language ┘└ PREpared by user-id ┬───────────────────────┬┘
                                                 └ PASsword is password ─┘

 ►─┬──────────────────────┬──┬─────────────────────┬──────────────────────────►◄
   └─ VERB ─┬─ DISplay ─┬─┘  └─ AS ─┬─ SYNtax ───┬─┘
            ├─ PUNch ───┤           └─ COMments ─┘
            ├─ ADD ─────┤
            ├─ MODify ──┤
            ├─ REPlace ─┤
            └─ DELete ──┘

DISPLAY/PUNCH RECORD (REPORT) (TRANSACTION) statement (for multiple records)

►►─── DISplay ──┬─ ALL ──────────────────────────┬──┬─ RECords ──────┬────────►
                └─┬─ FIRst ─┬─┬─ 1 ◄ ──────────┬─┘  ├─ REPorts ──────┤
                  ├─ NEXt ──┤ └─ entity-count ─┘    └─ TRAnsactions ─┘
                  ├─ LASt ──┤
                  └─ PRIor ─┘

 ►─┬──────────────────────────────────────────────────┬───────────────────────►
   └─ PREpared by user-id ─┬────────────────────────┬─┘
                           └─ PASsword is password ─┘

 ►─┬─────────────────────────────────┬────────────────────────────────────────►
   └─ WHEre conditional-expression ──┘

(for complete conditional-expression syntax, see WHERE clause)
 ►─┬──────────────────┬───────────────────────────────────────────────────────►
   └─ BY ─┬─ SET ◄ ─┬─┘
          └─ AREa ──┘

 ►─┬──────────────────────────────────────────────────────────────────────────►─
   └─ TO ─┬─ SYSpch ──────────────────────────────────────────────────────────
          └─ MODule module-name ─┬───────────────────────────────────┬────────
                                 └─ Version is ─┬─ version-number ─┬─┘
                                                ├─ HIGhest ────────┤
                                                └─ LOWest ─────────┘
─►──────────────────────────────────────────────────────────────────────────┬─►
  ─────────────────────────────────────────────────────────────────────────┬┘
  ─┬──────────────────────┬┬──────────────────────────────────────────────┬┘
   └ LANguage is language ┘└ PREpared by user-id ┬───────────────────────┬┘
                                                 └ PASsword is password ─┘

 ►─┬──────────────────────┬──┬──────────────────────────────────────┬─────────►◄
   └─ VERB ─┬─ DISplay ─┬─┘  └─ AS ─┬─ SYNtax ───┬──┬─────────────┬─┘
            ├─ PUNch ───┤           └─ COMments ─┘  └─ RECursive ─┘
            ├─ ADD ─────┤
            ├─ MODify ──┤
            ├─ REPlace ─┤
            └─ DELete ──┘

Parameters

RECord/REPort/TRAnsaction name is record-name

Identifies a new record (report, transaction) to be established in the dictionary, or an existing record to be modified, replaced, deleted, displayed, or punched. Record-name must be a 1- through 32-character alphanumeric value.

The combination of the record name and version number must be unique in the dictionary; that is, it must not duplicate the primary or synonym name of an existing record, report, or transaction.

ENTIty type is RECord/REPort/TRAnsaction

Changes the entity-type name to RECORD, REPORT, or TRANSACTION. This clause is meaningful only with a MODIFY statement.

SAMe AS RECord/REPort/TRAnsaction record-name

Copies all entries associated with the specified record occurrence, with the exception of the NAME, WITHIN FILE, RECORD NAME SYNONYM and associated options, ELEMENT NAME SYNONYM, INDEXED BY FOR RECORD SYNONYM, and VIEW ID specifications.

NEW NAMe is new-record-name

Specifies a new name for the requested record. This clause changes the name of the record occurrence only; it does not alter or delete any relationships in which the record participates. Subsequent references to the record must specify the new name. New-record-name must be a 1- through 32-character alphanumeric value. The combination of the new record name and version number must not duplicate that of an existing record, report, transaction, or synonym in the dictionary. If the requested record participates in a schema, the NEW NAME clause is not valid.

NEW Version is new-version/NEXt HIGhest/NEXt LOWest

Specifies a new version number for the named record. The combination of the record name and new version number must not duplicate that of an existing record, report, transaction, or synonym in the dictionary.

RECord/REPort/TRAnsaction STOrage is storage-indicator

Documents the named record's storage medium or method; for example, tape or disk. Storage-indicator must be a 1- through 16-character alphanumeric value.

FORmat is

Specifies the format to be assigned to every element that participates in the named record-element structure.

Note: This specification applies only to elements that are included in the named record by means of the RECORD ELEMENT substatement.

PRIMary

Specifies that the primary format is to be used.

alternate-format-keyword

Specifies that an alternative format is to be used. Alternate-format-keyword must reference a valid alternative picture keyword as defined in the SET OPTIONS statement. If an element within the record does not have a corresponding alternative format, the DDDL compiler assigns the primary format to that element. For further discussion of alternative formats, see ELEMENT, earlier in this chapter. Also see SET OPTIONS Statement.

OCCurrences are occurrence-count

Specifies the actual or estimated number of times the record will occur in files or databases. Occurrence-count must be in the range 0 through 2,147,483,647. This clause is documentation only.

WITHIN FILE file-name

Associates (INCLUDE) or disassociates (EXCLUDE) a file in which the named record occurs. File-name must be the primary name of an existing file. This clause creates a record-synonym/for-file-synonym relationship between the primary record synonym and primary file synonym established by means of the FOR FILE SYNONYM parameter (described below). WITHIN FILE is documentation only. The KEY parameter is not valid with EXCLUDE.

KEY is element-name

Specifies that the named record is sequenced on keys within the file. Element-name specifies the names of fields to be used for sort control; the specified element need not participate in the named record. Each record definition can include up to five KEY parameters.

ASCending

Specifies that the records in the file are sorted by element-name in sequence from lowest to highest value.

DEScending

Specifies that the records in the file are sorted by element-name in sequence from highest to lowest value.

LANguage/MODe/class-name is attribute-name

Relates the named record to the named attribute by means of the specified class. The following considerations apply if the LANGUAGE or MODE class is specified:

For additional rules pertaining to this clause, see Attribute/Entity Relationships.

RECord/REPort/TRAnsaction NAMe synonym is

Establishes (INCLUDE) or removes (EXCLUDE) a synonym (alternative name) for the record or modifies an existing synonym. When a record is added to the dictionary, the DDDL compiler builds a record synonym using the record's primary name and version number. This synonym is known as the primary record synonym. Any number of synonyms can be defined for the primary record synonym. If EXCLUDE is specified, only the RECORD NAME SYNONYM parameter is valid.

record-synonym

Specifies the 1- through 32-character name of a record synonym or the primary record name. If the optional VERSION parameter is not specified, the DDDL compiler uses the default version number established in the SET OPTIONS statement DEFAULT FOR EXISTING VERSION clause; if no record synonym exists with the default existing version, the DDDL compiler uses the default version number established in the SET OPTIONS statement DEFAULT FOR NEW VERSION clause.

FOR FILe synonym file-synonym

Associates (INCLUDE) the primary file or file synonym with, or disassociates it from (EXCLUDE), the record synonym. In the CA IDMS COBOL environment, this relationship determines which record synonyms are copied into a program when the DMLC precompiler performs an FD COPY function. In the CA Culprit environment, this relationship determines which record synonyms are associated with the CA Culprit file.

PREfix/SUFfix is prefix/suffix/NULl

Specifies a prefix or suffix for use with all elements that participate in the named record-element structure or removes an existing prefix or suffix. The specified prefix or suffix does not become part of the record synonym. However, the DDDL compiler adds the prefix/suffix to the beginning/end of the element or element synonym to form the record-specific element synonym. Prefix/suffix must be a 1- to 10-character value. The combined length of the element name and the prefix or suffix must not exceed 32 characters. If the resulting element-synonym name exceeds 32 characters, the DDDL compiler truncates the element name before adding the prefix or suffix.

LANguage is language

Associates a language defined as an attribute of the LANGUAGE class with, or disassociates it from, the record synonym. The DML precompilers use the LANGUAGE specification to determine the correct record synonyms to be copied into programs written in various languages.

WITh/ALSo WITh/WITHOut

Includes or excludes the specified options when the named record is displayed or punched. Detailed information for each DISPLAY/PUNCH option is under SET OPTIONS Syntax. The options that are listed below present special considerations for this entity type.

DETails

Includes the DESCRIPTION, RECORD STORAGE, FORMAT, OCCURRENCES, VIEW ID, and RECORD LENGTH (displayed as comments) specifications.

ELements

Includes the specifications that describe the record-element format. ELEMENTS displays the names of record elements that are not subordinate to any other elements. To exclude elements from the display, specify WITHOUT ELEMENTS.

RECords

Includes all user-defined nests defined for the named record.

REPorts

Includes all user-defined nests defined for the named report.

TRAnsactions

Includes all user-defined nests defined for the named transaction.

COBol

Includes all COBOL format record elements associated with the named record. Note that ELEMENTS is the overriding option if a display of both ELEMENTS and COBOL is requested.

RECELems

Includes all COBOL format record elements associated with the named record. RECELEMS displays only the record-element name; the names and version numbers of the elements that participate in the record are not displayed. Note that ELEMENTS is the overriding option if a display of both ELEMENTS and RECELEMS is requested.

SUBOrdinate ELements

Includes subordinate elements. SUBORDINATE ELEMENTS is valid only with the RECORD ELEMENT format; to display or punch a COBOL format, specify the DISPLAY WITH COBOL option. To exclude subordinate elements from the display, specify WITH ELEMENTS PICTURE OVERRIDES WITHOUT SUBORDINATE ELEMENTS.

VIEws

Includes subschema or IDD views.

SYNonyms

Includes all synonyms associated with the record. Specify SYNONYMS to display programs, schemas, subschemas, and maps that are connected to the record synonym. For example, to display the programs with which the CUSTOMER record is associated, specify DISPLAY RECORD CUSTOMER WITH PROGRAMS SYNONYMS.

PICture OVErrides

Includes element picture definitions for the record, including the start position of the element within the record and the length of the element, in bytes.

Usage

Restrictions on the RECORD statement

The following restrictions apply to the RECORD statement:

Regenerate and recompile requirements

Modified RECORD clause

Map regeneration required?

Program recompilation required?

BLANK WHEN ZERO

NO

NO

CODE TABLE

YES

NO

COMMENTS/DEFINITION

NO

NO

EDIT

NO

NO

EDIT TABLE

YES

NO

ELEMENT NAME SYNONYM

NO

NO

EXTERNAL PICTURE

YES

NO

INDEX KEY

NO

NO

INDEXED BY

NO

NO

JUSTIFY

NO

NO

NEW RECORD NAME/VERSION

NO

NO

OCCURS

YES

YES

OCCURS DEPENDING ON name

NO

NO

PICTURE

YES

YES

REMOVE RECORD ELEMENT

YES1

YES1

REPLACE RECORD ELEMENT

YES1

YES1

ADD RECORD ELEMENT

YES1

YES1

RECORD NAME

SYNONYM PREFIX/SUFFIX

NO

NO

REDEFINES

YES

YES

SIGN

YES

YES

SYNC/NOSYNC

NO

NO

USAGE

YES

YES

VALUE

NO

NO

Note: 1 Only necessary if displacements are affected

If you specify REPLACE

If you specify REPLACE, the DDDL compiler initializes to defaults and/or excludes the following clauses:

The following relationships are not affected:

Record synonyms (sites using CA IDMS SQL)

If the language specified is SQL, no other record synonym associated with the record may have a language of SQL associated. The language of SQL is associated with record synonyms to be used (at sites with CA IDMS SQL) in SQL to access non-SQL databases.

Displaying records

If you display a record:

Note: The message RECORD CONTAINS CRITICAL ERRORS applies only to CA products and appears when you display any record, report, or transaction that contains a critical error (for example, a record or record element with a length of 0).

If WITHOUT PICTURE OVERRIDES is specified

If WITHOUT PICTURE OVERRIDES is requested, the displayed output includes the record elements, subordinate elements, element synonyms, and all information that can be specified only at the record-element or subordinate-record-element level rather than in the element definition (for example, SYNC, OCCURS, INDEXED BY, and INDEX KEY). The LINE IS, SUBORDINATE ELEMENT REDEFINES, and SUBORDINATE ELEMENT OCCURS specifications and picture-related information are excluded from the display.

This option is useful in an online environment for rebuilding a record, modifying portions of a record, or building a new record, as follows:

Note: If a subordinate record element is defined with both a REDEFINES and an OCCURS clause, the REDEFINES specification is supplied from the element and the OCCURS specification is supplied from the subordinate record element when the record is built or rebuilt.

Example 1

This example shows:

  1. Definition of two elements
  2. Definition of a group element
  3. Association of the group element with a record
  4. Display of the entire record

1) Defining elements

The following two ADD ELEMENT statements establish the elements CUSTOMER-NUMBER and CUSTOMER-NAME in the dictionary. Element names are used when the elements appear with the record having the primary record name. Element synonyms provide language-specific names.

add element name is customer-number version is 1
    element synonym is customer_number for group synonym customer_group
    element synonym is custnum for group synonym custgrup
    element synonym is custno for group synonym custgp
        picture is 9(6)
        .

add element name is customer-name version is 1
    element synonym is customer_name for group synonym customer_group
    element synonym is custname for group synonym custgrup
    element synonym is custnm for group synonym custgp
        picture is x(30)
        .

2) Defining a group element

The following ADD ELEMENT statement establishes the group element CUSTOMER-GROUP. The SUBORDINATE ELEMENT clause incorporates the elements CUSTOMER-NAME and CUSTOMER-NUMBER. ELEMENT SYNONYM clauses are used to establish a connection between the ELEMENT definition and a RECORD definition.

add element name is customer-group version is 1
    element synonym is customer_group for group synonym customer_record
    element synonym is custgrup for group synonym custrecd
    element synonym is custgp for group synonym custrc
    subordinate elements are
        customer-number version is 1
        customer-name version is 1
        .

3) Associating the group element with a record

The following ADD RECORD statement adds the record CUSTOMER-RECORD to the dictionary and includes the group element CUSTOMER-GROUP.

The DDDL compiler compares the record synonyms with the group synonyms in the element definition. When a match is found, the element synonym associated with that group synonym is automatically copied into the record for that record synonym.

add record name is customer-record version is 1
    record name synonym is customer_record version 1
    record name synonym is custrecd version 1
    record name synonym is custrc version 1.
    record element is customer-group.

4) Displaying the record

The following DISPLAY RECORD statement displays the CUSTOMER-RECORD structure defined in steps 1 through 3.

display record customer-record.
*+ add
*+ record name is customer-record version is 1
*+     date created is      mm/dd/yy
*+     prepared by mjj
*+     record length is 36
*+     record name synonym is customer-record version 1
*+     record name synonym is customer_record version 1
*+     record name synonym is custrecd version 1
*+     record name synonym is custrc version 1
*+     .
*+     record element is customer-group version 1 line is 000100
*+     level number is 02
*+     usage is display
*+     element name synonym for record synonym customer_record version 1 is
*+           customer_group
*+     element name synonym for record synonym custrecd version 1 is custgrup
*+     element name synonym for record synonym custrc version 1 is custgp
*+     .
*+     subordinate element is customer-number version 1 line is 000200
*+     level number is 03
*+     picture is 9(6) usage is display
*+     element name synonym for record synonym customer_record version 1 is
*+           customer_number
*+     element name synonym for record synonym custrecd version 1 is custnum
*+     element name synonym for record synonym custrc version 1 is custno
*+     .
*+     subordinate element is customer-name version 1 line is 000300
*+     level number is 03
*+     picture is x(30) usage is display
*+     element name synonym for record synonym customer_record version 1 is
*+           customer_name
*+     element name synonym for record synonym custrecd version 1 is custname
*+     element name synonym for record synonym custrc version 1 is custnm
*+     .

Example 2

The following example illustrates the modification of a record that participates in a schema. It shows:

  1. The original record layout
  2. The DDDL statements that modify the record
  3. The final record layout

1) The original record layout

The CUSTOMER record has been previously defined in the dictionary. The length of CUST-ADDRESS is 40 bytes.

Note: The COBOL layout and version numbers of the elements are for illustrative purposes only. Each of these elements must be defined in the dictionary using RECORD ELEMENT syntax.

Line
Num       Record Element

 100   05  cust-number              ver 1   pic x(10).
 200   05  cust-name                ver 1   pic x(20).
 300   05  cust-ssn                 ver 1   pic x(09).
 400   05  cust-address             ver 1.
 500       10  cust-addr1           ver 1   pic x(20).
 600       10  cust-addr2           ver 1.
 700           15  cust-city        ver 1   pic x(15).
 800           15  cust-zip-code    ver 1   pic x(05).
 900           15  cust-zipcode     ver 1   redefines cust-zip-code
                                            pic 9(05).
1000   05  filler                           pic x(05).
1100   05  cust-credit              ver 1   pic x(03).
1200       88  cust-credit-exec     ver 1              value 'aaa'.
1300       88  cust-credit-good     ver 1              value '   '.
1400       88  cust-credit-poor     ver 1              value 'xxx'.
1500   05  cust-sales-info          ver 1.
1600       10  cust-sales-qtr       ver 1   occurs 4  indexed by cuix.
1700       10  cust-num-sales       ver 1   pic 9(05) comp-3.
1800       10  cust-amt-sales       ver 1   pic 9(07) comp-3.
1900   05  filler                           pic x(03).

The user defines four new elements in the dictionary, using the DDDL compiler. The length of CUST-ADDRESS VERSION 2 is 44 bytes:

Note: The COBOL layout and version numbers of the elements are for illustrative purposes only. Each of these elements must be defined in the dictionary using RECORD ELEMENT syntax.

          Record Element

       05  cust-nr-numeric          ver 1   pic 9(10).

       05  cust-ssn                 ver 2.
           10  cust-ssn-3           ver 1   pic x(03).
           10  cust-ssn-2           ver 1   pic x(02).
           10  cust-ssn-4           ver 1   pic x(04).

           88  cust-credit-unkn     ver 1          value'unk'.

       05  cust-address             ver 2.
           10  cust-street          ver 1   pic x(20).
           10  cust-addr2           ver 2.
               15  cust-city        ver 2   pic x(13).
               15  cust-state       ver 1   pic x(02).
               15  cust-zip-code    ver 2.
                   20  filler               pic x(04).
                   20  cust-zip-5   ver 1   pic x(05).
               15  cust-zipcode     ver 2   redefines
                   cust-zip-code    ver 2   pic 9(09).

2) The DDDL statements that modify the record

The user issues a MODIFY RECORD command and RECORD ELEMENT substatements to the DDDL compiler to place the newly defined elements into the CUSTOMER record.

CUST-NUMBER is replaced by the new element definition CUST-NR-NUMERIC.

replace record customer.

    replace record element cust-number   version 1    line 100 .

        record element cust-nr-numeric   version 1    line 110
            redefines cust-number .

CUST-SSN and CUST-ADDRESS are replaced using a new element with the same name but a different version number. Because CUST-ADDRESS VERSION 2 is four bytes longer than VERSION 1, a new one-byte filler field is inserted following CUST-ADDRESS, and the original five-byte filler field is removed. A new COBOL level-88 item is inserted.

        replace record element cust-ssn     version 2 line 300 .

        replace record element cust-address version 2 line 400 .

                record element 'fil 0001'          line 910 .

        remove record element 'fil 0005'           line 1000 .

                record element cust-credit-unkn       line 1110 .

3) The final record layout

The record elements associated with the newly modified CUSTOMER record are shown below. The schema definition is automatically adjusted to reflect the changes.

Line
Num       Record Element

 100   05  cust-number              ver 1   pic x(10).
 200   05  cust-nr-numeric          ver 1   redefines cust-number
                                            pic 9(10).
 300   05  cust-name                ver 1   pic x(20).
 400   05  cust-ssn                 ver 2.
 500       10  cust-ssn-3           ver 1   pic x(03).
 600       10  cust-ssn-2           ver 1   pic x(02).
 700       10  cust-ssn-4           ver 1   pic x(04).
 800   05  cust-address             ver 2.
 900       10  cust-street          ver 1   pic x(20).
1000       10  cust-addr2           ver 2.
1100           15  cust-city        ver 2   pic x(13).
1200           15  cust-state       ver 1   pic x(02).
1300           15  cust-zip-code    ver 2.
1400               20  filler               pic x(04).
1500               20  cust-zip-5   ver 1   pic x(05).
1600           15  cust-zipcode     ver 2   redefines
                   cust-zip-code    ver 2   pic 9(09).
1700   05  filler                           pic x(01).
1800   05  cust-credit              ver 1   pic x(03).
1900       88  cust-credit-unkn     ver 1              value 'unk'.
2000       88  cust-credit-exec     ver 1              value 'aaa'.
2100       88  cust-credit-good     ver 1              value '   '.
2200       88  cust-credit-poor     ver 1              value 'xxx'.
2300   05  cust-sales-info          ver 1.
2400       10  cust-sales-qtr       ver 1   occurs 4  indexed by cuix.
2500       10  cust-num-sales       ver 1   pic 9(05) comp-3.
2600       10  cust-amt-sales       ver 1   pic 9(07) comp-3.
2700   05  filler                           pic x(03).

Syntax and parameter descriptions for the RECORD ELEMENT, COBOL, REMOVE ALL, and VIEW substatements, and the DISPLAY/PUNCH RECORD SYNONYM statement follow.