Modernization Hub

INCLUDE

Enhanced Definition

In mainframe computing, an `INCLUDE` refers to a directive or statement that instructs a compiler, assembler, interpreter, or utility to insert the content of an external file or member into the current source code or script during processing. This mechanism is fundamental for promoting code reuse, standardization, and modularity across various z/OS components.

Key Characteristics

    • Code Reusability: Enables the sharing of common code segments, data definitions, or JCL statements across multiple programs or jobs without duplication.
    • Modularity: Facilitates breaking down large programs or complex JCL into smaller, manageable, and reusable components stored in libraries like PDS/PDSEs.
    • Context-Dependent Processing: The exact syntax and processing stage vary; for example, COPY in COBOL is a compile-time directive, while INCLUDE in JCL can be processed by the JCL interpreter or a utility.
    • Centralized Maintenance: Changes to an included member are automatically reflected in all programs or jobs that reference it, simplifying maintenance and ensuring consistency.
    • Library-Based Storage: Included members are typically stored in partitioned data sets (PDS) or partitioned data set extended (PDSE), allowing for efficient management and retrieval.

Use Cases

    • COBOL Copybooks: Employing the COPY statement to include standardized data structures (e.g., record layouts, working-storage sections) or common procedural code (e.g., error handling routines) into COBOL programs.
    • JCL Procedures (PROCs): Using INSTREAM or DD * with INCLUDE to embed common JCL steps, DD statements, or utility control cards directly within a job stream.
    • Assembler Macros and DSECTs: Utilizing COPY or MACRO directives to insert predefined macro definitions, data area definitions (DSECTs), or common instruction sequences into Assembler programs.
    • DB2 DCLGEN Output: Including generated DECLARE TABLE or DECLARE CURSOR statements, often produced by the DCLGEN utility, into COBOL or PL/I programs for host variable definitions.
    • REXX Execs: Using PARSE EXTERNAL or similar techniques to include external REXX code segments or variables into a main REXX script.

Related Concepts

INCLUDE is closely related to the concept of libraries (PDS/PDSEs) where the reusable components reside, such as SYS1.MACLIB for Assembler macros or user-defined source code libraries. It underpins the use of JCL Procedures (PROCs) by allowing common job steps to be defined once and included in many jobs. In COBOL, INCLUDE is synonymous with COPYBOOKs, which are essential for data sharing and standardization. It serves a similar purpose to subroutines or functions in promoting code reuse, but INCLUDE typically performs text substitution at an earlier stage (e.g., compile-time) rather than run-time execution of separate modules.

Best Practices:
  • Standardized Naming Conventions: Implement clear and consistent naming conventions for INCLUDE members to improve readability and ease of identification.
  • Version Control: Manage INCLUDE members under a robust source code management system (e.g., CA Endevor, IBM SCM) to track changes, maintain history, and facilitate rollback.
  • Minimize Nesting: Avoid excessive nesting of INCLUDE statements, as it can complicate debugging, increase compilation times, and make dependency tracking

Related Vendors

IBM

646 products

Trax Softworks

3 products

Related Categories

Operating System

154 products

Browse and Edit

64 products