IBM MTM 2019: Part Three – Challenge #03

Logging, the most important part of any piece of software and also the paper industry. Today we’re going to take a look at some handy logging tools in the mainframe.

System Log, SYSLOG

IBM Master the Mainframe Part Three – Challenge #03

Activate user log (ULOG)

From SDSF we need to enter the primary command ulog. We should see SDSF ULOG CONSOLE in the upper left corner of our screen. Do you remember how to get to the SDSF panel? Enter sd from the ISPF Primary Option Menu as primary command.

Let’s terminate by issuing the command ulog close.

Press F3 to go back

Capture SYSLOG output only related to your specific actions

So again from the SDSF menu we enter ulog. After that we need to enter some commands, be sure to substitute your ID?

  1. Enter command /d ts,z######
  2. Enter command /d m=cpu
  3. Enter command /d iplinfo
  4. Enter ulog again to display content of current ulog

This is what I eventually got.

Print the user log content

From SDSF we need to enter print. Then we should see lines printed in the right upper corner.

I have entered print and I have seen the lines printed message.

Write the user log content to p3.output(#03)

Note: Failing to include “Member to use” and “Disposition” could overwrite all of p3.output resulting in loss of previous challenge output

From the same screen I’ll enter owner z50087; prefix z50087; st. Then next to my jobname I’ll execute line command.

We need to view the DDNAME that begins with SYS.

It should contain the content of the printed ulog. It does! Now I’ll enter end to return to the JES pool listing. Yes I know I know, in the next screenshot you’ll notice Z500087 not found error, but that’s not an issue.

Now we’ll need to copy this using the xdc line command.

I need to change the data set namemember to use and disposition.

Then we press enter and we should be done 🙂 Let me check P3.OUTPUT to verify.

Yes! Looks good! Consider this part done!

IBM MTM 2019: Part Three – Challenge #02

Bonjour!

This time we’re playing a slots game, no, not in a casino. That’s gambling! Gambling is bad! We’re programming our own version, well… fixing someone else’s version of slots.

I would like to remind you that I’m not allowed to give the correct solution to part 3 its challenges. I will however guide you a bit through the process and show you what my results are.

REXX Language Syntax

IBM Master the Mainframe Part Three – Challenge #02
So we need to execute a few commands before we can start this challenge. In our Z#####.REXX we need to make a new member using the primary command s slots. When editing that new member we need to copy ‘zos.mtm2019.public.rexx(slots)’ into it.
Let’s save and execute by going back and executing the line command ex next to the member name.
I got the following, there’s obviously something wrong in the code. I can already spot the mistake in the first screenshot, look for fruit.f.

Modify SLOTS REXX code enabling FRUIT.? variable to contain a fruit value

So let’s go back and read what IBM has to say. The scripts starts a do loop at line 20. At line 24, 26 and 28 the VIEW.# variable get sets to a random fruit name value. BUT there seems to be a problem at line 28. This line requires a modification. Once we fix it, we need to execute it again.

Pick the odd one out, fix it and execute. Let me do that.

The third fruit now shows correctly! Nice!

Modify SLOTS REXX code to acknowledge a win

Hmm… there still seems to be an issue when you win a game of slots. The error is caused by line 73, we need to fix that, our intern misspelled something. Damn you Brian! Let’s investigate the issue.

So, this again is a game of spot the odd one out. But there’s only one to compare the other one to. High chance of failure and high chance of success. Love it! Fix line 73 please 😉 Let me fix it and execute it again.

Two hours later I finally won a game. But I don’t really know the correct 5 digit safe box key. Time to review the code! Type end to exit the code.

Review SLOTS REXX code to determine the 5 digit safe deposit box key

Time to get our minds dirty. We must read the code in order to win this thing!

Ok we need to take a look at line 63 to 78. The key is 2001. Then we have an array n with 6 numbers in it. After that there’s a loop that iterates of the array n. When the current iteration is either 1 or 2 then it skips the iterations? Assuming iterate is the same as continue in JavaScript or PHP. Then, otherwise, it just add the current index of the array to key.

I know what to do. Time to get the calculator. I got the number, do you? If you’re desperate, take a look at line 81 😉

Do like the screenshot above and let’s see if we get the right output.

View p3.output member #02 for winnings deposited

I have censored the number, but my winnings are deposited!

Did you win?

Are you also a millionaire? I am! Time to buy that mainframe I always wanted, IBM, expect a call soon!

IBM MTM 2019: Part Three – Challenge #01

Yatta!

Let’s begin solving part three its challenges.

But first, I’ll give you a heads-up on what I’m going to do. Last year I wasn’t allowed to release the answers to part three. I asked the new manager (Misty Decker) about any rules regarding blogs but I have yet to get a reply. So, I’ll just give clear instructions on the easy challenges and no answers to the harder challenges. If there’s anything IBM wishes me to censor then please contact me using an official IBM mail address or via Slack.

Getting Started

IBM Master the Mainframe Part Three – Challenge #01

How to get started

For starters we’ll issue the primary command tso sub ‘zos.public.jcl(part3)’ from the ISPF Primary Option menu to allocate the part 3 data sets.

I have submitted the command and chose the jobname character ‘a’.

Exposure to REXX, the z/OS all purpose scripting language

REXX is cool. Seriously. Our first assignment is to edit Z#####.REXX and create a new member hello using the primary command s. After that we’ll copy ‘zos.mtm2019.public.rexx(hello)’ into our new member.

Now I have this.

I have copied it. The script displays basic capabilities of string concatenation at line 16 (in comment), basic usage of arrays from line 9 to line 11, disk read and write and finally some say commands to display information to the screen.

Execute modified REXX

First we need to modify the REXX script.

  1. Change lines 9, 10, and 11 to be comments
  2. Change lines 13, 14, 15, and 16 to execute – remove comment markers

Now all that’s left to do is execute this script. We can do so by going back to the dslist and entering line command ex from execute next to the member name hello.

I pressed enter and in the lower part of my screen it said hello. The script works!

Normally this output should now be in P3.OUTPUT(#01). Let’s check to see if we completed challenge 01 of part 3.

AHA! I have it! We have completed the challenge!