This repo houses small Java applications that can be used to learn Java if you don't already know it, or learn new features that you haven't seen before if you do.
It is a Java port of the cobol-is-fun code patterns. Each sample was translated from IBM Enterprise COBOL into standard, modern Java so you can run it on any machine with a JDK — no z/OS, JCL, or mainframe access required. The original COBOL behavior, including its formatted output, has been preserved.
- Java 21 or later
- Apache Maven 3.8 or later
This simple Java application demonstrates how to parse JSON using the Jackson library, the Java equivalent of the COBOL JSON PARSE statement. It is written to work in a standalone fashion so it can run without any input files. The JSON strings are declared in memory, as are the objects that hold the results of the parse, and everything is printed out for clarity.
See json-parse/README.md.
This application shows how well Java works with data. It reads lists from three input files, merges them all together, and sorts them. The application then writes the sorted list to an output file. All this in just a few statements using the Java Collections framework.
See my-first-program/README.md.
| COBOL concept | Java equivalent in this repo |
|---|---|
JSON PARSE statement |
Jackson ObjectMapper.readValue |
MERGE / SORT statements |
List.addAll + List.sort with a Comparator |
Working-storage PIC clauses |
POJO fields plus formatting helpers |
Edited PIC display formatting |
DecimalFormat / String.format helpers |
| JCL compile / bind / execute | mvn package and java -jar |
This code pattern is licensed under the Apache License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 and the Apache License, Version 2.