DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Exploring the DBMS_DEVELOPER Package: JSON Metadata for Oracle Objects
  • When TypeScript Types Meet Untrusted AI: Building Type-Safe LLM Pipelines With Runtime Validation
  • Replacing JSON With Protobuf in Your Microservice Mesh: A Zero-Downtime Migration Blueprint
  • Fetching Information Randomly From JSON Using Node, Nuxt, Express

Trending

  • A Deep Dive into Tracing Agentic Workflows (Part 1)
  • What Full-Stack AI Engineering Means in Real Projects
  • The Jobs Matrix for AI: Four Boxes Instead of 40 Tools
  • Agentic System Design in Practice: The Technical Debt in Enterprise Agentic Systems

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Coding
  3. Languages
  4. COBOL Copybook Transformation to JSON in Mule4

COBOL Copybook Transformation to JSON in Mule4

Learn more about COBOL copybook and how to transform to JSON in Mule4.

By 
Priyabrata Dash user avatar
Priyabrata Dash
·
May. 10, 22 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
6.1K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

What Is COBOL Copybook?

A COBOL copybook is a type of flat file that describes the layout of records and fields present in the file.

Example of Copybook data:

Copybook dataLet’s say the above example is a representation of Employee data which consists of Employee Number, name, phone number, and dept which is based on the below copybook definition:

 Employee data

Steps To Convert the Copybook Into JSON

Step 1:

As part of the first step, we need to generate a flat-file schema definition i.e.  .ffd file from the above-provided copybook (.cpy file) using the Transform Message component. 

Import a COBOL definition .cpy file into the Transform Message component by selecting the  Set Meta-Data Type in the Transform message Input section. 

Set Meta-Data Type

Once the import of the .cpy file is correctly done then, the Transform component will convert this .cpy file and generate the flat file schema definition, and will store it inside the src/main/resources/schema folder of your Mule project

schema

The generated flat-file schema file looks like the below:

flat-file schema

Step 2:

Drag and drop the Set Payload component from Mule Palette to specify MIME Type and the schema path of the incoming payload. MIME-type should be “application/flatfile”. Under schemaPath specify the above-generated .ffd file path.

Set payload

Step 3:

Drag and drop the Transform Message component after the Set Payload for data conversion.

Transform Message component

The final mule application now looks like this:

cobol to json flow

Test Using Postman

Request:

Request

Response:

Response

COBOL JSON

Opinions expressed by DZone contributors are their own.

Related

  • Exploring the DBMS_DEVELOPER Package: JSON Metadata for Oracle Objects
  • When TypeScript Types Meet Untrusted AI: Building Type-Safe LLM Pipelines With Runtime Validation
  • Replacing JSON With Protobuf in Your Microservice Mesh: A Zero-Downtime Migration Blueprint
  • Fetching Information Randomly From JSON Using Node, Nuxt, Express

Partner Resources

×

Comments

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook