Open Mainframe Project COBOL Programming Course

repository·master·Indexed 25 days ago

https://github.com/openmainframeproject/cobol-programming-course

A comprehensive training program for COBOL programming on z/OS systems, consisting of books, labs, and videos. The course is divided into four modules: Getting Started, Learning COBOL, Advanced Topics (requiring Enterprise COBOL v6.3 and Db2 for z/OS 12), and Testing. It includes instructions for setting up z/OS environments, managing data sets via Zowe Explorer, and utilizing IBM-supplied cataloged procedures.

Tokens
39.2K
Snippets
74
Records
225
Agent score
85%

What's inside cobol-programming-course

  1. Overview of Zowe CLI

    master

    Zowe CLI is an open-source command-line interface for the mainframe that runs on Windows, Linux, and Mac. It acts as a bridge between distributed systems and the mainframe, allowing you to interact with z/OS from modern development environments.

    Capabilities:

    • Remote interaction with z/OS data sets and jobs.
    • Access to Unix System Services files.
    • Execution of TSO and Console commands.
    • Interaction with provisioning services.
    • Extensibility via plug-ins for z/OS subsystems and vendor software.

    Use Cases:

    • Automation: Automate build, deployment, and testing processes for COBOL applications.
    • CI/CD Integration: Use Zowe CLI within Jenkins pipelines, Python scripts, Node.js tests (Mocha/Jest), or SonarQube workflows.
    • Hybrid Development: Leverage open-source tooling to manage mainframe resources.
  2. Overview of Course #3 Lab directory structure

    master

    The lab directory is organized into three functional folders:

    • cbl: Contains the COBOL source code.
    • jcl: Contains the Job Control Language (JCL) used for compiling, linking, and executing the COBOL source.
    • jclproc: Contains the cataloged procedures required for the labs:
      • DB2CBL: Handles COBOL code compilation, link-edit, and Db2 binding.
      • DB2JCL: Used for executing SQL statements via JCL.
      • DSNUPROC: An IBM-supplied procedure for invoking the Db2 online utility.
  3. Understand the value of automated testing in CI/CD

    master

    Automated testing is critical for achieving Continuous Delivery (CD) and maintaining system reliability, especially on z/OS. Manual testing cycles (often 6-12 weeks) force organizations into Waterfall-style development, where changes are grouped together, making it difficult to isolate failures and slowing time-to-market.

    Automated testing provides:

    • Agility: Rapid response to market changes and compliance regulations.
    • Reliability: Ability to verify system integrity during maintenance, hardware upgrades, or component updates.
    • Continuous Delivery: Enables small, frequent changes that can be constantly delivered and tested.
  4. Understand COBOL Program Hierarchy and Structure

    master

    COBOL follows a strict top-down hierarchical structure. The order of nesting is:

    1. Divisions: The highest level of organization.
    2. Sections: Subdivisions of Divisions (a collection of paragraphs).
    3. Paragraphs: Subdivisions of Sections, Divisions, or Programs (a user-defined or predefined name followed by a period).
    4. Sentences: One or more Statements followed by a period (.).
    5. Statements: Specific actions or instructions (e.g., MOVE, COMPUTE) that exist within the PROCEDURE DIVISION.
  5. Project Lead Election and Role

    master
    Project committers elect a Lead (and optionally a Co-Lead). The Lead serves as the primary point of contact for the project and the representative to the TAC (Technical Advisory Committee) once the project reaches the Active stage. The Lead is responsible for project health, direction, activity coordination, and external collaboration.
  6. Communicate with z/OS Middleware using Enterprise COBOL APIs

    master

    Enterprise COBOL uses specific reserved words to initiate services and pass data to z/OS middleware (such as Db2, CICS, IMS, and MQSeries). These API reserved words are expanded by the compiler into the underlying middleware code.

    Common API patterns include:

    • EXEC SQL for Db2 (Relational Database)
    • EXEC CICS for CICS (Transactional Processor)
    • CALL 'MQ...' for MQSeries (Asynchronous Data Transfer)
    • CALL 'CBLTDLI' for IMS (Transactional and Hierarchical Database)
    EXEC SQL
    EXEC CICS
    CALL 'MQ...'
    CALL 'CBLTDLI'
  7. Understand the Lab directory structure and data formats

    master

    The lab repository is organized into four functional directories. Understanding these is necessary for locating source code, execution scripts, and input files.

    Directory Contents

    • cbl: Contains the COBOL source code.
    • jcl: Contains the Job Control Language (JCL) used to compile, link, and execute the COBOL code.
    • jclproc: Contains the IBM-supplied cataloged procedures used by the JCL.
    • data: Contains the input data files.

    Data File Formats

    Inside the data folder, two types of files are provided:

    • data: Binary files encoded in EBCDIC with packed decimal format. These must be transferred as binary to maintain integrity.
    • xdata: Viewable ASCII files. Note that while these are readable in ASCII, any packed decimal fields within them will remain unreadable.
  8. Understand COBOL Program Control and Structure

    master

    COBOL achieves structured programming without native for or while loops or defined functions/methods. Instead, it uses the PERFORM keyword and paragraphs to organize logic.

    Key Control Structures

    • Paragraphs: Blocks of code used to organize logic. They should be named clearly and designed with specific content in mind.
    • PERFORM Statements:
      • PERFORM TIMES: Executes a paragraph a specific number of times.
      • PERFORM THROUGH: Executes from one paragraph through another.
      • PERFORM UNTIL: Creates a loop that runs until a condition is met.
      • PERFORM VARYING: Implements iteration with a varying variable (similar to a for loop).
    • Inline vs. Out-of-line: PERFORM can execute code blocks defined within the current procedure or external paragraphs.

    Advanced Organization

    • Subprograms: COBOL can call other programs by specifying the target program, program variables, and return values.
    • Copybooks: Reusable code snippets used to maintain consistency across programs.
  9. Understand CI/CD and DevOps Pipeline Concepts

    master

    In a DevOps approach, Continuous Integration (CI) and Continuous Delivery (CD) are used to evolve software rapidly by avoiding long, manual testing cycles.

    • Continuous Integration (CI): Involves frequent checking in of small code changes into a 'Master' code stream. It provides consistent building, packaging, and validation of changes.
    • Continuous Delivery (CD): Automates the delivery of changed software through a series of environments (testing, staging) and ultimately to production.
    • Continuous Deployment: A subset of CD that also automates the final release into production.
    • Continuous Testing: The practice of ensuring quality at every stage of the pipeline by testing early, often, and everywhere.

    A successful DevOps pipeline is a cyclical, iterative process: Planning $\rightarrow$ Coding $\rightarrow$ Building $\rightarrow$ Unit Testing $\rightarrow$ Integration/System Testing $\rightarrow$ Release $\rightarrow$ Monitoring $\rightarrow$ Planning.

  10. Understand software testing concepts and types

    master

    Software testing is the process of validating that software performs expected actions and provides expected results. It serves as an empirical technical investigation to provide stakeholders with information about product quality.

    Key testing types include:

    • Unit Testing: The earliest phase, validating individual components or units. Typically performed by developers using static analysis, code review, and automated unit tests. Finding defects here is more resource-efficient than finding them later.
    • Integration Testing: An umbrella term used in this course to cover testing that occurs after development. It involves testing individual units together or with external system components in environments that mimic the target environment. This includes regression, functional, system, UI, end-to-end, and performance testing.
    • Exploratory Testing: A 'thinking' activity where testers use personal freedom and experience to discover and investigate software behavior. It is a directed, organized activity aimed at critiquing the product, but it does not lend itself to automation.

    Testing strategies can be visualized using two models:

    1. Agile Test Quadrants: Categorizes tests by whether they are business-facing vs. technology-facing, and whether they support programming vs. critique the product.
    2. Test Pyramid: Emphasizes a wide base of many small unit tests, a middle layer of service/integration tests, and a small top layer of end-to-end/UI tests.
  11. Understand the role and relevance of COBOL

    master

    COBOL (Common Business-Oriented Language) is an English-like programming language designed specifically for business and enterprise systems. It is used globally to process critical data and facilitate massive volumes of commerce.

    Key characteristics include:

    • Readability: Designed to be easily understood by non-programmers (such as auditors) due to its English-like syntax.
    • Scale: Capable of handling vast amounts of critical data on large-scale servers like the IBM Z mainframe.
    • Stability: Often serves as the core logic in modern architectures, frequently wrapped by Java front-ends or modern interfaces.
    • Modernization: Continuously updated to support modern paradigms, including native support for JSON, XML, and Java®.
  12. Understand COBOL DISPLAY vs COMPUTATIONAL formats

    master

    In COBOL, you must distinguish between how data is represented in memory and how it is formatted for display or storage.

    • DISPLAY format: Used for alphabetic characters (EBCDIC/ASCII) and Zoned decimal numbers (without sign).
    • COMPUTATIONAL format: Used for specialized numeric representations. This includes COMP-1, COMP-2, COMP-3 (Packed Decimal), COMP-4, and COMP-5 (Binary/Floating-point).

    Warning: If you attempt to read Packed Decimal (COMP-3) data using a DISPLAY format PIC clause, it will cause record length discrepancies and execution errors (e.g., ABENDU4038).