IBM MTM: Part Three – Challenge #15: MVP

Let’s finish the 2018 master the mainframe contest with a minimum viable product approach first. That’s what I’m going for boys and girls. Women and men. Children and babies. Dogs and cats. Insurance agents and real estate agents.

So, why MVP Kevin? Are you lazy?! No I’m not, I just don’t have much free time :'( And believe me, solving these challenges and writing a super duper blog takes time. Also this marks my 30st blogpost. Hoorah!

Is 30 a milestone? Hmm…

Step 1: the JCL

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

So first of all we need to write some information to one or more members in CH15.OUTPUT. This is easy, just a copy paste of CH15.JCL(S00JCL) with some minor alterations. These alterations are supposed to give our student some information about the IBM Z mainframe. I’ve reviewed S00JCL at my GitHub page.

This review can also be read together with my other reviews here. In this case IBM chose to display IPL information and to display several system configuration details. I’ll look for some interesting display commands, what would a student like to know about this mainframe? THE LIST IS SO LONG!

Maybe I’ll inform my student about how many services the current mainframe is offering. Then show how many users are connected and display their names ? Good gracious, I’m not creative at all. Think Kevin, think! Maybe display some system specs?

Before my students start dating my mainframe, they first need to get to know eachother.

Step 2: the Rexx

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

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

This is the difficult part of the challenge. We need to use the output that our JCL generated, create a report from it, add a script identifier to that report and write it to P3.OUTPUT(#15). To code this Rexx I’ll need to know what my output looks like by heart. I’ll need to master the output. See what I did there? Heheh.

So… CH15.SOURCE(S00#15) is what we’re going to be using as a guideline. S00#15 is a compilation of all SAMPX Rexx scripts. I need to understand all other SAMPX Rexx scripts or I won’t be able to throw a script together. But first, let me create a plan of action.

  1. Run my JCL and take notes of all interesting information and identifiers that point me to that information.
  2. Create a Rexx routine that says all of that information and debug until I get the output I want.
  3. Implement the saving into P3.OUTPUT(#15).

The first thing I did way say everything so I had a way of debugging what I wanted to do. My goal is to just say some system details, say what was going at initial program load time and say who was running a job.

This is what I’ve got. It doesn’t look like much but it’s actually more code than S00#15.rexx. I’m not sure if this is enough to finish part 3. This doesn’t meet their minimum requirements yet.

1
2
3
4
5
6
7
8
9
10
11
SELECT
    WHEN w1 = 'JOBS' & w2 = 'M/S' THEN
    DO
        Details_position = i + 1
        parse var rpt.Details_position w1 w2 w3 w4 w5 w6 w7
        Max_users = STRIP(SUBSTR(w6,POS('/',w6)+1),'L',0)
        say 'Amount of jobs processed at that time:' STRIP(w1,,0)
        say 'Amount of users online at that time:' STRIP(w3,,0)
        say 'Amount of maximum users allowed on this machine:' Max_users
    END
    OTHERWISE ITERATE

Instead of saying the lines I need to print them to Z30163.CH15.OUTPUT(#15). What IBM does in S00#15 is first open the output and when all code is ran calls write_output. They write their variable called o to the file they need. So from what I understand is that I need to open my output file, replace all say to o.index and write it to the file. Not as easy as it sounds I’m afraid? Let’s first take a backup and get on with it.

By the way did I tell you?

Press the ATTN (escape) or PA1 key to terminate script execution.

1
2
3
4
5
6
7
8
9
10
Fe = ''
    do i=1 to rpt.0
        parse var rpt.i w1 w2 w3 w4 w5 w6 w7
        select
        when w2 = 'IBM' & w3 = 'CORP' & POS(".",w6) = 0 then Fe = Fe w5 w6','
        when w2 = 'IBM' & w3 = 'CORP' & POS(".",w6) > 0 then Fe = Fe w5','
        otherwise iterate
    end
end
o.10 = STRIP(Fe)

So this is a good example of where I changed my says to assigning the value to the index at o. After changing all my say code I can finally copy past the open_output and write_output function and call them at the right time. Let’s see if everything prints out ok.

Looks okay! Some of my strings are longer than 80 characters. I might need to fix that, but this is the minimum viable product. I wrote a Rexx routine that reads data from CH15.OUTPUT that was generated by a custom CH15.JCL and eventually generates a small motivational report to P3.OUTPUT(#15).

I really liked doing this, it’s sad this Mainframe blog will come to an end soon.  But hey, let us at least hope I’ve scored some points 🙂

Have you scored lately?

Share this:

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: