IBM MTM: Part Three – Challenge #15: Preparation

Before I continue, the preparation phase of challenge #15 is going to be a very long wall of text and images. Probably longer than China’s wall. Be prepared or be scared.

A full code review can be found at my GitHub, it’s better to read the GitHub review and blog conclusion if you’re participating.

It’s time for some good old role-play. No, this is not a blog about Dungeons & Dragons. This is about me playing the role of an experienced z/OS technician. My assignment is to help a newbie become familiar with the z/OS environment. I have become the teacher. Worship me.

I’ll be assisting my students by explaining some system details in a report format using a combination of JCL, SDSF, SDSF commands, Rexx scripts, z/OS commands, JES2 commands and to finish the list, some TSO commands.

I’m among the small fraction of the contestants completing the last challenge, but I’m not eligible to be a winner or a honourable mention as I’m not a student. I thought I’d mention this to not keep you waiting. I know, I know… I probably would’ve won everything but hey, I have to stay humble.

This final challenge is a matter of exercising technical creativity to distinguish my ideas and work from the other contestants. I’m given a few ideas with sample Rexx code as the basis for applying my creativity. I have to say that my creativity will be limited as my job currently swallows up all my time. I do hope to finish the master the mainframe challenge but I fear I won’t.

This final challenge is a matter of creativity and quality. It’s not a matter of quantity. All my reports are ought to be a quick read and educational to someone new to the contest system.

Before I start, I’ll be reviewing some examples to help me prepare for this challenge.

Preparation

IBM Master the Mainframe Part Three – Challenge #15 Preparation

I’ll start out by grabbing a copy of the challenge #15 data sets, tso submit ‘zos.public.jcl(p3ch15)’. This should give me

  1. Z30163.CH15.JCL
  2. Z30163.CH15.OUTPUT
  3. Z30163.CH15.SOURCE

First of all apologies for the smaller screenshots, I’m taking screenshot on my 13″ mac and the emulator screen is really small. I’m working on #MTM during my commute 🙂

CH15.OUTPUT

Now I’ll check and see what CH15.OUTPUT holds. CH15.OUTPUT has members S00, S01 and TMPS00 holds system command output, S01 holds SDSF command output and TMP holds SDSF output but with some more information.

CH15.JCL

I have two partitioned members, S00JCL and S01JCL.

S00JCL is JCL used to write system command output to CH15.OUTPUT(TMP). S00JCL executes Rexx routine TRIMCOL writing new member S00. Rexx routine TRIMCOL trims unnecessary leading 45 columns writing CH15.OUTPUT(S00). 

S01JCL is JCL used to write SDSF command output to CH15.OUTPUT(TMP). S01JCL executes Rexx routine TRIMLINE writing new member S01. Rexx routine TRIMLINE removes unnecessary SDSF primary menu and blank lines writing the remaining output to CH15.OUTPUT(S01).

Rexx samples

This is going to be a long blogpost. Like… seriously long! There are 11 different REXX samples. That’s a lot of code to go through, I’ll make a summary of the code I could use to complete challenge #15.

SAMP01

Line 000002 to 000007 prompt to enter a member name. Line 9 with EXECIO * reads all lines from CH15.OUTPUT member name where rpt. is an array – rpt.1 is line 1, rpt.2 is line 2, rpt.0 is the number of line. Line 10 – 12 is a do loop writing each line to the display using Rexx say command.

The do i=1 to rpt.0 is a loop to start at 1 and stop at the last record in the rpt. array. The do loop processing has only 1 action during within the loop – to ‘say‘ the selected record from the rpt. array which happens to be rpt.i where i is the next number.

SAMP02

Line 11 includes parse var rpt.i where w1 w2 w3 w# captures each string or word in the line separated by a space.

SAMP03

Line 11 includes if pos(‘IEE254I’,rpt.i). The if condition returns a positive number for the position in the line where IEE254I is found. When IEE254I is found, then say the entire line, rpt.i.

SAMP04

Line 11 – 16 includes select when conditions. Line 20 – 28 includes labels such as iplinfo with code begin terminated by the return statement. Each return returns the control back to the do loop. Each call branches to the label to execute code following the label.

SAMP05

A system data set member is being allocated at line 1. In line 2 all lines are read into array parm. In line 3 each line is written to the display using the say Rexx command.

SAMP06

This script prompts the user to enter a member name and says some information.

SAMP07

Again the user is required to enter a member name, to test we enter S00IPL stands for initial program load.

S00

This piece of code again prompts to enter a data set member name and then calls several functions that say information.

S00#15

This code does the same as S00 but with only one difference, instead of saying the information it prints it to P3.OUTPUT(#15). This is a very important piece of code. Yes, the red is more like orange; the default red is headache inducing.

TRIMCOL

This piece of Rexx code reads from member TMP from CH15.OUTPUT. In this case the logic ultimately removes 43 unnecessary columns from TMP. The behaviour of substring is as follows: it returns the input string its value from position 44 up to and including 77. So the first 43 characters of the input string are lost.

TRIMLINE

This again reads member TMP and removes SDSF primary menu and blanks from TMP. ‘removes SDSF primary menu’ means it just removes the first 60  lines from TMP where the comments and stuff would be. Then it copies all the lines after line 60 where the line j its length is longer than zero.

That’s it.

REALLY, IS THAT ALL YOU’VE GOT IBM?! I’m kidding, that’s a lot, that’s more than about 500 lines of code. Hmmm… wait… my typical JavaScript files are larger than 1k lines. I guess I can’t complain. However this is very new and isn’t as flexible.

Minimum requirements – Apply the golden rule of MVP

Use JCL to process system commands which writes the command output to 1 or more members in CH15.OUTPUT
  Example: CH15.JCL(S00JCL)

Write a Rexx routine to read the 1 or more members from CH15.OUTPUT, then write a report to P3.OUTPUT(#15)
  Example: CH15.SOURCE(S00#15)

Report written to P3.OUTPUT(#15) should include brief headings or statements helping to explain report details to reader
  Example: Your role is the experienced z/OS tech teaching a newbie (a judge) about the z/OS contest system
  Under consideration - we might have selected z/OS newbies to help judge final report and optional additional reports
  NOTE: "optional additional reports" - see Evaluation twisty below

Report written to P3.OUTPUT(#15) needs to include a single line that informs reader/judges the name of the Rexx routine used to create the P3.OUTPUT(#15) report -
  Example: Report created by Rexx routine - ????? - where ????? could be R00#15 in CH15.SOURCE

The golden rule I was talking about? Minimum viable product. Let’s first try to get an MVP and then expand if there’s enough time. I personally can’t reach the wall of fame or be an honorable mention as I’m not a student. That doesn’t mean I shouldn’t do my utter best, but that also means that it doesn’t really matter to which extent I develop this challenge’s solution.

Full code review

I’ve reviewed all code of challenge #15 on my GitHub a bit more in-depth than I’ve done here. I’ve also included all source files for you to view in your favorite IDE. I might update this post to the GitHub code but I’m running low on time folks.

What’s your favorite IDE?

Share this:

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 mtm2018.mybluemix.net 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: