Convert COBOL batch programs to PySpark on Databricks

Copybooks parsed into typed schemas. COBOL programs converted to PySpark DataFrames. JCL job streams become Databricks Workflows. VSAM and flat files land as Delta Lake tables. Full lineage, validated parity.

Book a Live Demo →
Why Databricks

Mainframe batch patterns map to distributed Spark

Sequential batch becomes parallel DataFrames

COBOL programs process records one at a time through PERFORM loops. PySpark on Databricks processes the same logic across a cluster of executors. Batch windows that run overnight can finish in minutes.

Copybook layouts become typed schemas

COBOL copybooks define record layouts with PIC clauses, REDEFINES, and OCCURS. MigryX parses these into PySpark StructType schemas with correct data types — including packed decimal (COMP-3) and zoned decimal handling.

JCL job streams become Databricks Workflows

JCL EXEC, DD, and PROC statements define job steps, datasets, and execution order. Databricks Workflows handle the same DAG orchestration with parameterized tasks, conditional branching, and failure alerting.

Parser output

Copybook + COBOL program to PySpark

A COBOL copybook with REDEFINES and a batch program that reads VSAM, applies business rules, and writes output — converted to a PySpark job on Databricks with Delta Lake output.

COBOL Copybook + Program
       COPY ACCT-REC.
       05 ACCT-ID        PIC X(10).
       05 ACCT-BAL       PIC S9(9)V99 COMP-3.
       05 ACCT-TYPE      PIC X(1).
          88 SAVINGS      VALUE 'S'.
          88 CHECKING     VALUE 'C'.
       05 OPEN-DATE       PIC 9(8).

       PROCEDURE DIVISION.
           PERFORM UNTIL END-OF-FILE
               READ ACCT-FILE INTO ACCT-REC
               IF ACCT-BAL > 100000
                   MOVE 'HIGH' TO RISK-FLAG
               ELSE
                   MOVE 'STD'  TO RISK-FLAG
               END-IF
               WRITE OUT-REC
           END-PERFORM.
MigryX
converts
PySpark on Databricks
# Copybook → schema, Program → PySpark
from pyspark.sql import functions as F
from pyspark.sql.types import *

# Parsed from copybook ACCT-REC
schema = StructType([
    StructField("acct_id", StringType()),
    StructField("acct_bal", DecimalType(11,2)),
    StructField("acct_type", StringType()),
    StructField("open_date", StringType()),
])

df = spark.read.schema(schema) \
    .format("csv").load("/mnt/acct_file")

df = df.withColumn("risk_flag",
    F.when(F.col("acct_bal") > 100000, "HIGH")
     .otherwise("STD"))

df.write.format("delta").mode("overwrite") \
    .saveAsTable("acct_risk_scored")

PIC clauses become typed schema fields. COMP-3 packed decimal becomes DecimalType. PERFORM loops become DataFrame operations. VSAM and flat files land as Delta Lake tables.

Coverage

COBOL to Databricks — artifact mapping

COBOL / Mainframe Component Databricks Equivalent Notes
COBOL programPySpark notebook / jobBatch logic as DataFrame operations
Copybook (PIC clauses)StructType schemaAll PIC types mapped (X, 9, S9, V)
REDEFINESConditional schema parsingUnion types handled
OCCURS / OCCURS DEPENDING ONArrayTypeFixed and variable-length arrays
COMP-3 (packed decimal)DecimalTypePrecision and scale preserved
88-level condition namesF.when() conditionsNamed conditions as filter logic
PERFORM loopsDataFrame transformationsSequential → parallel processing
EVALUATE / IF-ELSEF.when().when().otherwise()Business rules preserved
VSAM KSDS / ESDSDelta Lake tableACID storage with key ordering
Flat file (FB/VB)Delta Lake tableFixed/variable record layouts parsed
DB2 SQL (EXEC SQL)spark.sql()Embedded SQL preserved
JCL job streamDatabricks WorkflowEXEC steps → task DAG
JCL DD statementsMount / table referencesDataset routing preserved
Validation

Mainframe output validated against Databricks

Data Matching compares mainframe production output against Databricks results — record by record, field by field. Packed decimal precision, date formats, and sign handling are all verified before cutover.

See how Data Matching works →
Parser
Copybook structural parse
COMP-3
Packed decimal support
Delta
VSAM → Delta Lake
JCL
Job streams → Workflows

COBOL to Databricks: mainframe modernization

Batch COBOL programs with copybooks, VSAM files, and JCL job streams converted to PySpark notebooks on Databricks. Packed decimal and REDEFINES handling validated. JCL converted to Databricks Workflows. All outputs verified with Data Matching before mainframe decommission.

View case studies →

See it on your own COBOL programs

Send us a copybook and sample program. Get parsed schema, PySpark code, and a validation report.

Book a Live Demo → hello@migryx.com