Previous Topic: Copying and Editing Entity OccurrencesNext Topic: COPY Clause


SAME AS Clause

Use the optional SAME AS clause in ELEMENT, FILE, MODULE, QFILE, PROCESS, PROGRAM, RECORD (REPORT) (TRANSACTION), SYSTEM (SUBSYSTEM), TABLE, and USER statements to reduce the amount of coding needed to define multiple entities of the same type.

SAME AS copies options associated with an existing entity occurrence into another entity occurrence. Except as noted in individual entity-type statements in Chapter 4, all options are copied.

Syntax: SAME AS Clause

   ┌──────────────────────────────────────────────────────────────────────────
►►─▼─ SAMe AS entity-type-name  entity-occurrence-name ───────────────────────►─

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

Parameters

SAMe AS entity-type-name

Specifies the name of the object entity type; valid names are ELEMENT, FILE, MODULE, PROCESS, QFILE, TABLE, PROGRAM, RECORD, REPORT, TRANSACTION, SYSTEM, SUBSYSTEM, and USER.

entity-occurrence-name

Specifies the name of the entity-occurrence definition to be copied. The specified name must be the entity's primary name; it cannot be a synonym. DDDL makes sure that the entity occurrences specified (for the module, qfile, process, and table entities) are the same entity type.

Version is version-number/HIGhest/LOWest

Qualifies nonunique entity-occurrence names for the SAME AS clause.

Usage

Considerations for using SAME AS

The following considerations apply to using the SAME AS clause:

Example

The following example adds the elements MODEL-DATE, PROMISE-DATE, and SHIP-DATE to the dictionary, copying the definition of MODEL-DATE for PROMISE-DATE and SHIP-DATE.

add element model-date
    sub elements are
        month
        day
        year.

add element promise-date
    same as element model-date
    comments 'items will be shipped before promise date'
    -'when possible'.

add element ship-date
    same as element model-date.

The DISPLAY statement lists the resulting definition for SHIP-DATE.

display element ship-date prep by j-user.
        *+   add
        *+   element name is ship-date
        *+      date created is      mm/dd/yy
        *+      prepared by j-user
        *+      subordinate elements are
        *+           month    version is 1
        *+           day      version is 1
        *+           year     version is 1
        *+      .