Library /sys$common/syshlp/CDO$HELP.HLB  —  rec-properties  OCCURS_DEPENDING, Examples
    1.CDO>  DEFINE RECORD VACATION_PAY OCCURS 1 TO 2 TIMES
      cont>   DEPENDING ON EXCESS_VACATION IN EMPLOYEE_BENEFITS.
      cont>   EMP_SSN.
      cont>   WEEKLY_SALARY.
      cont>   END RECORD.

      In this example, the OCCURS ... DEPENDING record property
      specifies the number of times the VACATION_PAY record element
      occurs. The number of occurrences is based on the run-time
      value of the tag variable field element, EXCESS_VACATION, which
      is part of the EMPLOYEE_BENEFITS record element.

    2.CDO>  CHANGE RECORD VACATION_PAY
      cont>   NOOCCURS.
      cont>   END RECORD.

      In this example, the keyword NOOCCURS in the CHANGE RECORD
      command removes the OCCURS ... DEPENDING record property from
      the VACATION_PAY record element.

    3.CDO> DEFINE FIELD MESSAGE_TABLE_IDX DATATYPE IS LONGWORD.
      CDO> DEFINE FIELD MESSAGE_TEXT DATATYPE IS TEXT SIZE IS
      cont> 256 CHARACTERS.
      CDO> DEFINE RECORD MESSAGE_TABLE.
      cont> MESSAGE_STRUCT STRUCTURE OCCURS 10 TIMES INDEXED BY
      cont> MESSAGE_TABLE_IDX.
      cont> MESSAGE_TEXT.
      cont> END MESSAGE STRUCTURE.
      cont> END MESSAGE_TABLE RECORD.
      CDO> DEFINE RECORD MESSAGE_TABLE2.
      cont> MESSAGE_STRUCT STRUCTURE OCCURS 1 TO 10 TIMES
      cont> DEPENDING ON MESSAGE_TEXT
      cont> INDEXED BY MESSAGE_TABLE_IDX.
      cont> MESSAGE_TEXT.
      cont> END MESSAGE STRUCTURE.
      cont> END MESSAGE_TABLE2 RECORD.
      CDO> SHOW RECORD MESSAGE_TABLE/FULL

      Definition of record MESSAGE_TABLE
       |   Contains record          MESSAGE_STRUCT
       |   |   Occurs               10 indexed by MESSAGE_TABLE_IDX
       |   |   Contains field       MESSAGE_TEXT
       |   |   |   Datatype         text size is 256 characters
      CDO> SHOW RECORD MESSAGE_TABLE2/FULL

      Definition of record MESSAGE_TABLE2
       |   Contains record          MESSAGE_STRUCT
       |   |   Occurs               1 to 10  depending on MESSAGE_TEXT
      indexed by MESSAGE_TABLE_IDX
       |   |   Contains field       MESSAGE_TEXT
       |   |   |   Datatype         text size is 256 characters

      In this example, the MESSAGE_TABLE record contains an INDEXED
      BY clause. The name of the index field must already be defined.
Close Help