ZCLI1
ZCLI1
Zowe CLI and VSAM transactions. You issue a request to view the jobs, another to
view data sets, another to issue a command. Behind the scenes,
the open source framework, Zowe, is working to link the
completed all of the
Fundamentals challenges, as
it uses a little bit of everything
Slingling records with Zowe CLI and VSAM mainframe’s capabilities with easy-to-use APIs, commands,
and libraries. Simply put, you can tap into a Z system from just
from there. Nothing is
required, but we will make
120 about anywhere, using a wide variety of tools and platforms. assumptions about what you
15 steps
minutes know at this point.
ZXP>
1. Installing Zowe CLI 2. Zowe CLI install for MAC 3. NPM setup for Windows
In order to use node packages in the operating system, we need On Windows, we're first going to switch to cmd from
We've been using the Zowe Explorer plugin for VS Code PowerShell, then install zowe zli using npm, the Node Package
throughout this contest, but Zowe does much much more, and to load them into an .npm-global directory which we can be
accessed by regular users. These steps will set that up, tell npm Manager. This should work for most users, though your output
is responsible for bringing so much more to the mainframe. may look slightly different than what you see in the screenshot.
(Node Package Manager) to use it, and include that in the normal
To be clear, you're installing Zowe CLI on your own computer, list of places it looks for programs to run. For users of MacOS,
these should do the trick. 1: type cmd (this will change the shell to cmd from
not on the mainframe. You'll use Zowe CLI to interface with PowerShell)
Zowe and z/OSMF which is running on the mainframe, but you'll 1: npm i -g @zowe/cli
be driving most of this challenge from your own computer. 1: mkdir ~/.npm-global
2: npm config set prefix '~/.npm-global' 2: zowe
Linux users may need to do a bit of exploring to find what works 3: echo "export PATH=~/.npm-global/bin/:$PATH" >> .zprofile
4: source .zprofile Still stuck? Hop into the forums for guidance
on your specific system, but it should look closer to the Mac
steps, just substituting your correct shell profile file. 5: npm i -g @zowe/cli
ZCLI1 Singling records with Zowe CLI and VSAM
4. A four letter command 5. Building piece by piece 6. Examples are good doc
Now that we're all set up, grab yourself a fresh terminal, and You've been using the functionality of Zowe to issue Use the command zowe zos-jobs --help-examples for a nice
type the command zowe. Just like that, all by itself. commands and do all sorts of things through VS Code. In this listing of zowe commands you can use related to z/OS jobs.
challenge, we're just using the standalone CLI component to The output goes on beyond what's captured in the screenshot
Make sure you follow the profile setup instructions from steps do things in a different way, which can be useful in some above, and there are plenty of variations made available.
5-6 of the REXX1 challenge, otherwise this might fail. situations.
We’re starting with the basics, don’t worry, this will get a little
You’ll get back a description, a listing of command groups, and For example, to see what else can be done in the console more exciting in just a few more steps.
options. We’ll be spending a lot of this challenge going through group, type the command zowe console and then hit enter.
these command groups, and a lot of them should sound You can see there is an option to issue commands, as well as
somewhat familiar. Go to zowe.org to learn more. collect responses. Those are two more command groups within
console.
"TELL ME MORE ABOUT ZOWE. IS THIS AN IBM THING OR….?"
Zowe is an open source project for z/OS, aimed at making the platform more accessible to users who
aren't starting out with years and years of mainframe experience. The Zowe project contains
contributions from individuals as well as companies in the mainframe community. These include the VS
Code plugin, a number of APIs, and the Zowe CLI which you're about to explore.
Zowe is a project of Open Mainframe Project, which is a project managed by the Linux Foundation. It is
not an IBM product, though IBM is a contributor and supporter, and continues to advocate for Zowe as
a strategic model for bringing new capabilities and users to the mainframe platform.
One of the best ways to get connected to employers and people in-the-know is to pay attention to
what's happening in these communities and help out whenever you see an opportunity.
ZCLI1 Singling records with Zowe CLI and VSAM
In many programming languages, you can simply load in a JSON object, and then use dot notation to
access the various attributes of that JSON object, saving valuable time when programming, compared
with the manual task of writing parsers to extract information from regular output.
ZCLI1 Slinging records with Zowe CLI and VSAM
10. The keys to our data 11. Build a VSAM dataset 12. Load it up with records
One type of data set you have have seen in the Zowe menus is You’re getting good at allocating data sets. Make a VSAM data Next, we are going to add some records. You can use the existing
VSAM, and it deserves special attention. VSAM is not used for set called Zxxxxx.VSAMDS . Refer to the Zowe online help for a sample data in 'ZXP.PUBLIC.SAMPDATA', or you can have some
things like storing JCL or “Welcome to the Mainframe” guide to the command. fun and make your own. Mockaroo.com has a nice data generator
messages. Its time to shine is when an application needs to you can try out, though a few notes:
access records as quickly and efficiently as possible. In fact, When done, look at its attributes (you know how) and you’ll 1) The first column (the "keys") must be in order
without special software to interpret VSAM files, you can’t notice something pretty interesting; it looks like there are 2) Omit any blank records/rows
open them up in a normal editor, but applications happily eat THREE data sets here. Plus, if you view it in your Data Sets list 3) You will need leading zeroes for keys, otherwise VSAM may not
those files right up. in VS Code , you’ll see a snazzy new icon. Curious yet? Let’s see them as being in order when you try to import
proceed. 4) Make sure this new input data is stored in a zOS dataset.
It’s all about efficiency in data access. Read more below.
Download the sample REPRO JCL member from the
ZXP.PUBLIC.JCL dataset to your personal workstation, placing it
Here I am. Allocate me like VSAM in the folder or directory you’re currently working from. Note that
VSAM is complicated, and this little grey box is not going to give you years of experience working with if you created your own input dataset, you will need to edit the
VSAM data sets, but it will tell you that if you want that mainframe job, do all the reading and practicing JCL to point to your source data set. Name your REPRO file as
with VSAM data sets that you can. They are a core component of any big mainframe company. repro.txt
Use zowe jobs submit local-file "repro.txt" to submit the JCL
For now, know that there are four main types of VSAM data sets, KSDS (key sequenced), ESDS (entry- directly from your machine, through the Zowe CLI. You’ll see a
sequenced), RRDS (relative record), and Linear (LDS). KSDS and ESDS are the most common, and the nice little animation, and a job number. Check that job number
difference comes down to how each record gets stored and accessed. KSDS means that you reference and make sure it ran smoothly.
a key (like looking up an account number) and getting the information for that account as the record.
ESDS stores data in a sequential order, for data that is likely to be read one after the other in a
particular order. That’s enough for now, but if you’re still hungry, here’s some more to consider.
ZCLI1 Slinging records with Zowe CLI and VSAM
13. Let’s take inventory 14. Printing out records 15. Make it count
Come for the Zowe CLI, stay for the VSAM and IDCAMS.
Let’s talk about what we just did. The JCL runs IDCAMS, which We’re going to use one more IDCAMS command to look at our
To complete this, we’re looking for 3 things:
is primarily used to manage VSAM data sets. Within IDCAMS, output, the aptly-named PRINT command and check out this
1) Your Zxxxxx.ZOWEPS sequential data set
we’re using the REPRO command to load a sequential data set example (hint) and pay attention to the CHARACTER parameter 2) Your Zxxxxx.VSAMDS VSAM data set
into a VSAM-formatted data set. (There’s a LOT of complexity (hint hint) for your output to look like the above screenshot.
3) The first 20 lines of output from your IDCAMS PRINT
happening here that we don’t see, but just like before, there’s You'll be putting together information from several sources
command, copy/pasted into a sequential
plenty of opportunity to control exactly how you want that copy here, so think about what you have, and what you want. You Zxxxxx.OUTPUT.VSAMPRNT data set. Don't write this data set
to happen, including cryptographic parameters. will want to print out that VSAM data set in character format.
directly from your JCL, use SYSPRINT, and copy/paste lines 1-
Does that help? Don't be afraid to stop by the forums for some
20 of your SYSPRINT. We need the header. Refer to the
The data is the same, but it is now structured fundamentally help. screenshot above as a (lightly redacted) example.
different, indexed by key, and able to be referenced much
When you have completed the task, submit CHKAZCLI
more efficiently by programs (including ones written in REXX)
NICE JOB! LET’S RECAP NEXT UP…
In reality, this data is not indexed very well, since each line is You came into this challenge probably not knowing much about
its own key, but if we dive into the particulars of building a ZCLI, and are leaving knowing not only how to get around in
VSAM cluster, you can see how the keys and record size can be Zowe CLI, but a little bit about VSAM and IDCAMS.
specified. Now that Zowe CLI is in your
toolkit, and you have some basic
You've probably also noticed the level of instruction starting to VSAM experience, let's give you
shift from "here's a command" to "figure this out". Welcome to some more details on how VSAM
the big leagues, this is how we roll now. works.