IBM MTM: Part Three – Challenge #14

Today I’m tackling the last real exercise of IBM’s Master the Mainframe contest. This will mark completion of all #MTM2018 its challenges. The cherry on top is a challenge about the Rexx scripting language.

Rexx is used to create routines that automate many tasks. What makes Rexx so accessible is that the language itself is very simple to understand and that any programming language can execute compiled Rexx.

The Rexx code supports 4 types of statements:

  1. Functions
  2. Instructions
  3. Built-in functions provided by the specific processing facility
    See chapters 3 and 4.
  4. Commands available to the specific processing facility
    See chapter 10.

Some more resources on Rexx:

  1. Basic Syntax
  2. Strings
  3. Arrays

There are many other excellent internet sources of information for Rexx such an introduction from a small company in UK and Introductory Rexx Tutorial.

Get Rexx Code

IBM Master the Mainframe Part Three – Challenge #14

Let’s begin! I need to finish this so I can start working on challenge #15. I’ll navigate to Z30163.SOURCE and s slots. After creating a new member I’ll just copy ‘zos.mtm2018.public.source(slots)’ and save it.

There it is! Let’s go! Now let’s execute slots using the ex line command. There’ll be errors! Prepare your lifeboat!

40 +++ f = randum(1,4) 
16 +++ call play 
Error running SLOTS, line 40: Routine not found

Hmm… routine not found at line 40. I found the error, it’s pretty simple. Let’s edit and execute again.

Huh? Cherry, VIEW.2 and Cherry. Which one is the odd one out? Let’s fix that! Now where can I find view?

I’ve spotted the mistake. Hmm… Once you win, you will be instructed to read the slots Rexx code to complete the challenge successfully. Can’t I just read the source code and see what needs to be done? Guess not.

Blistering barnacles! I’ll have to play again and actually do maths… Noooo! I’ll have to read the REXX code and find 5 numbers. What if I just modify the code and make it say the numbers? But hey, for the sake of this challenge, I won’t ruin it 🙂

I’ve got the numbers 4232 in P3.OUTPUT(#14). Didn’t I need 5 numbers? Huh.

They have an array called ky and add keys 1 to 5 to it. Not to and including? Each ky array key has a random value between 111 and 999. Then they do something interesting at line 000088 to 000090.

That’s all I needed to know. I’ll go ahead and tso ch14 mynumbers.

I won! I’m expecting my $1,000,000.00 to come any day now. Have you won any money recently?

Share this:

IBM MTM: Part Three – Challenge #13

Assembler! No, it’s not a language that Ikea has come up with. Assembly, asm, scary numbers language thingy or assembler, it has many names. This is there part where I tell you I haven’t written any asm but state that I’ve written some language that looks like it. Ehh… not this time.

This challenge is about… surprise surprise! Assembler!

IBM Z Mainframe Assembler

IBM Master the Mainframe Part Three – Challenge #13

This challenge sure won’t make me a full fledged Assembler programmer but I’ll at least have some experience with asm. Asm is more difficult to learn than other languages. It requires you to learn Assembler mnemonics, machine instructions, Assembler directives, Assembler macros and you need to know a thing or two about hardware architecture.

Being able to understand Assembler gives one the ability to debug complex system problems by reading system dumps. Higher level languages such as C/C++, Java, Cobol etc. were created to make programming the computer easier by hiding the complexity of the underlying machine instructions, addressable memory and registers.

Compile assembler program

I have to admit that this challenge is a good filter. I suffer from great procrastination. Let’s go ahead and compile the assembler program. Let’s edit Z30163.SOURCE and make a new member name s asmpgm and copy ‘zos.mtm2018.public.source(asmpgm)’ and submit. I’ll jump straight to the output panel while I’m at it.
There’s a full review of what this code does available at I doubt I’ll explain it better than IBM 🙂

Use TSO TEST facility to understand assembler program execution

Let’s test the code that we’ve compiled using test ‘z30163.load(asmpgm)’  this has to be done inside the TSO Ready prompt. I had to remove the LOGOFF command when logging in so I could =x and boot myself to the TSO screen.
Now I can run these commands. Excuse my laziness but please check mybluemix to know more about each command.

Note, I will have to enter go numerous times to proceed with the program execution. It should stop at +42.

This is an important part. We know register 2 holds the value 4. The loop continues until register 2 is zero. So it iterates a total of 4 times. We enter go 8 times because we execute 2 things inside the loop.

Well that sure was something! I did this process twice, help! Once for myself and the second time to get some screenshots. I can’t embarrass myself right?!

Modify and re-compile ASMPGM assembler program

Let’s do this boys, girls, bits and bytes!
  1. Use register 6 for all operations where register 2 was previously used
  2. Use register 7 for all operations where register 3 was previously used
  3. Initialize the register used to sum each add operation in the loop with a zero value
  4. Execute the loop 10 times adding 5 to the register being used to sum each add operation

Help! Can I pay someone to do this for me?

As for the registers 6 and 7, just change all occurrences where register 2 or 3 is used. In IBM’s explanation they state which register is being used at what line inside the code. So it’s a matter of understanding the code or just ctrl+f ‘register 2’ at mybluemix 😉

Initialise the register used to sum each add operation in the loop with a zero value is easy. Think how the two registeres are initialised now, they hold the value Begin. Then a bit further register 6 and 7 are ‘loaded‘ with value 4 and 1. I’ve only edited the one register where we add something. I didn’t touch the other register where we subtract from.

We can find the storage address of label LOOP at +3A, when we’ve entered go it adds 1 to register 3 until register 2 is zero as it subtracts one every loop. So in the end register 3 was 5 and register 2 held the value zero. How many times did we need to enter go in order to get register 2 to 0?

Think fast! IBM now wants us to execute the loop 10 times and add 5 every iteration to the register where we add a number.

I think I’ve got it right, now is a good time to debug again and tso submit ‘zos.public.jcl(p3ch13)’ to copy my code to P3.OUTPUT. Let’s debug first! Don’t make the same mistake I did, we’re debugging new registers now 🙂 not register 2 or 3. But 6 or 7.

Looks like it iterated 10 times all the way down to where register 6 equals zero and register 7 equals 0x32 (hex).

Should be it!

Share this:

IBM MTM: Part Three – Challenge #12

We’re in for a short blogpost. I thought those were long gone. Today I’m taking a look at virtualisation with z/VM. Actually the z/OS we’ve been working on was a virtual machine controlled by a single LPAR (logical partition).

I’ve been wondering, there’s so much you can do with a mainframe, how on earth can a man learn everything? Do you get proficient in mainframes once you’re ready to retire?

IBM Z Mainframe Supports 5 Unique Operating Systems

IBM Master the Mainframe Part Three – Challenge #12

I have fiddled around with virtualisation quite a bit. I’ve worked with Virtualbox, VMWare workstation/player and VSphere. But this is probably a whole other level of virtualisation. I’m really curious.

IBM Z supports 5 unique operating systems:

  1. z/OS – flagship operating system used for this contest
  2. Linux – if you know Linux, you know Linux that runs on IBM Z
  3. z/VM – hypervisor operating system
  4. z/TPF – Transaction Processing Facility
  5. z/VSE – similar to z/OS with less features and functions

IBM Z supports 2 types of hypervisors:

  1. LPAR – Logical Partition, a type 1 hypervisor
  2. z/VM – z/Virtual Machine, a type 2 hypervisor

An IBM Z machine can run just about 85 different LPARS at the same time. Running 8,000+ operating systems within a single IBM Z frame with network delay between the operating systems near zero is industrial strength architecture. Impressive! If you’re interested you can request a trial for a Linux virtual machine at

z/VM query command output in preparation for challenge

Let’s head to the ISPF Command shell using =6. Then enter the primary command q cplevel go get more information about the z/VM Operating system hosting the z/OS contest virtual machine.

Entering q n show the number of virtual machines currently active as guests of z/VM.

Hmm, so there are 56 virtual machines? Or 57 including the VSAM – VTAM one. Let’s check which network interface controller I’m using, by issuing q nic.

This is my information. What’s yours? Let me know in the comments below! I also need to issue q 400-402 to see information about device 400 to 402.

Missing text:
0402 OUT + 04 IOCNT = 01245891  ADP = 000 PROG = 000 UNAVAIL = 128
0402          BYTES = 00000000361094D2

I got the information I needed.

Gather z/OS system definitions used to communicate with z/VM hypervisor

Now I exit the ISPF Command Shell and check the vendor.tcpparms data set using dslist ‘vendor.tcpparms’. I need to select the member S0W1.

I need to delete all lines except the 3 lines with the NIC adapter name. So does that mean that I need to delete all lines that don’t have ‘DEVOSA1′ in it? I just did and only have 3 lines left, good.

To be honest, I have no idea how to work with label so I just copied after .zl. So now I’ve copied 99 lines into p3.output(#12) and I should be done.

So that’s it! P3.output(#12) now has 7 lines of z/OS definitions used to connect to z/VM.

Challenge #13 – What about it?

It’s been a very rough week, and challenge #13 is very long and complex so it’ll take much longer for me to complete this challenge and write a blogpost about it. Just a friendly heads-up 🙂

I’m also sad, I thought I was going to learn about virtualisation but to be fair… I’ve learning pretty much nothing from this challenge. What was the point of this? So I would know which NIC I had? No idea.

It was black friday recently, did you buy anything?

Share this: