Progress0 of 0 lessons

CICS DevOps Practices

DevOps practices for CICS mainframe applications combine development and operations to automate the software delivery lifecycle. By implementing CI/CD pipelines, automated testing, version control, and modern tooling, organizations can deliver CICS applications faster, with higher quality, and improved reliability. Understanding DevOps practices is essential for modernizing CICS development while maintaining the security and stability that mainframe systems require.

What is DevOps for CICS?

DevOps for CICS is the integration of development and operations practices to automate and streamline the delivery of CICS applications. It encompasses version control, continuous integration, automated testing, continuous deployment, infrastructure automation, and monitoring. DevOps practices enable CICS development teams to deliver features and fixes more frequently while maintaining the reliability and security standards required for mainframe systems.

Key principles of DevOps for CICS:

  • Automation: Automate builds, tests, and deployments to reduce manual errors and accelerate delivery
  • Continuous Integration: Integrate code changes frequently and automatically test them
  • Continuous Deployment: Automatically deploy tested code to environments
  • Infrastructure as Code: Define and manage CICS resources and configurations as code
  • Monitoring and Feedback: Monitor applications and use feedback to improve processes
  • Collaboration: Foster collaboration between development, testing, and operations teams

Explain It Like I'm 5 Years Old

Imagine you're building a LEGO castle. DevOps is like having helpers who automatically check if your LEGO pieces fit together (testing), put your castle in the right place when you're done (deployment), and keep track of all the changes you make (version control). Instead of doing everything by hand each time, these helpers do it automatically and quickly, so you can build more castles faster and make sure they're all built correctly!

Version Control Integration

Version control is the foundation of DevOps practices. All CICS source code, including COBOL programs, BMS maps, CICS resource definitions, and configuration files, should be stored in version control systems like Git. This enables code review, change tracking, collaboration, and the ability to roll back to previous versions.

Storing CICS Source Code in Git

CICS applications consist of multiple types of source code that should be version controlled:

  • COBOL Programs: Application logic and business rules
  • BMS Maps: Screen definitions for 3270 terminals
  • CICS Resource Definitions: Program definitions, transaction definitions, file definitions
  • JCL: Job control language for batch processing
  • Configuration Files: Environment-specific configurations
  • Test Scripts: Automated test cases and test data
text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Example Git repository structure for CICS application cics-application/ ├── src/ │ ├── cobol/ │ │ ├── CUSTINQ.cbl # Customer inquiry program │ │ ├── CUSTUPD.cbl # Customer update program │ │ └── CUSTVAL.cbl # Customer validation program │ ├── bms/ │ │ ├── CUSTINQ.bms # Customer inquiry map │ │ └── CUSTUPD.bms # Customer update map │ └── cics/ │ ├── programs.csd # Program definitions │ ├── transactions.csd # Transaction definitions │ └── files.csd # File definitions ├── tests/ │ ├── unit/ │ │ └── CUSTINQ_test.cbl # Unit tests │ └── integration/ │ └── customer_flow_test.cbl ├── scripts/ │ ├── build.sh # Build script │ └── deploy.sh # Deployment script └── README.md

Branching Strategies

Effective branching strategies enable parallel development while maintaining code quality:

  • Main Branch: Production-ready code, always stable
  • Develop Branch: Integration branch for features
  • Feature Branches: Individual features developed in isolation
  • Release Branches: Preparation for production releases
  • Hotfix Branches: Critical production fixes
text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Example Git workflow # Create feature branch git checkout -b feature/customer-search # Make changes and commit git add src/cobol/CUSTSRCH.cbl git commit -m "Add customer search functionality" # Push to remote git push origin feature/customer-search # Create pull request for code review # After approval, merge to develop branch git checkout develop git merge feature/customer-search # Deploy develop branch to test environment # After testing, merge to main for production

Continuous Integration (CI)

Continuous Integration involves automatically building and testing code whenever changes are committed to the version control system. For CICS applications, CI ensures that code compiles correctly, passes automated tests, and integrates properly with other components.

CI Pipeline Stages

A typical CI pipeline for CICS includes these stages:

  • Source Code Checkout: Retrieve code from version control
  • Build: Compile COBOL programs, assemble BMS maps, validate resource definitions
  • Unit Testing: Run automated unit tests
  • Code Quality Checks: Run static analysis, check coding standards
  • Integration Testing: Test integration with other components
  • Artifact Creation: Package build artifacts for deployment
text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Example Jenkins CI pipeline for CICS (Jenkinsfile) pipeline { agent any stages { stage('Checkout') { steps { git branch: 'develop', url: 'https://github.com/company/cics-application.git' } } stage('Build') { steps { sh ''' # Compile COBOL programs cobolc -o CUSTINQ CUSTINQ.cbl cobolc -o CUSTUPD CUSTUPD.cbl # Assemble BMS maps asma -o CUSTINQ CUSTINQ.bms # Validate CICS resource definitions cicsdef validate programs.csd ''' } } stage('Unit Tests') { steps { sh ''' # Run automated unit tests zunit CUSTINQ_test.cbl ''' } } stage('Code Quality') { steps { sh ''' # Run static analysis sonar-scanner ''' } } stage('Package') { steps { sh ''' # Create deployment package tar -czf cics-app-BUILD_NUMBER.tar.gz CUSTINQ CUSTUPD CUSTINQ.bms programs.csd ''' } } } }

Automated Testing

Automated testing is crucial for ensuring code quality and detecting issues early. For CICS applications, automated testing includes unit tests, integration tests, and functional tests that can run as part of the CI/CD pipeline.

Unit Testing with IBM Z Open Unit Test

IBM Z Open Unit Test enables automated unit testing for CICS COBOL programs. It supports environment-independent testing using stubs, allowing tests to run without requiring a full CICS environment.

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
*> Example unit test for CICS program using Z Open Unit Test IDENTIFICATION DIVISION. PROGRAM-ID. CUSTINQ_TEST. AUTHOR. TEST FRAMEWORK. DATA DIVISION. WORKING-STORAGE SECTION. 01 TEST-CUSTOMER-ID PIC X(10) VALUE '1234567890'. 01 EXPECTED-NAME PIC X(30) VALUE 'JOHN DOE'. 01 ACTUAL-NAME PIC X(30). 01 TEST-RESULT PIC X(10). PROCEDURE DIVISION. MAIN-TEST. *> Test customer inquiry functionality CALL 'CUSTINQ' USING TEST-CUSTOMER-ID ACTUAL-NAME *> Assert expected result IF ACTUAL-NAME = EXPECTED-NAME MOVE 'PASS' TO TEST-RESULT DISPLAY 'TEST PASSED: Customer name matches' ELSE MOVE 'FAIL' TO TEST-RESULT DISPLAY 'TEST FAILED: Expected ' EXPECTED-NAME ' but got ' ACTUAL-NAME END-IF GOBACK.

Integration Testing

Integration tests verify that CICS programs work correctly with other system components, such as databases, files, and other CICS programs. These tests typically run in a test CICS environment.

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Example integration test script #!/bin/bash # Deploy to test CICS region zowe cics deploy program CUSTINQ --region TEST1 # Define transaction zowe cics define transaction CINQ --program CUSTINQ --region TEST1 # Run test transaction zowe cics run transaction CINQ --input "1234567890" --region TEST1 # Verify results if [ $? -eq 0 ]; then echo "Integration test passed" exit 0 else echo "Integration test failed" exit 1 fi

Continuous Deployment (CD)

Continuous Deployment automates the deployment of tested code to various environments (development, test, production). For CICS, this involves deploying programs, defining resources, and updating configurations automatically.

Deployment Pipeline Stages

A CD pipeline for CICS typically includes:

  • Deploy to Development: Automatically deploy to dev environment after successful CI
  • Deploy to Test: Deploy to test environment after code review and approval
  • Deploy to Production: Deploy to production after successful testing and approval
text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Example deployment script using Zowe CLI #!/bin/bash ENVIRONMENT=$1 PROGRAM_NAME=$2 CICS_REGION=$3 echo "Deploying $PROGRAM_NAME to $ENVIRONMENT environment" # Deploy program zowe cics deploy program $PROGRAM_NAME --region $CICS_REGION --csd-group $ENVIRONMENT # Define program resource zowe cics define program $PROGRAM_NAME --region $CICS_REGION --csd-group $ENVIRONMENT # Install program zowe cics install program $PROGRAM_NAME --region $CICS_REGION # Verify deployment zowe cics get program $PROGRAM_NAME --region $CICS_REGION if [ $? -eq 0 ]; then echo "Deployment successful" exit 0 else echo "Deployment failed" exit 1 fi

Zowe for CICS DevOps

Zowe is an open-source framework that provides APIs and tools for interacting with z/OS systems. For CICS DevOps, Zowe CLI and plugins enable automation of CICS operations from CI/CD pipelines and modern development environments.

Zowe CLI CICS Plugin

The Zowe CLI CICS plugin provides commands for managing CICS resources and operations:

  • Deploy Programs: Deploy compiled programs to CICS regions
  • Define Resources: Define programs, transactions, files, and other resources
  • Install Resources: Install resources into CICS regions
  • Run Transactions: Execute CICS transactions for testing
  • Get Resource Information: Query CICS resource definitions and status
text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Install Zowe CLI CICS plugin zowe plugins install @zowe/cics-plugin # Deploy a program zowe cics deploy program CUSTINQ --region TEST1 --csd-group TEST # Define a transaction zowe cics define transaction CINQ --program CUSTINQ --region TEST1 --csd-group TEST # Install the transaction zowe cics install transaction CINQ --region TEST1 # Run a transaction for testing zowe cics run transaction CINQ --input "1234567890" --region TEST1 # Get program information zowe cics get program CUSTINQ --region TEST1

Zowe API Mediation Layer

The Zowe API Mediation Layer provides REST APIs for z/OS services, enabling integration with modern tools and platforms. CICS applications can be managed through REST APIs, making them accessible from web-based tools and CI/CD platforms.

Jenkins Integration

Jenkins is a popular CI/CD automation server that can be integrated with CICS development. The Zowe zDevOps Jenkins Plugin provides out-of-the-box integration for mainframe DevOps workflows.

Jenkins Pipeline for CICS

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
pipeline { agent any environment { CICS_REGION = 'TEST1' CSD_GROUP = 'TEST' } stages { stage('Build') { steps { sh ''' # Compile COBOL programs cobolc -o CUSTINQ CUSTINQ.cbl ''' } } stage('Test') { steps { sh ''' # Run unit tests zunit CUSTINQ_test.cbl ''' } } stage('Deploy to Test') { steps { sh ''' # Deploy using Zowe CLI zowe cics deploy program CUSTINQ --region CICS_REGION --csd-group CSD_GROUP zowe cics define program CUSTINQ --region CICS_REGION --csd-group CSD_GROUP zowe cics install program CUSTINQ --region CICS_REGION ''' } } stage('Integration Test') { steps { sh ''' # Run integration tests zowe cics run transaction CINQ --input "1234567890" --region CICS_REGION ''' } } } post { success { echo 'Pipeline succeeded' } failure { echo 'Pipeline failed' } } }

Infrastructure as Code

Infrastructure as Code (IaC) involves defining and managing CICS resources and configurations as code. This enables version control of infrastructure, consistent deployments, and the ability to recreate environments automatically.

CICS Resource Definitions as Code

CICS resource definitions (programs, transactions, files, etc.) should be stored as code in version control. These definitions can be deployed consistently across environments.

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Example CICS resource definition file (CSD format) DEFINE PROGRAM(CUSTINQ) GROUP(TEST) DESCRIPTION('Customer Inquiry Program') LANGUAGE(COBOL) STATUS(ENABLED) RESIDENT(NO) USAGE(NORMAL) RENT(NOPROTECT) EXECKEY(USER) DATALOCATION(ANY) DATALOCATION(ANY) DEFINE TRANSACTION(CINQ) GROUP(TEST) DESCRIPTION('Customer Inquiry Transaction') PROGRAM(CUSTINQ) TASKCLASS(DFHTASK) TASKPRIORITY(5) STATUS(ENABLED) TRANCLASS(DFHTRAN) SPURGE(YES) TPURGE(YES) RTRANSID(CICS) RTERMID(CICS) RTIMOUT(0) DTIMOUT(0) RTIMOUT(0) DTIMOUT(0)

DevOps Best Practices for CICS

1. Start Small and Iterate

Begin with automating a single process (e.g., builds or deployments) and gradually expand. Don't try to automate everything at once. Start with the most painful or error-prone processes.

2. Version Control Everything

Store all source code, configurations, scripts, and resource definitions in version control. This provides a complete history, enables collaboration, and allows rollback if needed.

3. Automate Testing

Implement automated testing at multiple levels: unit tests, integration tests, and functional tests. Run tests automatically as part of the CI pipeline to catch issues early.

4. Use Environment Promotion

Promote code through environments (dev → test → production) rather than deploying directly to production. Each environment should mirror production as closely as possible.

