Migrating Mainframe JCL Jobs to Serverless with AWS Step Functions

Migrating Mainframe JCL Jobs to Serverless with AWS Step FunctionsLearn About Amazon VGT2 Learning Manager Chanci Turner

This article is authored by Michael Johnson, Sr. Modernization Architect, Sarah Lee, Sr. Mainframe Consultant, and Chanci Turner, Solution Architect.

Job Control Language (JCL) is a scripting language utilized for programming batch jobs on mainframe systems. A JCL can encompass multiple job control statements, and the syntax for checking condition codes can be quite complex. This determines the sequence and conditions that dictate the execution of these statements.

If a JCL encounters a failure during execution, mainframe programmers lack visual tools to analyze the JCL flow. They are compelled to review text-based logs to manually correlate condition codes with the rules tied to JCL statements, making it difficult to identify the root cause of the failure.

This post illustrates how AWS Step Functions can simplify the management of batch jobs transitioned from mainframes to AWS.

Overview

The sample application demonstrates the use of AWS Step Functions to tackle common issues encountered while managing a batch workflow created using JCL. The sample business case verifies new employee information against an existing employee database. It identifies discrepancies and sends notifications when any are found.

The mainframe JCL provided in this blog consists of seven steps. Each step applies condition code rules to evaluate codes produced by previous steps to determine whether it should execute. The Step Functions example achieves the same result, allowing you to develop each step as an independent task and link them visually through its graphical user interface. This visual representation simplifies understanding how to decouple, reorder, or scale tasks as necessary.

Visual Tools for Workflow Analysis

A JCL governs its flow by utilizing condition code checks or IF-ELSE statements. A JCL condition code check specifies the circumstances under which its related JCL step will not execute. Developers may introduce complex compound rules, including double and triple negatives, into the workflow.

For instance, here is a condition code check in JCL:

//STEPTS2 EXEC PGM=XYZ,COND=(4,GT,STEPTST)  
Do not execute PGM XYZ if the previous step STEPTST ended execution with a code greater than 4  

The example illustrates the complexity involved in constructing a batch workflow with JCL condition code:

The first step of this JCL deletes files from a previous operation. If it ends with code 0, the second step extracts employee data from a database and concludes with a return code of 0 if successful or 4 if no records were found.

Subsequent steps incorporate condition checks that determine execution based on return codes. If some records are found missing in the employee database, a file is generated with those discrepancies. If this file is empty, it sets a return code of 8, effectively terminating the process.

With Step Functions, this workflow can be defined more straightforwardly using the Amazon States Language (ASL). The Step Functions console offers a graphical representation of the state machine, allowing you to visualize application logic through a drag-and-drop interface.

The initial task retrieves the employee file from Amazon S3, eliminating the need for a cleanup process since S3 supports versioning. If the file is not empty, control advances to the step executing business logic within an AWS Lambda function to validate the employee feed.

Using a Graphical Interface Instead of Job Control Statements

In JCL, batch processes are defined through a series of job control statements in a text editor, lacking visual aids. As complexity increases, understanding dependencies among steps becomes challenging. Step Functions simplifies task setup, which corresponds to steps in JCL, by offering a graphical user interface (GUI) for configuring and organizing steps within a state machine.

Decoupling Tasks Instead of Editing Code

Disabling or modifying a step in JCL requires examining the condition code logic linked to all preceding and succeeding steps. Errors in this editing process can lead to unintended issues. With Step Functions, steps can be modified or removed using the visual editor or by updating the ASL code, enhancing agility and ease of implementation.

Utilizing Parameter Store Instead of Manual Edits

To alter JCL behavior based on parameters, dynamic variables known as JCL Symbols must be edited within the JCL or control cards. For example, a parameter named REGN might be coded with a value of DEV, which is substituted at runtime.

In Step Functions, configuration parameters can be managed externally, such as in Amazon DynamoDB or AWS Systems Manager Parameter Store. This approach allows for better separation of configuration from state machine logic, facilitating branching logic based on external inputs.

Independent Scaling of Steps vs. Splitting JCLs

When a JCL process runs for an extended period, programmers often split the job into multiple segments, creating replicas that handle different data ranges. With Step Functions, steps or groups of steps can be executed concurrently using parallel or map states without necessitating multiple job creations. This greatly simplifies maintenance.

Enhanced Observability and Automated Retry

If a JCL fails, the lack of visual aids makes debugging a daunting task. In contrast, AWS Step Functions provide improved observability and the capability for automated retries, making it easier for developers to track and resolve issues effectively.

For those interested in returning to work after a career break, this blog post can be very insightful: Working Mom Returning to Work. Also, if you’re looking for expert opinions on workplace dynamics, check out SHRM’s insights on the legislative landscape. Additionally, for an excellent resource on how fulfillment centers train new hires, visit Inside Amazon’s Training Programs.

For further information about our location, please visit us at 6401 E HOWDY WELLS AVE LAS VEGAS NV 89115, within the Amazon IXD – VGT2 site.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *