Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Parameters

Syntax Rules

Usage Notes

Example

CDD/Plus Dictionary Data Definition Language Utility OCCURS_DEPENDING — VMS CDD+_4.1A

 The OCCURS .  .  .   DEPENDING  field  attribute  clause  declares  a
 variable-length, one-dimensional array.

Additional information available:

ParametersSyntax RulesUsage NotesExample

Parameters

 min_number, max_number

     The range for the number of occurrences.

 dep_field_name

     The tag variable field, whose value determines the actual  number
     of occurrences.


 COB_index

     A VAX COBOL index name.



Syntax Rules

  o  Two unsigned integers (min_number, max_number)  specify  a  range
     for  the  number of occurrences; min_number specifies the minimum
     number of occurrences and must be greater than or equal to  zero;
     max_number  specifies  the maximum number of occurrences and must
     be greater than or equal to min_number.

  o  The actual number of occurrences varies according to the value of
     the named field.

  o  The field (dep_field_name) named in the DEPENDING clause must  be
     an elementary field fixed in the record and not part of an array.
     Its field description must precede the array  field  description,
     and its value must never be less than min_number nor greater than
     max_number.  You must name the field.

  o  You must fully qualify the field name if it is not unique  within
     the  record.   A  fully  qualified  field  name  consists  of  an
     elementary field name preceded by the field names of as  many  of
     its  direct ancestors as you need to specify the elementary field
     uniquely.  Once the elementary field name is identified uniquely,
     you  can  omit  any  remaining  ancestors' field names.  You must
     separate each element of a fully qualified field  name  from  the
     next with a period.


Usage Notes

  o  The unsigned integers min_number and max_number declare the range
     for the array's upper bound; the lower bound of an array declared
     with OCCURS . . . DEPENDING is always 1.  If you need to  specify
     an array with a lower bound other than 1, use the ARRAY clause.

  o  If the tag variable's name is not unique within the record,  none
     of  the  ancestors  in  its  fully  qualified name can be unnamed
     fields.

  o  Only VAX COBOL supports the INDEXED FOR COBOL BY field  attribute
     clause.  Other processors ignore it.

  o  You cannot use the INDEXED FOR COBOL BY optional field  attribute
     clause with Version 3.0 of VAX COBOL or any earlier version.  VAX
     COBOL supports INDEXED FOR COBOL BY in Version 3.1 and later.

  o  If you use a name as a COBOL index name you cannot use that  name
     as  a  field  name or COBOL-specific name elsewhere in the record
     description.


Example

 In the following example, a variable length array defines  individual
 transactions within the STRUCTURE field SALES.

 SALES STRUCTURE.
     TRANSACTION_COUNT               DATATYPE IS UNSIGNED WORD
                                     VALID FOR DTR IF
                                         "TRANSACTION_COUNT > 0".
     TRANSACTION STRUCTURE           OCCURS 1 TO 99 TIMES
                                         DEPENDING ON
                                         TRANSACTION_COUNT.
         TRANS_DATE                  DATATYPE IS DATE.
         ORDER_NUMBER                DATATYPE IS UNSIGNED NUMERIC
                                     SIZE IS 10 DIGITS.
         AMOUNT                      DATATYPE IS UNSIGNED NUMERIC
                                     SIZE IS 8 DIGITS 2 FRACTIONS
                                     PICTURE FOR COBOL IS "9(6)V99".
     END TRANSACTION STRUCTURE.
 END SALES STRUCTURE.

 The   fully   qualified   field   name   of   TRANSACTION_COUNT    is
 SALES.TRANSACTION_COUNT.

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