Beginner’s Guide: COBOL Made Easy

Jessielaine Punongbayan
Modern Mainframe
Published in
7 min readDec 19, 2019

When I was starting as a Mainframe Application Developer, there were so many things that I needed to learn. That included COBOL and JCL.

What is COBOL?

Common Business-Oriented Language a.k.a COBOL is a compiled English-like computer programming language designed for business use. It is imperative, procedural and, since 2002, object-oriented. It is primarily used in business, finance, and administrative systems for companies and governments. It is still widely used in legacy applications deployed on mainframe computers, such as large-scale batch and transaction processing jobs.

What is JCL?

Job Control Language a.k.a JCL is the command language of Multiple Virtual Storage (MVS), which is the commonly used Operating System in the IBM Mainframe computers. JCL identifies the program to be executed, the inputs that are required and location of the input/output and informs the Operating System through Job control Statements. In mainframe environment, programs can be executed in batch and online modes. JCL is used for submitting a program for execution in batch mode.

Why is this important?

As mentioned in the definition, COBOL is still widely used in legacy applications that runs on big businesses such as Fortune 500 companies. Deciding to start a career in mainframe means learning the programming language these businesses require.

But do not be afraid! 😵

Photo by Caleb Woods on Unsplash
Photo by Caleb Woods on Unsplash

Learning COBOL

Nowadays, there are so many tutorials for COBOL. To name a few, there’s:

…and so much more… including YouTube. So there’s no need to worry. If you give yourself time to learn, you will learn COBOL in no time.

So what now?

As a reader of this blog, I will assume 3 things:

  1. You already have the basic knowledge to start coding in COBOL
  2. You also know how to use a JCL
  3. You have a general knowledge of how mainframe works (i.e. working with data sets, submitting a job etc.).

So… today, we will practice! 👍

Photo by Danial RiCaRoS on Unsplash

so open your 3270 terminals and we will start…

But… I don’t have a 3270 terminal!

No worries! I got you! 😉

Mainframe modernization has led to a lot of innovations. One of these innovations is the Zowe Explorer.

What is Zowe Explorer?

Let us start with the question “What is Zowe?”.

Zowe is an open source project that offers modern interfaces to interact with z/OS and allows you to work with z/OS in a way that is similar to what you experience on cloud platforms today. It helps young developers today to interact and work with mainframe using the development tools that they know and love. It is a modern solution for modern mainframe developers

“So, What is Zowe Explorer?”

Zowe Explorer is a VSCode extension that allows you to access Zowe while using VSCode. This gives you the option to use IDEs rather than the 3270 terminals in developing your COBOL programs.

Wait! There's more!

One advantage that I really like in using VSCode is that it offers a lot of extensions. Aside from Zowe Explorer, I can also use other extensions like Code4z. This extension offers syntax highlighting and content assist for COBOL programs. Brilliant!! 👏

Code4z

As a COBOL developer, the Code4z extension pack is a very cool addition. It includes extensions such as Zowe Explorer, COBOL Language Support, HLASM Language Support, Explorer for Endevor, Debugger for Mainframe and COBOL Syntax highlighting.

As I explore this, I found great features such as:

Auto-Complete: It provides live suggestions while you type. This can be COBOL keywords, variables, paragraphs or code snippets.

Syntax and Semantic Check for Code: It checks for mistakes and errors in your COBOL code.

Copybook Support: This, by far, is my favorite. 😊 The extension allows you to reference the copybooks that you have in your program. As a COBOL programmer, having a quick peek in your copybooks is sometimes a struggle. With this feature, it really makes coding easier.

Although I would like to point out that the Copybook path must be defined as “COPYBOOKS” folder in current VSCode work space before you can activate this feature.

Update: With COBOL LSP’s latest release, you can define the copybook library in settings.json and the extension will automatically detect and download the copybooks that you need. No need to worry about it anymore 👏 😮

and many other features like checking for periods

validating if your code exceeded column 80

and removing excess spaces in your program

So far, I have been enjoying exploring Code4z and I am looking forward to the enhancements that they are going to make in the future.

If you want to know more, you can read through these articles or if you want to contribute to this project, you can check out their repository.

Before we start…

Disclaimer: I am a Broadcom Software Engineer and I am part of the Zowe Development team. This is my personal point-of-view and my own personal preference.

Photo by Nadine Shaabana on Unsplash

I would like to make sure that you have the right access. My first blog teaches you how to obtain access in mainframe. In case you don’t have one, please feel free to go ahead and read it.

If you already have access… let’s move on. 🚜

“Begin at the beginning”

All great developers start from the beginning… and that means… 🥁

the “Hello World!” program! 👏

Let’s open VSCode and begin writing this code. We will take advantage of Code4z’s wonderful capabilities.

When you are done, save it in your source library and compile it.

If you do not have a compiler, please feel free to use the compiler that I am submitting in Open Source Development Trial environment.

Sample Compiler

After a successful compile, we will test it by calling the HELLO WORLD program. We will execute it using HELOTST.JCL.

Please feel free to use mine if you don’t have one.

Go to the Jobs Panel and search for your submitted JCL. et voilà! 🎉

COBOL is soooo fun!

Photo by Spencer Davis on Unsplash

I know right?… This is an easy program but, with the help of these extensions, I found coding in COBOL is way more easier and way more fun today. I hope you did too!

So… What did you learn today?

  1. You learned about Zowe, Zowe Explorer and Code4z!
  2. You (probably) read my first blog and learned how to gain access to mainframe!
  3. You learned how to write your own Hello World COBOL Program 😎
  4. You learned how to compile your COBOL program!
  5. You learned how to debug your compiler because it abended the first try!

Wow! Amazing! 😝

I really hope that this has been a good introduction and I will see you on the next one! 🚋 🚋 🚋

To check out the code written on this blog, please visit my Github repository:

Want to watch instead?

If you want to know more, I have included below the links about Zowe and Open Mainframe Project.

--

--

Jessielaine Punongbayan
Modern Mainframe

Art and tech enthusiast. As an artist and software engineer, I write about the intersection of creativity and technology. Sharing insights and experiences.