Improve your z/OS enterprise developer productivity with IBM Z Open Editor‘s code snippets library

by Peter Haumer and Jonathan Sayles

Learning a new technology such as a new programming language with its SDKs and APIs can be a daunting task. Even developers with years of experience often start a new programming assignment by first researching code in previous projects they worked on or other related work. The massive popularity of sites such as https://stackoverflow.comopen in new window with its 11 M registered users shows that there is a big need for looking up best practices and standard solution patterns.

For z/OS enterprise developers, this problem is worse as there is not a lot of information out there. We currently count only 440 question about z/OS on Stack Overflow out of a total of 19 M. So many new enterprise developers start new assignments by first going on an "archaeological dig” in their organization following the popular "Monkey See, Monkey Do" development pattern, hunting down an existing program, copying the entire file, then cannibalizing the source, deleting most of the PROCEDURE and DATA DIVISION, editing the ENVIRONMENT and IDENTIFICATION DIVISIONs, etc. We might even have thought of this as a kind of haphazard "code reuse”. Occasionally we might have wondered if there are some better and more structured ways to reuse production code in order to jump start program development.

Production code reuseopen in new window has long been an objective for software developers. There are at least three important reasons given for this:

  • Productivity: Reusing syntactically correct and working code takes less time to develop and test.
  • Consistency and standards conformance: Maintenance and support costs are lowered as reusable code consists of recognizable patterns.
  • Education: By leveraging a catalog of reusable functions, developers who are new to z/OS can be given working examples of advanced language, statements, and code patterns accelerating time to mastery.

With IBM Z Open Editoropen in new window, we want to provide a development environment that feels natural and modern for the next generation of enterprise developers and gives them the tools they need. So, in addition to providing the latest language and editing features, we also want to help new developers to get started quicker as well as experienced developers to have access to best practices.

To achieve that goal, we enlisted IBM's most experienced educators and services consultants to give use their treasure trove of code patterns that they felt provided the largest value to COBOL, PL/I, and JCL practitioners. Greg Lambert, form the IBM Z Open Editor team, curated these collections and provided them as code snippets available in the latest release of IBM Z Open Editoropen in new window. The result is a library with a total of 186 snippets categorized as follows:

  • COBOL: 27 general COBOL language support snippets, 12 embedded SQL snippets, 29 CICS, 12 IMS, and 8 VSAM
  • PL/I: 12 general PL/I language support snippets, 29 CICS, 11 IMS, and 7 VSAM
  • JCL: 27 code snippets

These snippets provide everything you need from elemental basic statement groups, to full sets of routines and paragraphs of business logic with full computations and complex conditional logic, and frequently used statements such as job cards, database routines, or complex COBOL code such as UNSTRING and many more.

You can use these snippets for learning and as starting points for your own projects as well as use VS Code’s ability to manage your own library of user-created snippets based on these. If you have already used code snippets with IBM Developer for Z (IDz), we even provide an Import command to load these snippets into IBM Z Open Editor as well. For information about how to insert code snippets, create your own code snippets, and import code snippets from IBM Developer for z/OS, see the documentationopen in new window.

The following animated GIF shows you a few examples for how to use IBM Z Open Editor's snippets.

IBM Z Open Editor Code Snippets

Fig. 1: IBM Z Open Editor Code Snippets in action.

Although we provide these snippets as-is, we would love to hear from you about the value of the current stack, what issues you found, as well as what other snippets we should add. You can submit issues to our github siteopen in new window to start the discussion.

Last Updated:
Contributors: Peter Haumer, Min Huang, Peter Haumer, enzi