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.
- Run my JCL and take notes of all interesting information and identifiers that point me to that information.
- Create a Rexx routine that says all of that information and debug until I get the output I want.
- 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.
WHEN w1 = 'JOBS' & w2 = 'M/S' THEN
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
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.
Fe = ''
do i=1 to rpt.0
parse var rpt.i w1 w2 w3 w4 w5 w6 w7
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','
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?