VS Code and Zowe for z/OS Systems Programmers
When we hear about Open Source Tools, we usually think about developers coding colorful lines with an IDE (Integrated Development Environment), enjoying all the benefits from tools such GitHub and Jenkins.
However, as a Mainframe System Programmer, I also consider myself a Developer. Besides systems and subsystem upgrades, the day-to-day job of a production employee (storage administrators, security, schedulers, DBAs, CICS …) means working with JCL and REXX to automate repetitive or complex tasks.
I would like to share how I go through my daily duties, sometimes without ever logging on to a 3270 terminal emulation. The impact on productivity is noticeable and you will see soon why. First, setting up your work environment is simple. I have installed in my laptop Visual Studio Code as my IDE. I have also installed some extensions very useful for me: COBOL, JCL, REXX, in order to have colored text, help on auto-completing the name of commands and variables, syntax checking, etc.
The most important pieces I have also installed are the Zowe extension and the Zowe CLI. These are essential for easy and direct interaction with the LPARs I work in. zOSMF and Zowe Mediation Layer need to be installed in the mainframe to be able to use the Zowe extension and the CLI.
Now you need to configure your access to your mainframe work environment. You do so simply by creating profiles. I have also created the needed Zowe profiles to interact with each LPAR and every subsystem (CICS, Db2 …).
Next is to create access to our files in z/OS. To do so, we need to add our zOSMF profiles to the Zowe extension. Click on the Zowe extension icon and then on the plus sign to add our profiles.
A window pops up and we see all the profiles we have already created. We just need to select one:
We can do the same for accessing our USS paths or JES2 Held outputs. We just need to put our mouse over the headers and click on the plus sign again to select one profile or more.
Now I can directly see my files and data sets. I can search, with the same pattern I would in ISPF 3.4 for the files that begin for any HLQ.*. To do so, I just need to click on the magnifying glass icon in the profile title bar:
To retrieve results for more data sets, we just have to separate, for example the different HLQs, with commas.
I can now see the names of the data sets. The ones that begin with a ‘greater-than’ sign are partitioned data sets. All others are sequential.
When I click on any member, it is displayed on my screen. With the extensions I have installed in Visual Studio, and my libraries have the LLQ as REXX or JCL, my browser understands what the source is, and therefore I get all its advantages. The code is colored, and when I am editing my REXX code on the right side, and I begin typing the name of a variable, the names of the variables I have already used on this script are suggested. This avoids many errors. You can just scroll to the right variable and it will be completed.
On the left side, where the data sets tree lists my files and members, some icons appearing on the right side of the name are available for editing. Download or upload the files to the mainframe, because when you edit, download or just click the member name, you are working locally in your workstation. Control-S saves it directly on the mainframe.
Since I have a 24-inch screen, I can see more records than with any 3270 emulation. I can make the fonts small enough to fit as much code as I can read with comfort.
Another benefit of using an IDE is that I can edit several scripts at the same time, even the same member so I can work in two pieces of the code that are related and they are simultaneously updated with every change.
In this last screenshot, I am editing the same file in the center and right screens. I have edited some more members. To see them, I click on the tabs at the top of the editing area. Also, notice that in every edit area, there is a small code map on the right that shows all code structure. This is very useful, for example, when we are using the FIND (Control-F) command and all the results are marked, so we can scroll directly to the occurrences.
In addition, you can notice that on the left, I can see my JES2 output executions. I have added two more profiles so I can see the output I execute on other LPARs. In this example, I selected one of the outputs of one execution and I can see it in the left side of my code browser.
Also notice the actions you can take when right clicking with the context menu on the files:
The same for the JES outputs:
Finally, yet importantly, the bottom part of the IDE, the Command Line Interface area, is where I can use Zowe to issue any command against my current machine profile.
I can submit a JCL that executes the REXX code I just modified and saved. In this case, I added some parameters in order to View All Spool Content (--vasc) after the JCL finishes its execution, the output will be download to a directory called ‘OUTPUT’ (-d). It will be created if it does not exist, and finally, the name of the file will be the jobid with the .OUT (-e) extension added. Zowe allows us infinite uses of our mainframe resources.
This is just a sample on how taking advantage of ‘modern’ tools can help mainframers too.
Note there is a new extension pack on the Visual Studio Code marketplace, called Code4z, worth sharing with colleagues developing in COBOL.
Follow this blogsite as I will post more entries on how can we use Jenkins to serialize and orchestrate a set of tasks and use ooRexx (Open Object REXX) to interpret local REXX on Windows or Linux machines. With this approach, we can automatize repetitive tasks such morning checklists or trigger events depending on our mainframe responses after issuing Zowe commands.
Learn more about Zowe at this site; more Zowe blogs here