VS Code for daily mainframe work
Many mainframe teams now edit COBOL, JCL and copybooks in Visual Studio Code next to the ISPF screens they already know. The editor, search across files, the integrated terminal and workspaces cover most daily work, and extensions such as IBM Z Open Editor and Zowe Explorer add mainframe languages and access to data sets, z/OS UNIX files and jobs.
Why a mainframe team uses VS Code
ISPF is still the fastest way to look at a data set on the system itself. But once source lives in Git, most changes start in a desktop editor: you search a whole repository in a second, see every changed line before you commit, and keep the JCL, the COBOL and the copybooks of one change side by side. Visual Studio Code (VS Code) is the editor many teams settle on because it is free, runs on Windows, macOS and Linux, and has Git built in.
The parts you use every day
| What you want | In VS Code | The ISPF habit it replaces |
|---|---|---|
| Find any command | Command Palette: Ctrl+Shift+P (macOS ⇧⌘P) | Remembering option numbers |
| Open a file by name | Quick Open: Ctrl+P | =3.4 and a data set name pattern |
| Search every file | Search: Ctrl+Shift+F, with regular expressions and include/exclude patterns such as **/*.cpy | SRCHFOR across a library |
| Run commands | Integrated terminal: Ctrl+` (or Terminal > New Terminal) | TSO READY or OMVS |
| See and stage changes | Source Control view: Ctrl+Shift+G | Comparing two members by eye |
The terminal opens at the root of your workspace, so git status there talks about the repository you are looking at. You can open several terminals side by side, each with its own shell.
Workspaces
Opening a folder makes it your workspace. A multi-root workspace holds several folders in one window, for example the payroll-batch repository and the shared copybook repository, added with File > Add Folder to Workspace. Saving it creates a .code-workspace file, which also stores settings that apply to every folder in it.
{
"folders": [ { "path": "payroll-batch" }, { "path": "shared-copybooks" } ],
"settings": { "files.trimTrailingWhitespace": false }
}Extensions for z/OS work
- IBM Z Open Editor adds language support for COBOL, PL/I, HLASM, REXX and JCL: syntax checking as you type, code completion, an outline of the program and a Problems view listing errors.
- Zowe Explorer lets you work with data sets, z/OS UNIX files and jobs from VS Code, through connection profiles to services on the mainframe. With z/OSMF or the RSE API configured, you can open a member from z/OS and edit it with Z Open Editor's language support.
- Your site decides which extensions are approved and how they connect. Install only those, and never put passwords in workspace files.
Which key combination opens the Command Palette in VS Code on Windows or Linux?
Show a hint
Ctrl, Shift and the first letter of Palette.
Show the solution
Ctrl+Shift+P (⇧⌘P on macOS).
Examples are for learning. Run commands and jobs only on a system you are authorised to use, such as a training or test system, and never on production without approval.
Common mistakes
They are separate copies. Change the repository, commit, and let the build put it on z/OS.
Ctrl+Shift+F searches the whole workspace; an include pattern such as **/*.cpy narrows it to copybooks.
Use the extensions your site has approved; an extension can read every file you open.
What you will see at work
- New starters are often given a workspace file that opens every repository of the application at once.
- Expect both screens on your desk: VS Code for changes, ISPF and SDSF for looking at the system and the job output.
- Code review comments often quote line numbers from VS Code's editor, so turn line numbers on if your site has them off.
Key terms
Check your understanding.
Take this lesson's quiz and save your progress. Free.