Scala on z

In this episode of Coding with Kip, I demonstrate the results of a proof of concept work effort the summer of 2018, showing that using Scala on z/OS is possible. The video shows the following

  • GitHub can be used on the z/OS Unix System Services linux component.
  • Builds in this environment can be done using Maven.
  • The resulting Java JAR file can be executed in that environment, using standard linux commands.
  • The same JAR file can be executed on the z/OS side of the system, using JCL.
  • Scala can be coded to access the z/os Jzos module. Jzos modules allow java to access z/OS services natively, doing things like I/O using JCL datasets, and giving standard JCL return codes.
  • Scala modules can be used in the Application Performance Analyzer for z/OS to highlight performance implications.

This video gives an overview of the resulting system.

jZOS with Scala Sample Code

The following are elements that can be used in recreating this project.

Project Setup

The following dependency must be place in the POM file for the build to occur properly.


Since jzos is not an open source component, you will need to import the JAR file into your project. You can download it from the z/OS environment you have access to, in the IBM delivered libraries.

In Module Set-up

At the top of the Scala module, you’ll need to import the jzos library with the following code.


You’ll also want to set the platform encoding with:

val encoding = ZUtil.getDefaultPlatformEncoding

Read Process

In order to create a receiving container for the data, we defined a Byte Array

var vendorHistoryCurrentData: Array[Byte] = null

And we defined the file as a RecordReader:

var vendorHistoryFileIterator: RecordReader = null

The following code reads the file

vendorHistoryFileIterator = RecordReader.newReader(ZFile.getSlashSlashQuotedDSN("Your file name here as a constant"),
vendorHistoryCurrentData = new Array[Byte](vendorHistoryFileIterator.getLrecl)

You’ll also want to close the file when complete:


Write Process

The following creates a file to write to:

val vendorHistoryWriter = RecordWriter.newWriter(
  ZFile.getSlashSlashQuotedDSN("your file name as a constant here"),ZFileConstants.FLAG_DISP_SHR)

You’ll also want to close the file:


This is another episode of Coding with Kip, the technical sub-series of Conversations with Kip, the best financial system vlog there is. Literally learn more–about ledgers and financial systems–at

Watch the series in order at the Coding with Kip Playlist.

One thought on “Scala on z

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s