Previous Topic: RECORD StatementNext Topic: COBOL Substatement


RECORD ELEMENT Substatement

RECORD ELEMENT substatements associate existing elements with records and update existing record-element structures. To include an element within a record-element structure, specify a RECORD statement followed by the keywords RECORD ELEMENT. After the RECORD ELEMENT identification, enter optional clauses that define record-specific characteristics for the element.

Syntax

RECORD ELEMENT substatement

►►─┬───────────┬─ RECord ELEment is element-name ─────────────────────────────►─
   ├─ REMove ──┤
   └─ REPlace ─┘

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

─►── SUBordinate ELement is element-name ─┬────────────────────────────────┬──►─
                                          └ Version is ─┬ version-number ─┬┘
                                                        ├ HIGhest ────────┤
                                                        └ LOWest ─────────┘
─►─┬───────────────────────┬──────────────────────────────────────────────────►
   └─ LINe is line-number ─┘

 ►─┬──────────────────────────────────────────────────────────────────────────►─
   └─ ELement name SYNonym is element-synonym ────────────────────────────────

─►─┬────────────────────────────────────────────────────────────────────────┬─►
   └ FOR RECord synonym record-synonym ┬─────────────────────────────────┬──┘
                                       └ Version is ─┬─ version-number ─┬┘
                                                     ├─ HIGhest ────────┤
                                                     └─ LOWest ─────────┘
 ►─┬────────────────────────────┬─────────────────────────────────────────────►
   └─ PICture is ─┬─ picture ─┬─┘
                  ├─ NULL ────┤
                  └─ BUILT ───┘

 ►─┬───────────────────────────────────────┬──────────────────────────────────►
   └─ USAge is ─┬─ DISplay ──────────────┬─┘
                ├─┬─ COMPUTATIONAL ───┬──┤
                │ ├─ COMP ────────────┤  │
                │ ├─ COMPUTATIONAL-4 ─┤  │
                │ ├─ COMP-4 ──────────┤  │
                │ └─ BINary ──────────┘  │
                ├─┬─ COMPUTATIONAL-1 ─┬──┤
                │ ├─ COMP-1 ──────────┤  │
                │ └─ SHOrt-point ─────┘  │
                ├─┬─ COMPUTATIONAL-2 ─┬──┤
                │ ├─ COMP-2 ──────────┤  │
                │ └─ LONg-point ──────┘  │
                ├─┬─ COMPUTATIONAL-3 ─┬──┤
                │ ├─ COMP-3 ──────────┤  │
                │ └─ PACked ──────────┘  │
                ├─ POInter ──────────────┤
                ├─ BIT ──────────────────┤
                └─ CONdition-name ───────┘
 ►─┬────────────────────────────────┬─────────────────────────────────────────►
   └─ REDefines ─┬─ element-name ─┬─┘
                 ├─ * ────────────┤
                 └─ NULl ─────────┘

 ►─┬──────────────────────────────────────────────────────────────────────────►─
   └─┬─ INClude ◄ ─┬─ VALues ─┬─ is ──┬─┬───────┬─────────────────────────────
     └─ EXClude ───┘          └─ are ─┘ └─ ALL ─┘

─►─────────────────────────────────────────────────────────────────────────┬──►
        ┌───────────────────────────────────────────────────────────┐      │
  ─┬───┬▼─┬ initial-value ──┬┬────────────────────────────────────┬─┴┬───┬─┘
   └ ( ┘  └ condition-value ┘└─ THRu ─┬───────┬─ condition-value ─┘  └ ) ┘
                                      └─ ALL ─┘
 ►─┬───────────────────────┬──────────────────────────────────────────────────►
   └─ EXClude ALL VALues ──┘

 ►─┬──────────────────────────────────────────────────────────────────────────►─
   └─ OCCurs ─────────────────────────────────────────────────────────────────

─►─────────────────────────────────────────────────────────────────────┬──────►
  ─┬─ occurrence-count times ────────────────────────────────────────┬─┘
   ├─ occurrence-count times DEPending on control-element-name ──────┤
   ├─ 0 TO occurrence-count times DEPending on control-element-name ─┤
   └─ NULl ──────────────────────────────────────────────────────────┘
 ►─┬─────────────────────────────────────────────────────────────────────┬────►
   └─ INDexed by ─┬─ index-element-name ───────────────────────────────┬─┘
                  │     ┌──────────────────────┐                       │
                  ├─ ( ─▼─ index-element-name ─┴─ ) ───────────────────┤
                  ├─ NULl ─────────────────────────────────────────────┤
                  └─ FOR RECord synonym record-synonym-specification ──┘

(expanded record-synonym-specification syntax follows this syntax diagram)
 ►─┬───────────────────────────────────────────────────────────────────────┬──►
   └─ INDex KEY is ─┬─ index-element-name ─┬─ ASCending ──┬──────────────┬─┘
                    │                      └─ DEScending ─┘              │
                    │      ┌───────────────────────────────────────┐     │
                    ├┬───┬─▼─ index-element-name ─┬─ ASCending ──┬─┴┬───┬┤
                    │└─(─┘                        └─ DEScending ─┘  └─)─┘│
                    └─ NULl ─────────────────────────────────────────────┘

 ►─┬───────────┬──────────────────────────────────────────────────────────────►
   ├─ SYNC ────┤
   └─ NO SYNC ─┘

 ►─┬────────────────────────┬─────────────────────────────────────────────────►
   └─ JUStify is ─┬─ ON ──┬─┘
                  └─ OFF ─┘
 ►─┬────────────────────────────────┬─────────────────────────────────────────►
   └─ BLAnk when ZERo is ─┬─ ON ──┬─┘
                          └─ OFF ─┘

 ►─┬───────────────────────────────────────────────────────┬──────────────────►
   └─ SIGn is ─┬─ NULl ──────────────────────────────────┬─┘
               └─┬─ LEAding ──┬─┬──────────────────────┬─┘
                 └─ TRAiling ─┘ └─ SEParate character ─┘

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

   ┌──────────────────────────────────────────────────────────────────────────
 ►─▼─┬────────────────────────────────────────────────────────────────────────►─
     └─┬─ INClude ◄ ─┬─ EDIT ─┬─ VALid ◄ ─┬─ TABle is ────────────────────────
       └─ EXClude ───┘        └─ INValid ─┘
  ───────────────────────────────────────────┐
─►─────────────────────────────────────────┬─┴────────────────────────────────►
  ─┬─ LISt ──────────────────────────────┬─┘
   │     ┌─────────────────────────┐     │
   ├─ ( ─▼─ value ┬──────────────┬─┴─ ) ─┤
   │              └─ THRu value ─┘       │
   └─ NULl ──────────────────────────────┘

   ┌────────────────────────────────────────────────────────────────────────┐
 ►─▼─┬─────────────────────────────────────────────────────────────────────┬┴─►
     └┬ INClude ◄ ┬ CODe TABle is ┬ LISt ────────────────────────────────┬─┘
      └ EXClude ──┘               │    ┌─────────────────────────────┐   │
                                  ├ ( ─▼─ encode-value  decode-value ┴ )─┤
                                  └ NULl ────────────────────────────────┘

 ►─┬─────────────────────────────────────┬────────────────────────────────────►◄
   └─ EXTernal PICture is ─┬─ picture ─┬─┘
                           └─ NULl ────┘

Expansion of record-synonym-specification

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

─►───────────────────────────────────────────┬────────────────────────────────►◄
  ─── is ─┬─ index-element-name ───────────┬─┘
          │     ┌─────────────────────┐    │
          ├─ ( ─▼─ index-element-name ┴─ )─┤
          └─ NULl ─────────────────────────┘

Parameters

RECord ELEment is element-name

Specifies the element that is the object of the RECORD ELEMENT substatement. Element-name must be the primary name of an existing element; the named element must be the highest level element within a record (usually an 02 level), or a level-88 item. If the named element is not in the record-element structure, the DDDL compiler adds the existing element definition and any record-specific characteristics to the end of the record-element structure. If the optional LINE parameter (described below) is not specified, the element definition is placed at the end of the record-element structure. If the named element already participates in the record-element structure, the DDDL compiler modifies the record-element definition based on the optional clauses specified.

LINe is line-n

Qualifies nonunique record-element names or specifies where the DDDL compiler is to insert a new element definition in the record-element structure. Line-n must be an integer in the range 1 through 999,999.

This parameter must be specified unless the requested record element is the first nonunique element within the structure. Following compilation of the RECORD statement, the DDDL compiler assigns sequence numbers to all record elements; the default sequence number specified in the SET OPTIONS statement SEQUENCE clause is the starting and increment value. The assigned numbers appear on record reports and in DISPLAY/PUNCH output. If the LINE parameter in a MODIFY RECORD RECORD ELEMENT statement references the line number of an existing record element, but that element has a different name than the requested record element, the DDDL compiler issues an error message, unless the REPLACE parameter has been specified.

Note: If you do not specify a LINE clause in a RECORD ELEMENT substatement (one that doesn't use REPLACE or REMOVE) the compiler adds the record element to the end of the record definition.

REMove/REPlace

Deletes or replaces the specified record element and its subordinate elements. If REMOVE or REPLACE is specified, element-name must match the name of an element in the named record-element structure.

SUBordinate ELement is element-name

Identifies an existing subordinate element that is to be modified for use within the named record-element structure. All clauses between this substatement and another SUBORDINATE ELEMENT or RECORD ELEMENT substatement apply to the named subordinate element or level-88 item.

Note: The SUBORDINATE ELEMENT specification is used to change record-element characteristics such as picture and usage; it is not used to create group-element/subordinate-element structures. These structures must be defined by means of the ELEMENT entity statement (described under ELEMENT, earlier in this chapter).

ELement name SYNonym is element-synonym

Establishes a synonym (alternative name) for the element when it participates in the named record-element structure. Element-synonym is the 1- to 32-character synonym name. If this clause appears following a SUBORDINATE ELEMENT substatement, the synonym is associated with the subordinate element.

This clause can be coded once for each synonym to be associated with the named record. Any prefix or suffix defined for the record synonym with which the element synonym is associated will be appended to the element-synonym name.

FOR RECord synonym record-synonym-specification

Associates the element (or subordinate element) synonym with the designated record synonym.

Note: If the FOR RECORD SYNONYM clause is not specified, the named record element (or subordinate element) is associated with the primary record synonym only.

PICture is

Specifies a record-specific PICTURE clause for the record element or subordinate element.

picture

Creates a record-specific PICTURE clause for the named record element. If the named record element is an elementary element, picture becomes the record-specific picture for the element. If the named record element is a group element, picture becomes the record-specific picture for the group element; the DDDL compiler removes from the record any subordinate elements defined for the group.

Note: The maximum length of a record element (including its usage) is 32,767 characters.

Picture must be a 1- through 30-character value that describes alphanumeric, alphabetic, numeric, or numeric-edited data, as shown in the table under Usage.

NULL

Removes a record-specific PICTURE clause from the named record element.

BUILT

Creates an alphanumeric display PICTURE clause for the requested group record element. The DDDL compiler deletes the subordinate elements from the group description and uses the combined lengths of all subordinate elements in the group to form the group picture.

USAge is

Specifies a record-specific USAGE clause for the named record element.

DISplay

Alphabetic, alphanumeric, zoned decimal, edited, or display floating point

COMPUTATIONAL

Binary; COMP, COMPUTATIONAL-4, COMP-4, and BINary are synonyms for COMPUTATIONAL.

COMPUTATIONAL-1

Short-precision floating point; COMP-1 and SHOrt-point are synonyms for COMPUTATIONAL-1.

COMPUTATIONAL-2

Long-precision floating point; COMP-2 and LONG-point are synonyms for COMPUTATIONAL-2.

COMPUTATIONAL-3

Packed decimal; COMP-3 and PACked are synonyms for COMPUTATIONAL-3.

POInter

Fullword address constant

BIT

Bit string definition

CONdition-name

COBOL level-88 item; the level number is generated by the DDDL compiler

REDefines

Specifies a record-specific REDEFINES clause for the named record element. A redefined element (element-name or the element referenced by *) cannot include an OCCURS clause; the element can, however, be subordinate to an element with an OCCURS clause.

element-name

Identifies the element being redefined. The specified element must be at the same level as the element that is the object of the RECORD ELEMENT substatement and must immediately precede that element in the record-element structure.

*

Instructs the DDDL compiler to automatically redefine the previous element at the same level in the record-element structure. The user need not specify the element name.

NULl

Removes a previously established REDEFINES clause.

VALue is/are ALL initial-value/condition-value THRu ALL condition-value

Specifies a record-specific VALUE clause for the named record element. Initial-value/condition-value specifies a value, range of values, or a list of values assigned to a COBOL level-88 condition name. A list of values must be enclosed in parentheses. Each value in the list must be separated from the next by a space or a comma. The value must be a figurative constant, a numeric literal, or an alphanumeric literal enclosed in quotation marks; alphanumeric literals cannot exceed 32 characters.

The optional THRU parameter is valid only with COBOL condition names (level-88 items). To specify a new value for a new or existing record element, first issue an EXCLUDE ALL VALUES clause. Note that if the SET OPTIONS statement specifies DECIMAL-POINT IS COMMA and the VALUE clause specifies a numeric literal, periods (.) are interpreted as insertion characters and commas (,) are interpreted as decimal points.

EXClude ALL VALues

Removes all VALUE clauses associated with the named record element. This clause is required to remove existing values.

OCCurs

Specifies a record-specific OCCURS clause for the named record element.

occurrence-count times

Specifies the number of times the element can occur within the record. Occurrence-count must be an integer in the range 0 through 32,767.

occurrence-count times/0 TO occurrence-count times DEPending on control-element-name

Defines a control element within the record, that determines the actual number of times the element will occur. Occurrence-count must be an integer in the range 1 through 32,767. Control-element-name specifies a previously defined field in the record; this field must be a halfword or fullword binary item if the record is to be used in a schema or by CA ADS.

NULL

Removes an existing OCCURS clause.

INDexed by

Specifies one or more INDEXED BY clauses for the named multiply-occurring record element or record-element synonym, or removes an existing INDEXED BY clause.

This clause applies only to records used in COBOL programs and can be specified once for each record element, subordinate element, and record synonym associated with the element. Each specified index is prefixed or suffixed for each record synonym associated with the record element.

Note: Within one INDEXED BY clause, the user can specify either a multiply-occurring record element or a record-element synonym (the clause cannot contain both elements and synonyms).

index-element-name

Specifies a 1- through 32-character index name that cannot duplicate an element or element-synonym name in the record.

NULl

Removes an existing INDEXED BY clause.

FOR RECord synonym record-synonym is index-element-name/NULl

Specifies an INDEXED BY name for a record synonym associated with the record element.

Index-element-name is a 1- through 32-character index name that must not duplicate the name of an existing element or element synonym in the record. Multiple index names must be enclosed in parentheses and separated by blanks. The COBOL precompiler copies the specified index names into the program's DATA DIVISION as part of the COPY IDMS function.

NULl removes an existing INDEXED BY clause.

INDex KEY is

Specifies one or more record-specified index keys for a multiply-occurring group record element or a subordinate record element. The INDEX KEY clause applies only to records used in COBOL programs. Only one INDEX KEY clause can be specified for each record element or subordinate element.

index-element-name

Identifies an elementary element that is subordinate to the associated element. Index-element-name must be the primary name of the subordinate element; it cannot be a synonym. The specified element name is appended with a prefix or suffix assigned to the record synonym associated with the element.

ASCending/DEScending

Specifies the order of the subordinate elements within the multiply-occurring element.

NULl

Removes an existing INDEX KEY clause.

SYNC/NO SYNC

Determines whether boundary alignment is to be defined for the named record element. The correct alignment is determined by the USAGE specification. If the element's usage is COMP or COMP-4, the DDDL compiler issues a warning message when the element is not on the proper boundary alignment. This clause is documentation only, unless the COBOL precompiler is used to copy the record; in this case, the specified boundary alignment will be applied by the COBOL precompiler. If the record element is copied into a schema, it causes a critical schema error.

JUStify is

Supplies a justification specification for the named record element. The JUSTIFY clause applies only to records used in COBOL programs.

ON

Specifies that a COBOL JUSTIFIED clause is to be generated.

OFF

Specifies that a COBOL JUSTIFIED clause is not to be generated.

BLAnk when ZERo is

Supplies a BLANK WHEN ZERO specification for the named record element.

ON

Specifies that blanks are automatically placed in the element when it contains all zeroes.

OFF

Specifies that the element's value will not be changed when it contains all zeroes.

SIGn is

Specifies whether the sign is to be removed from a numeric field or whether it is to appear in the leading or trailing position.

NULl

Removes existing sign specifications (for signed DISPLAY numeric fields only).

LEAding/TRAiling

Places the sign in the leading or trailing position. If SEPARATE CHARACTER is specified, the sign will appear as a separate byte.

EDIt VALid/INValid TABle is

Specifies whether edit table values are to be listed, inserted, or removed (for DC/UCF tables only).

LISt

Edit table values in the dictionary are listed on the Integrated Data Dictionary Activity List or in the online IDD work file.

value THRu value

Inserts (INCLUDE) or removes (EXCLUDE) single values or ranges of values in the edit table. Each value can have a maximum size of 34 characters. The specified values must be enclosed in parentheses; for example:

('A' 'C' 'F' 'H' 'R' THRU 'Z')
NULl

All values are removed from the table.

VALid/INValid

Specifies whether the edit table contains a list of valid or invalid values; the default is VALID.

CODe TABle is

Specifies whether code table values are to be listed, inserted, or removed (for DC/UCF tables only). For the rules for defining the values for edit and code tables, refer to the CA IDMS Mapping Facility Guide.

LISt

Specifies that code table values that are in the dictionary are to be listed in pairs. The first value is the encoded value; the second value is the decoded value.

encode-value decode-value

Specifies that pairs of values are inserted in the table. The first or encoded value can have a maximum size of 34 characters; the second or decoded value can have a maximum of 64 characters. Null values ('') and the keywords NOT FOUND are also valid. The specified values must be enclosed in parentheses.

NULl

Specifies that all values are removed from the table.

EXTernal PICture is picture/NULl

Defines the display format for record-element data (picture) or removes an existing external picture specification (NULL). The picture is available to all map fields that use the record element. For the rules for defining external pictures, refer to the CA IDMS Mapping Facility Guide.

Usage

RECORD ELEMENT considerations

The following considerations apply to the RECORD ELEMENT substatement:

Adding a filler field to a record-element structure

To add a filler field to a record-element structure, specify RECORD ELEMENT IS 'FIL nnnn'. Nnnn is a 4-digit value that represents the number of characters of filler; the specified value must be separated from the keyword FIL by one blank and must contain leading zeros, if appropriate. For example, to generate the filler described as FILLER PIC X(7), specify RECORD ELEMENT 'FIL 0007'.

If you specify REPLACE

The following considerations apply to the REPLACE option:

SUBORDINATE ELEMENT considerations

The following considerations apply to the SUBORDINATE ELEMENT clause:

Specifying a picture variable

Picture must be a 1- through 30-character value that describes the types of data shown in the following table.

Category

Character

Description

Alphanumeric data

X

Represents one alphanumeric character. If USAGE IS BIT, X represents one bit; the USAGE clause is described in the parameters list.

 

(n)

An integer in parentheses after an X

Represents n repetitions of the alphanumeric character; for example, X(4) is equivalent to XXXX.

Alphabetic data

A

Represents one alphabetic character (A-Z).

 

(n)

An integer in parentheses after an A

Represents n repetitions of the alphabetic character

Numeric data

9

Represents one numeric character.

 

(n)

An integer in parentheses after a 9

Represents n repetitions of the numeric character.

 

V

Represents an assumed decimal point. No more than one V can appear in an element picture. If the V is omitted and the P option (described below) is not used, the assumed decimal point is after the rightmost 9.

 

P

Represents an assumed zero. Any number of Ps can appear in the leftmost or the rightmost positions of an element picture. An assumed decimal point is automatically placed before the first P or after the last P. The character P does not occupy a storage position (for example, PP9999 has a data length of 4).

 

S

Identifies the number as positive or negative. When used, the S must be the first character in the element picture. When the S is omitted, values for the element description are assumed to be positive.

Numeric- edited data

(Includes the numeric data characters described above, along with the editing characters shown at the right)

 

Z

+

,

B

CR

-

0

DB

*

$

.

Represent edit symbols used in reporting data; quotation marks are not required. Refer to the appropriate programming language manual for the individual interpretations of these symbols.

If the SET OPTIONS statement specifies DECIMAL-POINT IS COMMA, a period (.) is interpreted as an insertion character and a comma (,) is interpreted as a decimal point.

Examples

The following example shows the creation of the record PARTS-RECORD using the RECORD ELEMENT substatement. The statement:

The following MODIFY statement: