The Segment entity
A Segment is a structured collection of Data Elements. It must belong to a Data Structure. Segments are used by different files. Some Segments represent the common part of the record (sort criteria and keys) in a file, and other Segments represent the specific part of the record in a file.
Concept
Each Segment is described only once. However, it can be called into any entity that uses Segments (Programs, Segments, Database Blocks). In Programs, Segments represent the files that constitute the external resources. In Database Blocks, Segments represent SQL tables or views. Part of the information that is specified at the Segment level is used according to the way the Segment is used in these entities.
Segment definition
- "00" identifies the Segments that represent the common part of records in a file. The information that is entered in a "00" Segment definition is used by transaction files.
- Other numbers identify the specific Segments. The information that is entered in the definition of these Segments is used by standard files.
A transaction file is made of records that update a permanent file. The type of update (creation, modification, deletion, or other cases) is called the action code. Validations and updates are automatically associated with each update type. In the common part of the file, a Data Element, called the action code Data Element, represents the action code. You must associate six values with this Data Element, one for each type of update. Each value represents the input that the user must indicate in the application to carry out the appropriate update process. This Data Element name and values are indicated on the Definition of the "00" Segment, in the fields that are dedicated to the action code.
A standard file can have several types of records. The specific part of each record is described in a Segment number "nn". In generated programs, a record description is made of the concatenation of the "00" and the appropriate "nn" Segment descriptions. A Data Element is used to identify the specific record type. This Data Element code is specified on the Definition of the Segment number "00". The appropriate value is coded on the Definition of the specific part Segment. For a file that has only one type of record, only a "00" Segment is described.