In this section: |
The most common relationship between two segments is the one-to-many relationship. Each instance of a parent segment can be related to one or more instances of a child segment. However, not every parent instance needs to have matching child instances.
The following diagram illustrates the concept of a one-to-many relationship.
In the EMPLOYEE data source, each EMPINFO segment instance describes an employee ID number, name, current salary, and other related information. Each SALINFO segment contains an employee gross salary for each month. Most employees work for many months, so the relationship between EMPINFO and SALINFO is one-to-many.
The following diagram further illustrates the concept of a one-to-many relationship.
Describe this relationship by joining the tables in the Master File and specifying a SEGTYPE of S0 for the child table. For more information on joining the tables in a Master File, see the appropriate data adapter documentation. Alternately, you can join the tables by issuing the JOIN command with the ALL or MULTIPLE option.
You can describe a one-to-many relationship between a record and a group of multiply occurring fields within the record.
The OCCURS and POSITION attributes and the ORDER field are all described in Describing a Sequential, VSAM, or ISAM Data Source.
Describe a one-to-many relationship between different records by using a RECTYPE field to indicate the type of each record, and the PARENT attribute to indicate the relationship between the different records. RECTYPE fields are described in Describing a Sequential, VSAM, or ISAM Data Source.
You can also specify a one-to-many relationship between two records in different data sources by issuing the JOIN command with the ALL or MULTIPLE option, or defining the join in the Master File. See the Creating Reports With TIBCO WebFOCUS® Language manual for information about the JOIN command, and see Defining a Join in a Master File, for information about joins in a Master File.
Describe this relationship by specifying a SEGTYPE of Sn or SHn for the child segment. Alternatively, you can join the segments by issuing the JOIN command with the ALL or MULTIPLE option or by specifying a join in the Master File with a SEGTYPE of KM (for a static join) or DKM (for a dynamic join). All of these SEGTYPE values are described in Describing a FOCUS Data Source.