IBM MTM 2018: 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?

15 thoughts on “IBM MTM 2018: Part Three – Challenge #14

  1. i mean 6581 is the total of four number ?..
    i have just one day sir to complete can you tell the total scenario ..
    all the things are totally messed up right now

    1. Hi Anonymous, let’s continue the discussion here.

      It’s perfectly possible for there to be no 5th number. 4 numbers is also ok. My personal number was 4232, that’s only 4 numbers.

      Kind regards,
      – Kevin

          1. When i am writing tso ch14 6581
            And press enter,it is showing “6581”
            I am not getting the output like the screenshot which you have shown!
            I have mailed you the screenshot.
            Please check if possible!

            1. Hi Anonymous

              I saw that you have fixed the REXX code correctly. Did you win the game? You need to play the slots game until you WIN the game. See my explanation: It will only work with the winning numbers.

              You have to reverse the numbers! Please try submitting with the numbers backwards! Please check line 000090 in the code. 6581 should become 1856, so you “tso ch14 1586”.

              You don’t need 5 numbers, the 5 numbers are already summed in the REXX code. All you need is the result of that sum from a winning game, the result can be 4 numbers too.

              Kind regards,

  2. how can i get the 5 numbers please help ..
    i checked my p3.output challenge 14..
    it shows 6581…
    is this number the addition of 4 numbers ..
    i am really confuses please help

    1. Hi Anonymous

      I believe the numbers are randomised, everybody can get a different number, 6581 can be your number indeed! But it changes everytime you execute the REXX script.

      If you’re in a rush or not sure, read some of the other clever solutions from the other commenters here 🙂

      Kind regards,
      – Kevin

  3. this is my idea !
    after line 81…r(insert one more line )
    0082 say ky.i
    0083 end
    0084 “allocate allocate.dataset( fi(key) shr (reuse)”
    0085 “execio 5 diskw key (stem ky. finis)”
    0086 “free fi(key)”
    0087 /***coment***/
    0088 unlock=ky.1+ky.2+ky.3+ky.3+ky.4+ky.5
    0089 /*coment*/
    0090 say unlock=” unlock*/<–coment this line
    0091 /*unlock=reverse(unlock)*/
    0092 u.1=unlock
    0093 /*———————————————————————*/

Leave a Reply

Your email address will not be published. Name, email and website not required.