Modernization Hub

Data Segment

Enhanced Definition

A `data segment` in the context of z/OS primarily refers to a distinct section within a program's virtual storage address space or `load module` that holds program data, such as initialized variables, uninitialized variables, and constants. It is separate from the program's executable code. More specifically, in an `IMS database`, a `data segment` is a fundamental unit of data representing a specific record type within the hierarchical structure.

Key Characteristics

    • Program Data Storage: For executable programs, it contains global and static variables, constants, and other data areas defined by the program (e.g., COBOL WORKING-STORAGE SECTION data).
    • Virtual Storage Allocation: It occupies a portion of a program's assigned virtual storage within an address space, managed by z/OS for loading and execution.
    • Read/Write vs. Read-Only: Can contain both read-only data (e.g., literal constants) and read/write data (e.g., program variables that change during execution).
    • Load Module Component: When a program is compiled and link-edited into a load module or program object, the data segment is a defined part of that executable structure.
    • IMS Hierarchical Unit: In IMS databases, a segment is the smallest unit of data that IMS can access and process. It consists of a fixed-length or variable-length record and is defined by a DBD (Database Description).
    • Parent-Child Relationship (IMS): IMS segments are organized hierarchically, with parent segments potentially having multiple child segments, forming the database structure.

Use Cases

    • COBOL Program Variables: Storing data items defined in the WORKING-STORAGE SECTION or LINKAGE SECTION of a COBOL program.
    • Assembler Data Areas: Holding DC (Define Constant) and DS (Define Storage) areas for assembler language programs.
    • Program Initialization: Containing pre-initialized data values that are loaded into memory when a program starts, ensuring variables have their initial states.
    • IMS Database Records: Representing specific types of records within an IMS database, such as a "patient" segment, "treatment" segment, or "medication" segment, each with its own fields.
    • Shared Data Areas: In some scenarios, a data segment might be used for shared data between different parts of a multi-segment program or even between different programs if designed for that purpose (e.g., using common storage areas).

Related Concepts

The data segment is intrinsically linked to virtual storage and address spaces on z/OS, as it's where a program's data resides during execution. It is distinct from the code segment (or text segment), which contains the executable instructions, and often from the stack and heap segments used for dynamic memory allocation. In the context of load modules and program objects, the data segment is a critical component that the program loader places into memory. For IMS, data segments are the building blocks of hierarchical databases, defined by DBDs and accessed via PSBs (Program Specification Blocks) and DL/I calls.

Best Practices:
  • Minimize Size: Design programs to minimize the size of the data segment where possible, especially for reentrant programs, to reduce virtual storage consumption and improve paging performance.
  • Proper Initialization: Always ensure that variables within the data segment are properly initialized, either at compile time or programmatically, to prevent unpredictable behavior.
  • Reentrancy Considerations: For reentrant programs, ensure that the data segment contains only read-only data or that any modifiable data is handled in a separate, non-shared area (e.g., dynamic storage or task-specific storage).
  • IMS Segment Design: For IMS, carefully design segment lengths and fields to optimize storage, access performance, and data integrity, considering the hierarchical structure and DL/I access patterns.
  • Data Alignment: Pay attention to data alignment within the data segment for optimal performance, especially in assembler and PL/I programs, to avoid performance penalties on certain hardware architectures.

Related Vendors

ABA

3 products

ASE

3 products

IBM

646 products

Trax Softworks

3 products

Related Categories

Databases

211 products

Transactions

29 products

Operating System

154 products

Browse and Edit

64 products