Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
80 views22 pages

ZCLI1

The document provides a comprehensive guide on using Zowe CLI with VSAM, detailing installation steps for different operating systems and various commands for managing datasets. It emphasizes the importance of understanding VSAM datasets and their types, as well as how to efficiently access and manipulate data on IBM Z systems. The challenge is designed for users who have completed foundational training and aims to enhance their skills in mainframe data management.

Uploaded by

marshall.lloyd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views22 pages

ZCLI1

The document provides a comprehensive guide on using Zowe CLI with VSAM, detailing installation steps for different operating systems and various commands for managing datasets. It emphasizes the importance of understanding VSAM datasets and their types, as well as how to efficiently access and manipulate data on IBM Z systems. The challenge is designed for users who have completed foundational training and aims to enhance their skills in mainframe data management.

Uploaded by

marshall.lloyd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Advanced 250127-1538

ZCL1
Zowe CLI and VSAM
• SLINGING RECORDS WITH ZOWE CLI AND VSAM
• 1 INSTALL THE ZOWE COMMAND LINE
INTERFACE
• 2 INSTALL ON MACOS
• 3 INSTALL ON MICROSOFT WINDOWS
• 4 A FOUR-LETTER COMMAND
• 5 BUILDING PIECE BY PIECE
• 6 EXAMPLES ARE GOOD DOC
• 7 FORMAT FOR JSON

250127-1538
• 8 ALLOCATE AND LIST
• 9 FULLY CUSTOMIZED
• 10 THE KEYS TO THE DATA
• 11 BUILD A VSAM CLUSTER
• 12 LOAD IT UP
• 13 LET’S TAKE INVENTORY
• 14 PRINTING THE RECORDS
• 15 MAKE IT COUNT

IBM Z Xplore Copyright IBM 2021-2024 [


SLINGING RECORDS WITH ZOWE CLI AND VSAM
The challenge builds on your experience with Zowe, shows you more of the options available, and opens up the world of VSAM.

The Challenge

You interact with the mainframe through a series of 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 capabilities of the mainframe with easy-to-use APIs,
commands, and libraries.

Simply put, you can tap into a IBM Z system from just about anywhere, using a wide variety of tools and platforms.

ZCL1|250127-1538
Before You Begin

This challenge will make most sense if you have already completed all of the Fundamentals challenges, as it uses a little bit of everything
from there.

Nothing is required, but assumptions will be made about what you know at this stage.

Investment

Steps Duration

15 120 minutes

IBM Z Xplore Copyright IBM 2021-2024 [2/22]


1 INSTALL THE ZOWE COMMAND LINE INTERFACE
You been using the Zowe Explorer plugin for VSCode throughout the Fundamentals challenges, but Zowe does much much more, and is
responsible for bringing so much more to the mainframe.

Just to be clear, you are installing the Zowe CLI on your own computer, not on the mainframe (it is already there!).

Zowe CLI is a node.js package, which requires node to be installed and available in your computer operating system.

ZCL1|250127-1538
You will use Zowe CLI to interface with Zowe and z/OSMF which is running on the mainframe, but you will drive most of this challenge from
your own computer.

Linux users may need to do a bit of exploring to find what works on your specific system distribution, but it should look closer to the
MacOS steps, just substituting your correct shell profile file.

IBM Z Xplore Copyright IBM 2021-2024 [3/22]


2 INSTALL ON MACOS
In order to use node.j packages in the operating system, they need to be loaded into a .npm-global directory which can be accessed by
regular users.

The following steps will set that up, tell npm (the Node Package Manager) to use it, and include that in the normal list of places it looks for
programs to run.

ZCL1|250127-1538
For users of MacOS, these should do the trick.

1. mkdir ~/.npm-global
2. npm config set prefix ‘~/.npm-global’
3. echo “export PATH=~/.npm-global/bin/:$PATH” >> .zprofile
4. source .zprofile
5. npm i -g @zowe/cli
6. zowe

(Linux users should find the steps work there, too)

IBM Z Xplore Copyright IBM 2021-2024 [4/22]


3 INSTALL ON MICROSOFT WINDOWS
On Windows, you will find it simpler to first switch to cmd from PowerShell; then install Zowe CLI using npm.

ZCL1|250127-1538
This should work for most users, though your output may look slightly different than what you see in the screenshot.

1. Open a Command terminal


2. type cmd (this will ensure the shell is Cmd, not PowerShell)
3. npm install @zowe/cli
4. Close the terminal
5. Open a Command terminal
6. type cmd (this will ensure the shell is Cmd, not PowerShell)
7. zowe

Generally, this should work; however, Windows laptops may have group policies in effect which can limit the ability to instance software, or
update the PATH environment setting.

Still stuck? Hop into the forums for guidance

IBM Z Xplore Copyright IBM 2021-2024 [5/22]


4 A FOUR-LETTER COMMAND
Now that your CLI is all set up, grab yourself a fresh terminal, and type the command zowe . Just like that, all by itself.

ZCL1|250127-1538
You should get back a description, a listing of command groups, and options. You will be spending a lot of this challenge going through
these command groups, and some of them should sound familiar.

If you want to know more than the information in the command details, go to https://zowe.org to learn more.

IBM Z Xplore Copyright IBM 2021-2024 [6/22]


5 BUILDING PIECE BY PIECE
You’ve been using the functionality of Zowe to issue commands and do all sorts of things through VSCode. In this challenge, you will use
the standalone CLI component to do things in a different way, which can be useful in some situations.

For example, to see what else can be done in the console group, enter the command zowe console .

ZCL1|250127-1538
You can see there is an option to issue commands, as well as collect responses. Those are two “sub-command” groups within console.

IBM Z Xplore Copyright IBM 2021-2024 [7/22]


6 EXAMPLES ARE GOOD DOC
Use the command zowe zos-jobs --help-examples for a nice listing of zowe commands you can use related to z/OS jobs.

ZCL1|250127-1538
The output goes on beyond what is captured in the screenshot above, and there are plenty of variations made available.

Start with the basics but don’t worry, this will get a little more exciting in just a few more steps.

IBM Z Xplore Copyright IBM 2021-2024 [8/22]


“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
VSCode plugin, a number of APIs, and the Zowe CLI which you are to exploring now.

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 is happening in these
communities and help out whenever you see an opportunity.

ZCL1|250127-1538
IBM Z Xplore Copyright IBM 2021-2024 [9/22]
7 FORMAT FOR JSON
Make sure you have your VSCode JOBS view active so that you can see your running jobs, and enter the command zowe zos-jobs list jobs

You get back a listing of actively running z/OS jobs that you have access to look at. Neat!

Now, issue the same command with --rfj (Response Format JSON) after it.

ZCL1|250127-1538
Now you get the FULL output, and the output is in JSON format, which can be much more easily interpreted by programs that prefer JSON
format.

IBM Z Xplore Copyright IBM 2021-2024 [10/22]


8 ALLOCATE AND LIST
Take a look at the zowe files command group and use that to “allocate” (create) a sequential dataset named Zxxxxx.ZOWEPS (use your
Z userid, of course)

Next, use another zowe cli command to show the attributes of the dataset you just created. They should look similar to the following:

ZCL1|250127-1538
In the unlikely event you get a timeout error message, you might want to try adding --responseTimeout 30 to the end of the command, to
allow for delays in response.

IBM Z Xplore Copyright IBM 2021-2024 [11/22]


9 FULLY CUSTOMIZED
So now you know yet another way of creating and looking at datasets.

The thing is, you made that dataset using a set of default values, and one of the great things about datasets is how customizable they are.

Delete the ZOWEPS dataset (with another zowe files command) and use the help (or online documentation at https://zowe.org ) to re-
create that sequential data set with some customized attributes.

The requirement this time is for the Record Length to be 120 instead of the default 80 (there will got some long records to store in the
dataset), and a specific block size of 9600.

When you get it, you’ll see a different readout for the Block Size (blksz)and Record Length (lrecl) properties, like in the screenshot below.

ZCL1|250127-1538
IBM Z Xplore Copyright IBM 2021-2024 [12/22]
What about JSON?

Why do we need JSON when the original output made perfect sense to us?

JSON stands for JavaScript Object Notation, and it’s just a way of nesting the attributes of something into an object so it can be fully
represented whenever it’s accessed.

It is often seen to be a little more lightweight and flexible than another file format with a similar goal you may have heard about,
called XML .

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.

ZCL1|250127-1538
IBM Z Xplore Copyright IBM 2021-2024 [13/22]
10 THE KEYS TO THE DATA

ZCL1|250127-1538
One type of dataset you have seen in the Zowe menus is VSAM, and it deserves special attention.

VSAM is not used for things like storing JCL or “Welcome to the Mainframe” messages.

Its time to shine is when an application needs to access records as quickly and efficiently as possible. In fact, without special software to
interpret VSAM files, you can’t open them up in a normal editor, but applications happily eat those files right up.

It’s all about efficiency in data access. Read more below.

IBM Z Xplore Copyright IBM 2021-2024 [14/22]


11 BUILD A VSAM CLUSTER

ZCL1|250127-1538
You’re obviously getting good at allocating data sets. Make a VSAM data set called Zxxxxx.VSAMDS.

Refer to the Zowe online help for a guide to the command.

When done, look at its attributes (you know how) and you’ll notice something pretty interesting; it looks like there are THREE data sets
here. Plus, if you view it in your DATA SETS list in VSCode, you’ll see a snazzy new icon.

Curious yet?

IBM Z Xplore Copyright IBM 2021-2024 [15/22]


12 LOAD IT UP
Empty datasets are not very useful - so now you’re going to add some records.

You can use the existing sample data in ZXP.PUBLIC.SAMPDATA, or you can have some fun and make your own. https://Mockaroo.com
has a nice data generator you can try out, though a few notes:

1. The first column (the “keys”) must be in (ascending) order


2. Omit any blank records/rows
3. You will need leading zeroes for keys, otherwise VSAM may not see them as being in order when you try to import
4. Make sure this new input data is stored in a zOS sequential dataset or a PDS member.

Download the sample REPRO member from the ZXP.PUBLIC.JCL dataset to your personal workstation, placing it in the directory you’re
currently working from.

ZCL1|250127-1538
Note that if you created your own input dataset, you will need to edit the JCL to point to your source dataset name.
Name your REPRO file as repro.txt

zowe jobs submit local-file "repro.txt"

can be used to submit the JCL directly from your machine, through the Zowe CLI.

You’ll see a nice little animation, and a job number. Check that job number and make sure it ran smoothly.

IBM Z Xplore Copyright IBM 2021-2024 [16/22]


ZCL1|250127-1538
IBM Z Xplore Copyright IBM 2021-2024 [17/22]
Here I am. Allocate me like VSAM

VSAM is complicated, and this little grey box is not going to give you years of experience working with VSAM datasets, but it will tell
you that if you want that mainframe job, do all the reading and practicing with VSAM data sets that you can. They are a core
component of any big mainframe company.

For now, know that there are four main types of VSAM data sets -

KSDS key-sequenced data set

ESDS entry-sequenced data set

RRDS relative record data set

LDS linear data set

ZCL1|250127-1538
KSDS and ESDS are the most common, and the difference comes down to how each record gets stored and accessed.

KSDS means that you reference 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.

More details available at zOS Concepts

IBM Z Xplore Copyright IBM 2021-2024 [18/22]


13 LET’S TAKE INVENTORY

ZCL1|250127-1538
Let’s talk about what you just did. The JCL runs IDCAMS, which is primarily used to manage VSAM datasets. Within IDCAMS, you used the
REPRO command to load a sequential set of records into a VSAM-formatted dataset.

There’s a LOT of complexity happening “behind the scenes” that you don’t see, but there’s plenty of opportunity to control exactly how you
want that copy to happen, including cryptographic parameters.

The data is the same, but it is now structured fundamentally different, indexed by key, and able to be referenced much more efficiently by
programs (including some written in REXX!)

In reality, this data is not indexed very well, since each line is its own key, but if we dive into the particulars of building a VSAM cluster, you
can see how the keys and record size can be specified.

Much more detail in the IDCAMS introduction

IBM Z Xplore Copyright IBM 2021-2024 [19/22]


14 PRINTING THE RECORDS

ZCL1|250127-1538
There is another very handy IDCAMS command to look at your data - the aptly-named PRINT command.

Details for the PRINT command

Check out the example (hint) and pay attention to the CHARACTER parameter (hint hint) to help produce output to look like the above
screenshot.

You’ll be putting together information from several sources here, so think about what you have, and what you want. You will want to print
out that VSAM dataset in character format.

Does that help? Don’t be afraid to stop by the forums for some help.

IBM Z Xplore Copyright IBM 2021-2024 [20/22]


15 MAKE IT COUNT
Come for the Zowe CLI, stay for the VSAM and IDCAMS.

To complete this challenge, the validation will check for 3 things:

1. Your Zxxxxx.ZOWEPS sequential data set with the right properties


2. Your Zxxxxx.VSAMDS VSAM data set, loaded with data records
3. The first 20 lines of output from an IDCAMS PRINT command, copy/pasted into a sequential Zxxxxx.OUTPUT.VSAMPRNT data set.

Don’t write the VSAMPRNT data set directly from your JCL; use the joblog SYSPRINT, and copy/paste lines 1-20 of your SYSPRINT.

The checker will look for the header.

ZCL1|250127-1538
Refer to the screenshot above as a (lightly redacted) example. When you have completed the task, submit the checker job CHKAZCLI

IBM Z Xplore Copyright IBM 2021-2024 [21/22]


Nice job - let’s recap Next up …

You came into this challenge probably not knowing much about Zowe CLI,
and are leaving knowing not only how to get around in Zowe CLI, but a little
bit about VSAM and IDCAMS. Now that Zowe CLI is in your toolkit, and you have some
basic VSAM experience, let’s give you some more details
You’ve probably also noticed the level of instruction starting to shift from on how VSAM works.
“here’s a command - run this exactly” to “figure this out”.

Welcome to the big leagues, this is how we roll now

ZCL1|250127-1538
IBM Z Xplore Copyright IBM 2021-2024 [22/22]

You might also like