5. Implement Code Review

Require code review before merging to main branches. Code review improves quality, shares knowledge, and ensures coding standards are followed.

6. Monitor and Measure

Monitor deployment success rates, build times, test results, and application performance. Use metrics to identify bottlenecks and improve processes.

7. Document Processes

Document your DevOps processes, pipeline configurations, and deployment procedures. This enables knowledge sharing and onboarding of new team members.

Common DevOps Patterns for CICS

Pattern 1: Feature Branch Workflow

Developers create feature branches for new functionality. Changes are tested in CI, reviewed, and merged to develop. After testing in test environment, code is promoted to production.

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Feature branch workflow 1. Create feature branch from develop git checkout -b feature/new-functionality 2. Develop and commit changes git commit -m "Add new functionality" 3. Push and create pull request git push origin feature/new-functionality 4. CI pipeline runs automatically - Build - Test - Code quality checks 5. Code review and approval 6. Merge to develop branch 7. Deploy to test environment 8. After testing, merge to main 9. Deploy to production

Pattern 2: Blue-Green Deployment

Maintain two identical CICS environments (blue and green). Deploy new versions to the inactive environment, test, then switch traffic. This enables quick rollback by switching back.

Pattern 3: Canary Deployment

Deploy new versions to a small subset of users or transactions first. Monitor for issues, then gradually roll out to all users if successful. This reduces risk of widespread issues.

DevOps Tools for CICS

ToolPurposeUse Case
GitVersion controlStore and manage source code, track changes, enable collaboration
JenkinsCI/CD automationAutomate builds, tests, and deployments
Zowe CLIMainframe integrationInteract with CICS from command line and scripts
IBM Z Open Unit TestAutomated testingRun unit tests for COBOL programs
SonarQubeCode qualityStatic code analysis, code quality metrics
z/OSMFInfrastructure managementAutomate z/OS and CICS resource provisioning
DockerContainerizationCreate consistent development and test environments
AnsibleConfiguration managementAutomate CICS configuration and deployment

Challenges and Solutions

Challenge: Legacy Processes

Problem: Existing manual processes and cultural resistance to change.

Solution: Start with small, visible wins. Demonstrate value through faster delivery and fewer errors. Gradually expand automation as teams see benefits.

Challenge: Mainframe-Specific Tools

Problem: Mainframe tools may not integrate easily with modern DevOps tools.

Solution: Use Zowe to bridge the gap. Zowe provides APIs and CLI tools that enable integration with modern CI/CD platforms and development tools.

Challenge: Testing Complexity

Problem: CICS applications may have complex dependencies making testing difficult.

Solution: Use stubs and mocks for dependencies. Implement environment-independent testing where possible. Use test environments that mirror production.

Summary

DevOps practices for CICS enable organizations to modernize mainframe development while maintaining reliability and security. Key points to remember:

  • Version control is foundational: Store all source code and configurations in version control
  • Automate everything possible: Builds, tests, and deployments should be automated
  • Test early and often: Run automated tests as part of CI to catch issues early
  • Use modern tools: Leverage Zowe, Jenkins, and other tools to bridge mainframe and modern development
  • Promote through environments: Deploy through dev → test → production environments
  • Monitor and measure: Track metrics to identify improvements
  • Start small: Begin with automating one process and gradually expand

By implementing DevOps practices, CICS development teams can deliver applications faster, with higher quality, and improved collaboration between development and operations.

Test Your Knowledge

1. What is the primary goal of DevOps practices for CICS?

  • To replace CICS with modern systems
  • To automate the software delivery lifecycle and improve collaboration between development and operations
  • To eliminate the need for testing
  • To reduce security requirements

2. What is Zowe used for in CICS DevOps?

  • To replace CICS entirely
  • To bridge modern development tools with mainframe environments and enable automation
  • To compile COBOL programs
  • To manage CICS regions

3. What is included in a typical CI/CD pipeline for CICS?

  • Only compilation
  • Source code management, automated builds, automated testing, and automated deployment
  • Only deployment
  • Only testing

4. Why is automated testing important in CICS DevOps?

  • It eliminates the need for developers
  • It ensures code quality and detects issues early in the development lifecycle
  • It replaces all manual testing
  • It only tests compilation

5. How does version control benefit CICS development?

  • It eliminates the need for backups
  • It enables code review, change tracking, collaboration, and rollback capabilities
  • It automatically fixes bugs
  • It replaces testing