Tackle Master the Mainframe using Zowe CLI and VSCode

Ever wondered how to connect Zowe CLI to the IBM Master the Mainframe contest’s mainframe? Or how to use VSCode with Master the Mainframe’s mainframe? This will be a thorough guide on how to install and setup everything Zowe related in order to connect to the MTM mainframe. Sorry for the long title, I need to make sure Google indexes this well, haha.

Heads up, if you mess up a lot during this process you will need to reset your password a lot of times. IBM’s tolerance on failed login attempts is very low which leads to a fast lock out. This is a good thing though! Click here to read how you can reset your password.

Installing Zowe CLI and its prerequisites

Node.js

Source.

First all of we need to install Node.js, any version above 8 or the LTS version will do.

After installation, please verify that your Node.js is correctly installed by trying the following commands in your terminal or command prompt. Before doing this, close your existing terminals completely and re-open them. This will force them to reload the environment variables defined in your system.

node --version
npm --version

Let’s ask IBM for access to Zowe

We need to talk to Zih. Who is Zih? He’s the guy you talk to when you have lost your password. Follow this guide to add Zih as a contact on Slack. Then you need to send him the following message:

Can you connect my id to zowe? Z50087

Be sure to change up your IBM ID. I have picked this off of YouTube, but I believe any sentence with Zowe and your ID in it will trigger the bot command. You could try ‘pls Zowe Z50087’.

Zowe CLI Package

After you have verified that your Node.js installation is correct, execute the following commands in your terminal.

npm install -g @zowe/[email protected]

zowe plugins install @zowe/[email protected]

zowe plugins install @zowe/[email protected] @zowe/[email protected] @zowe/[email protected] @zowe/[email protected] @zowe/[email protected]

The last command is optional, but I’m going for a complete installation.

Note, if you have an EACCESS error then you might need to give this a read. If you’re running a Linux distro then you might need to prepend sudo to your commands.

Configuring Zowe CLI

Source.

First of all we need to create a profile, we need to change up the following command:

zowe profiles create zosmf-profile myprofile123 --host host123 --port port123 --user ibmuser --password pass123 --ru false

After following the initial connectivity guide in the contest we can use those variables to create our profile. Be sure to use the latest connectivity guide as reference, I’m using the 2019 version. My command now looks like this:

zowe profiles create zosmf-profile mtm2019 --host 192.86.32.91 --port 10443 --user Z50087 --password pass123 --ru false

We can test our connection by executing a status check command. Don’t forget to change the profile name to yours.

zowe zosmf check status

Now I get to see the installed plug-ins. If the mtm2019 profile is not your default profile, then you’ll have to specify which profile you want to use in the command using –zosmf-profile ProfileName.

Delete a profile using the command zowe profiles delete zosmf profileName –force.

Configuring VSCode

Source.

First install Visual Studio Code like you normally would install any other program. Yes, I am making my sentences longer than they need to be, this is a 1000 words assignment afterall. (JK).

Small note, I am using Visual Studio Code Portable from https://garethflowers.dev/vscode-portable/. This is so I can create custom VS Code instances for specific projects and langauges.

Look for the Zowe Explorer extension in the plug-in market. Install the extension.

Adding your connection to the plug-in

After installing the plug-in, a new menu item will appear. Click that menu item, then hover over data sets and you’ll see a plug sign. Click the plus sign and it will prompt you to create a new connection to z/OS.

  • Profile name: mtm2019
  • Host: https://192.86.32.91:10443
  • Username: z50087 (your IBM id)
  • Password: pass123 (your password)
  • Reject unauthorized: false. It’s best you search for ‘false’ in the box to make sure you can’t select the wrong one.

After the connection is set, you will need to add the profiles to the different tabs.

Plug-in in action

In data sets I active my profile, in this case it’s zowemtm2019. Then I click on the loop to perform a search action. I’ll search for my own profile, z50087.

Observe the items highlighted in red. After my query I can see all my data sets and its members.

Yes yes, I bet you have noticed. I have messed up a million times creating the profiles, I literally have like a thousand profiles that don’t work because I barely knew what URL to enter. It also took me ages to notice my IBM z/OS was locked because of my failed login attempts haha. Ha. :'(

Use-Cases

Source.

  • View, rename, copy and filter mainframe data sets, USS files and jobs.
  • Create download, edit, upload, and delete PDS and PDS members.
  • Create Zowe CLI compatible zosmf profiles.
  • Switch between Zowe CLI zosmf profiles to quickly target different mainframe systems.
  • Submit jobs.

It also makes me feel young when using it.

Interesting plug-ins

First of all you might want some syntax highlighting.

  • IBM Z Open Editor by IBM. For Enterprise COBOL, PL/I, and JCL.
  • rexx-syntax-highlighting by Thomas Weber. For REXX ofcourse.

Atmospheric images

Up next?

I finally did it, a Zowe post. Believe me, it was a hassle to make. I didn’t really find any clear guides on how to do it with the master the mainframe mainframe. Or maybe I missed it? Hmm…

Anyhow, how are you doing? Are you safe?

IBM MTM 2019: Final Words

Hello! Here I am again!

It has been a month or so since the last post. First of all, I would like to thank all my readers and commenters for being here and motivating me to complete the entire series! My first blog for this years’ challenge was on the 9th of September. The last one was on the 25th of December. A bit late, I know!

So, let us take a look at my badge!

It’s beautiful isn’t it? Oh god that picture… heheh.

Again, thank you all! This year was massive!

The traffic jump in comparison to last year is big. This is a screenshot that shows the traffic the blog got from the 1st all the way to the 31st of December 2019. It might not be the numbers Facebook reaches, but it’s pretty big to me. I have reached out to all corners of the world!

Master the Mainframe 2020

I don’t know the plans they have for the next edition. Last year they said they were going to cooperate with Zowe but they didn’t as far as I know. I am a bit dissapointed though! I was planning to prepare some Zowe posts but I unfortunately didn’t need to.

Some regrets

Wow, hello dedicated reader. I must apologise. I feel that the quality of explanation has lacked. The content wasn’t new to me anymore so I had a hard time feeling what really needed explanation and what didn’t. What made me realise that was the following thread in the official Slack channel.

At times my blog indeed felt like edited copies. I hope they weren’t that bad though!

The future

I have some plans for this mainframe website. Well, “mainframe” website is a big word. I want to blog about some other stuff too. So I would like to ask e-mail subscribers to reconsider their subscription, there’s a link available to opt out!

  • Master The Mainframe 2020
  • z/OS Cookbook

Those are the plans. I know, not ambitious! But I’m very interested in making a high quality cookbook. A cookbook in programming terms is just a bunch of snippets people can use to quickstart what they want to make or want to solve.

What about you?

Any final words?

IBM MTM 2019: Part Three – Challenge #15

Hello Hello Hello

Today I’m doing the very last challenge of the IBM Master the Mainframe 2019 contest. It has been a long 4 months and we’ve finally reached the finish line.Now let’s take some time to finish this exercise.

Originally I wrote “exercise” wrong, but then I Googled it and corrected it. JUST. FOR. YOU. Isn’t that lovely? (heart emoji thing) Also, the WordPress spelling corrector underlined that word red and it triggered me very hard. You see, UX helps!

So, just to be able to finish before the 31st of December I’ll do a minimum viable product approach. That means I’ll do the absolute minimum to pass (i hope).

Also my apologies to everyone. I have 20 to 30 comments waiting for help and a ton of e-mails still waiting for a reply. I can’t keep up with the demand! Work, holidays, family and partying is taking up most of my time. Goodluck to everyone!

Learning and using z/OS creatively

IBM Master the Mainframe Part Three – Challenge #15

Start the Final Challenge

Let’s start by getting the required data sets. We can do this by issuing tso submit ‘zos.public.jcl(p3ch15)’ from the ISPF Primary Option Menu.

The first time you do this it will allocate new data sets. The second time you do this it will delete and reset some data sets. BE WARNED!

It made the following data sets:

  • ch15.clist
  • ch15.output

It also wrote a timestamp into p3.output(#15) and created REXXJCL member in our JCL data set.

System Activity Utility

From the ISPF Command Shell Panel (=6) I’ll issue the command ex ch15(get) to execute our challenge 15 code.

I’ll enter to select ‘Report specific message identifier found in SYSLOG’.

If prompted for a message id enter ich408i.

This is the result.

Solving this challenge

Don’t take my word for it. Don’t automatically assume I’m right. I don’t exactly have an answer sheet 😉

But what needs to be done?

  • The challenge is for you to enhance a system utility which generates point-in-time system activity reports.
  • At least 1 report you write must demonstrate ability to parse SYSLOG records.
  • Information requested has options 1-6 constructed, option 7 is blank.

So does this mean that I need to make option 7? And make it output whatever I want/can? There needs to be at least 1 report that parses SYSLOG records.

Is this the absolute minimum? I assume so. Great!

Step 1: REXXJCL

I just noticed the ID needs to be filled in in our Z#####.JCL(REXXJCL). I’ll do that first. GETSTRG does not exist in my CH15.CLIST data set. Do I need to create that member? Do I even need to do this? (I didn’t)

Warning: don’t do this just because I do!

Step 2: Explore CH15.CLIST

For the most part I’ll let you figure this out yourself. I’ll only write about the most interesting parts.

These are the challenge files we’re working with.

When we do ex ch15(get) we actually execute this rexx code.

So… IBM has left us with a few options and ideas. We can just code the ones they suggest or we can invent a new option at option 7.

For the MVP principle, I’ll delete 3 options and only do one, the fourth one. As I’m part of the learner program I have about 9 months more to expand. My apologies to the people that thought I would make something impressive! 

I just want to provide an example during the last days the students have available.

Step 3: The Plan

The easiest one in my opinion is getting the TSO logons, unsuccessfull or successfull. ICH70001I is the code that gets logged when a user has logged on. Shortly after that code, the username is displayed along with some timestamps.

I just need to grab those entries and print them to the screen. I can basically use the code of report 1, remove the input prompts, sanitize the data and then it should be ok!

Let me test my theory.

My theory is correct! I’ll delete the other options and make it clear to IBM which option they need to pick.

I have removed the excess options and added the exec ch15(custom) command. Now I’ll go ahead and code my custom option. My custom option will also use the custom file in the clist data set.

Step 4: Coding

Unfortunately, I’m not allowed to share my code. But you should be fine on your own! I have used code bits from https://www.tutorialspoint.com/rexx/rexx_parsing.htm and https://www.rosettacode.org/wiki/Remove_duplicate_elements#REXX to write the solution.

My result

This is the menu that is now generated.

Then after that we get the following output:

So this is an unique list of all the users that have logged on. I’m happy with my MVP approach. I believe these are the logons from today? I’m not 100% sure.

Have I missed something? What have you come up with?

I feel like I have though. Although, I have at least 1 report that demonstrates ability to parse SYSLOG records and I have enhanced a system utility. Is this enough?