Exposing ISPF-Edited Assets to Git & CI/CD: Patterns & Approaches

Integrating ISPF-edited assets with Git and CI/CD pipelines modernizes mainframe development while preserving ISPF workflows. This tutorial covers patterns and approaches for exposing mainframe datasets to version control, automating synchronization, and integrating with CI/CD pipelines. Understanding these patterns helps you choose the right approach for your organization and implement effective Git and CI/CD integration.

Modern software development relies on version control and automated pipelines, and mainframe development can benefit from these practices too. Exposing ISPF-edited assets to Git and CI/CD enables code reviews, automated testing, consistent deployments, and collaboration through modern tooling while maintaining the ability to work directly in ISPF when needed.

Understanding the Integration Challenge

Integrating ISPF assets with Git and CI/CD presents unique challenges due to differences between mainframe and modern development environments. Understanding these challenges helps design effective integration patterns.

Mainframe vs. Modern Development Differences

Key differences include:

  • Dataset Names vs. File Names: Mainframe datasets use hierarchical naming (USERID.SOURCE.COBOL) while file systems use path-based naming (/path/to/file.ext)
  • PDS Members: Partitioned datasets contain multiple members, each needing to be a separate file in Git
  • Character Encoding: Mainframes typically use EBCDIC while modern systems use ASCII/UTF-8
  • Record Formats: Mainframe datasets have record formats (FB, VB, etc.) that don't directly map to file systems
  • Binary Data: Some datasets contain binary data not suitable for Git
  • Large Datasets: Very large datasets may need special handling

These differences require mapping and conversion strategies to effectively integrate ISPF assets with Git and CI/CD.

Integration Goals

Integration goals typically include:

  • Version Control: Track changes to mainframe code in Git
  • Code Reviews: Enable code reviews through Git pull requests
  • Automated Testing: Automate testing through CI/CD pipelines
  • Automated Deployment: Automate deployment of mainframe applications
  • Collaboration: Enable collaboration through modern tooling
  • Audit Trail: Maintain audit trail of changes and deployments

Clear goals help choose appropriate patterns and approaches.

Integration Patterns

Several patterns exist for integrating ISPF assets with Git and CI/CD. Understanding these patterns helps you choose the right approach for your needs.

Pattern 1: Download-Sync Pattern

The download-sync pattern downloads datasets from mainframe to Git:

  • Process: Periodically or on-demand, download datasets from mainframe to local files, commit to Git
  • Direction: Mainframe → Git (one-way, mainframe to Git)
  • Use Cases: Capturing mainframe changes in Git, creating version history, enabling code reviews of mainframe code
  • Benefits: Simple, captures mainframe state, enables Git-based workflows
  • Limitations: Changes in Git don't automatically sync back to mainframe

This pattern is good for capturing mainframe state in Git and enabling Git-based workflows like code reviews.

Pattern 2: Upload-Deploy Pattern

The upload-deploy pattern uploads changes from Git to mainframe:

  • Process: Changes in Git trigger CI/CD pipeline that uploads to mainframe and deploys
  • Direction: Git → Mainframe (one-way, Git to mainframe)
  • Use Cases: Deploying changes from Git to mainframe, automated deployments, CI/CD-driven development
  • Benefits: Automated deployment, Git as source of truth, modern development workflow
  • Limitations: Mainframe changes not automatically captured in Git

This pattern is good for Git-driven development where Git is the source of truth and mainframe is the deployment target.

Pattern 3: Bi-Directional Sync Pattern

The bi-directional sync pattern keeps Git and mainframe in sync:

  • Process: Changes in either Git or mainframe sync to the other, maintaining consistency
  • Direction: Git ↔ Mainframe (two-way sync)
  • Use Cases: Working in both environments, maintaining consistency, flexible workflows
  • Benefits: Flexibility to work in either environment, consistency between systems
  • Limitations: More complex, requires conflict resolution, coordination needed

This pattern is good when you need to work in both Git and ISPF while maintaining consistency.

Pattern 4: Pipeline-Triggered Pattern

The pipeline-triggered pattern uses CI/CD pipelines to orchestrate sync:

  • Process: CI/CD pipelines monitor for changes and automatically sync and deploy
  • Direction: Can be one-way or bi-directional, orchestrated by pipelines
  • Use Cases: Automated workflows, deployment pipelines, integration testing
  • Benefits: Fully automated, consistent processes, integrated testing and deployment
  • Limitations: Requires pipeline infrastructure, more complex setup

This pattern is good for fully automated workflows with integrated testing and deployment.

Implementation Approaches

Different approaches can be used to implement integration patterns. Understanding these approaches helps you implement effective solutions.

Approach 1: Manual Sync

Manual sync involves periodic manual synchronization:

  • Process: Manually download datasets, commit to Git, or manually upload from Git
  • Tools: Zowe CLI commands, ISPF utilities, manual Git operations
  • Use Cases: Initial setup, occasional sync, low-change scenarios
  • Benefits: Simple, full control, no automation complexity
  • Limitations: Manual effort, may miss changes, not scalable

Manual sync is good for getting started or low-frequency sync needs.

Approach 2: Scripted Sync

Scripted sync uses scripts to automate synchronization:

  • Process: Scripts use Zowe CLI to download/upload, Git commands to commit/push
  • Tools: Shell scripts, Python scripts, Zowe CLI, Git commands
  • Use Cases: Regular sync, scheduled sync, automated workflows
  • Benefits: Automated, repeatable, can be scheduled
  • Limitations: Requires script maintenance, may need error handling

Scripted sync is good for regular, automated synchronization.

Approach 3: CI/CD Pipeline Integration

CI/CD pipeline integration uses pipelines to orchestrate sync:

  • Process: Pipelines trigger on events, use Zowe CLI for sync, orchestrate deployment
  • Tools: Jenkins, GitLab CI, GitHub Actions, Zowe CLI
  • Use Cases: Automated deployments, integrated testing, continuous integration
  • Benefits: Fully automated, integrated testing, deployment history
  • Limitations: Requires pipeline infrastructure, more complex

CI/CD integration is good for fully automated, production-ready workflows.

Handling PDS Members

Partitioned datasets (PDS) contain multiple members, each needing special handling when integrating with Git.

PDS to Git Mapping

PDS members map to Git files:

  • Dataset Name Mapping: Map dataset name to directory structure (e.g., USERID.SOURCE.COBOL → userid/source/cobol/)
  • Member to File: Each PDS member becomes a file (e.g., MEMBER1 → member1.cbl)
  • Directory Structure: Organize members in directories matching dataset hierarchy
  • File Extensions: Use appropriate file extensions based on content (e.g., .cbl for COBOL, .jcl for JCL)

This mapping enables Git to track individual members while maintaining dataset organization.

Example: PDS to Git Structure

Example mapping:

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Mainframe: USERID.SOURCE.COBOL - MEMBER1 - MEMBER2 USERID.SOURCE.JCL - JOB1 - JOB2 Git Structure: userid/ source/ cobol/ member1.cbl member2.cbl jcl/ job1.jcl job2.jcl

This structure maintains organization while making PDS members accessible as individual files in Git.

CI/CD Pipeline Examples

CI/CD pipelines can automate sync and deployment. Here are example approaches:

Example: Git to Mainframe Deployment

Pipeline that deploys from Git to mainframe:

text
1
2
3
4
5
6
7
8
9
10
11
12
13
# Example CI/CD pipeline (pseudo-code) pipeline: trigger: on commit to main branch steps: - checkout Git repository - for each changed file: - convert file name to dataset name - upload to mainframe using Zowe CLI - submit compilation job - run tests - if tests pass: - deploy to target environment - notify team of deployment status

This pipeline automates deployment from Git to mainframe with testing and validation.

Example: Mainframe to Git Sync

Pipeline that syncs from mainframe to Git:

text
1
2
3
4
5
6
7
8
9
10
11
12
# Example sync pipeline (pseudo-code) pipeline: trigger: scheduled (e.g., hourly) steps: - for each dataset to sync: - download from mainframe using Zowe CLI - compare with Git version - if changed: - commit to Git - push to repository - create summary of changes - notify team of updates

This pipeline automatically captures mainframe changes in Git.

Best Practices

Following best practices helps ensure successful integration:

  • Start Simple: Begin with simple patterns and expand gradually
  • Document Mapping: Document how datasets map to Git structure
  • Handle Encoding: Ensure proper EBCDIC to ASCII conversion
  • Exclude Binary: Exclude binary datasets from Git (use Git LFS or alternatives)
  • Automate Gradually: Start with manual sync, then script, then full CI/CD
  • Test Thoroughly: Test sync and deployment processes thoroughly
  • Monitor Sync: Monitor sync processes for errors and issues
  • Version Control Scripts: Version control sync scripts and pipeline definitions
  • Clear Policies: Establish clear policies about where changes originate
  • Team Training: Train team on Git and CI/CD workflows

Explain Like I'm 5: ISPF, Git, and CI/CD

Think of ISPF, Git, and CI/CD like different ways to manage your drawings:

  • ISPF is like drawing on paper at your desk. You can draw, erase, and change your drawings directly. It's great for working, but if you lose the paper or want to share it, you have problems!
  • Git is like having a magic photo album that remembers every version of your drawing. You can see how it looked before, go back to old versions, and share photos with friends. Everyone can see your drawings and suggest changes!
  • CI/CD is like having a robot assistant. When you finish a drawing and put it in the photo album, the robot automatically tests it, makes sure it's good, and puts it in the right place. You don't have to do all those steps yourself!
  • Zowe CLI is like a magic camera that can take photos of your paper drawings and put them in the photo album, or print photos from the album back onto paper. It connects your desk drawings with the photo album!
  • Integration is like having the robot watch your desk. When you finish a drawing, the robot takes a photo, puts it in the album, tests it, and shares it - all automatically!

So exposing ISPF assets to Git and CI/CD is like connecting your desk drawings (ISPF) with a magic photo album (Git) and a robot assistant (CI/CD) that helps you manage, share, and deploy your work automatically!

Practice Exercises

Practice integrating ISPF assets with Git and CI/CD:

Exercise 1: Manual Git Integration

Objective: Manually sync a dataset to Git.

Steps:

  • Download a dataset using Zowe CLI
  • Initialize a Git repository (if needed)
  • Add the file to Git
  • Commit the file
  • Make a change to the file
  • Commit the change
  • View Git history

Exercise 2: Simple Sync Script

Objective: Create a simple sync script.

Steps:

  • Create a script that downloads a dataset
  • Compares with Git version
  • Commits if changed
  • Test the script
  • Document the script

Exercise 3: Basic CI/CD Pipeline

Objective: Create a basic CI/CD pipeline.

Steps:

  • Set up a CI/CD tool (Jenkins, GitLab CI, etc.)
  • Create a pipeline that monitors Git for changes
  • Configure pipeline to upload to mainframe using Zowe CLI
  • Test the pipeline
  • Document the pipeline

Test Your Knowledge

1. What is a key tool for exposing ISPF assets to Git?

  • ISPF only
  • Zowe CLI
  • TSO commands only
  • JCL only

2. What is the download-sync pattern?

  • Download from Git to mainframe
  • Download from mainframe to Git
  • Only download, never sync
  • Only sync, never download

3. What challenge exists with PDS members in Git?

  • They work perfectly
  • Each member needs to be a separate file
  • They cannot be in Git
  • No challenges exist

4. What does bi-directional sync mean?

  • Sync only from mainframe
  • Sync only from Git
  • Sync changes in both directions
  • No syncing at all

5. How can CI/CD deploy ISPF assets?

  • Only manually
  • Using Zowe CLI in pipeline scripts
  • Cannot be automated
  • Only with special hardware

Related Concepts