Format DEFINE COLLECTION collection-name [ DESCRIPTION IS /*text*/ ] [ AUDIT IS /*text*/ ] .
1 – Parameters
1.1 – collection-name
Specifies the collection you are creating.
1.2 – text
Adds information. Within the DESCRIPTION clause, this is information documenting the collection; within the AUDIT clause, it is a history list entry. Valid delimiters are /* */ or double quotation marks (" "). You can use Japanese to document comments in the DESCRIPTION or AUDIT clause for a field. To do this, use the SET CHARACTER_SET command, and set the character_set of the session to DEC_KANJI.
2 – Description
The DEFINE COLLECTION command creates a collection. A collection allows you to view and manipulate a group of related elements that make up a particular system or subsystem. Because a collection is a controlled element, you use the DEFINE COLLECTION command to create the initial version of a collection. Use the RESERVE and REPLACE commands to create new versions. Before you issue the DEFINE COLLECTION command, you must create and set a context. The SHOW CONTEXT command indicates whether you have completed these steps. Because all elements in a collection hierarchy are children of the top collection, you can issue commands that affect the entire hierarchy with the /DESCENDANTS or /CLOSURE qualifiers. Because most elements in a collection hierarchy are also children of smaller subcollections beneath the top collection, you can also issue commands that affect only one subcollection and its children. To create a collection hierarchy, issue the DEFINE COLLECTION command immediately after the SET CONTEXT command. SET CONTEXT implicitly sets the collection you define as the top collection in the hierarchy, provided that you did not set a top collection within the DEFINE CONTEXT command. To extend the hierarchy beneath the top collection, you issue the following commands: 1. DEFINE COLLECTION to create the collections that participate in the hierarchy. This command attaches all collections in the first level beneath the top collection. 2. DETACH FROM COMPOSITE to detach those collections destined for lower levels in the hierarchy from the first level beneath the top collection. 3. RESERVE and ATTACH TO COMPOSITE to reserve collections in each successive level and attach their immediate children. 4. REPLACE to store in a partition the elements you have created.
3 – Examples
1.CDO> DEFINE COLLECTION REGIONAL_SALES. In this example, the DEFINE COLLECTION command creates the REGIONAL_SALES collection. 2.CDO> DEFINE PARTITION FIRST_BASELEVEL. 1 CDO> DEFINE CONTEXT DEVELOPMENT_CONTEXT cont> BASE_PARTITION FIRST_BASELEVEL. CDO> SET CONTEXT DEVELOPMENT_CONTEXT CDO> DEFINE COLLECTION COMPILER_C. 2 CDO> RESERVE COLLECTION COMPILER_C CDO> DEFINE COLLECTION FRONT_END. 3 CDO> DEFINE COLLECTION BACK_END. CDO> DEFINE COLLECTION PARSER. CDO> DEFINE FILE_ELEMENT MCS_BINARY PARSER_TABLES cont> STORETYPE EXTERNAL cont> MCS_STOREDIN IS "CDD$DISK:[SMITH]PARSER_TABLES.DAT". cont> END FILE_ELEMENT MCS_BINARY PARSER_TABLES. CDO> DETACH COLLECTION PARSER FROM COMPILER_C 4 CDO> DETACH FILE_ELEMENT PARSER_TABLES FROM cont> COMPILER_C CDO> RESERVE COLLECTION FRONT_END CDO> ATTACH COLLECTION PARSER TO FRONT_END 5 CDO> RESERVE COLLECTION PARSER CDO> ATTACH FILE_ELEMENT PARSER_TABLES TO PARSER CDO> REPLACE COLLECTION /CLOSURE=TO_TOP PARSER The successive DEFINE COLLECTION commands in this example participate in the creation of a collection hierarchy. 1 DEFINE PARTITION, DEFINE CONTEXT, and SET CONTEXT commands allow you to control elements. 2 DEFINE COLLECTION command creates the collection; this command also sets COMPILER_C as the top collection because the current context, DEVELOPMENT_CONTEXT, does not have a top collection defined. 3 DEFINE COLLECTION commands create subcollections FRONT_END, BACK_END, and PARSER and file element PARSER_TABLES under collection COMPILER_C. 4 DETACH commands detach PARSER and PARSE_TABLES from collection COMPILER_C. 5 ATTACH commands attach PARSER under subcollection FRONT_END and PARSE_TABLES under subcollection PARSER.