IBM MTM 2019: Part Three – Challenge #15

Hello Hello Hello

Today I’m doing the very last challenge of the IBM Master the Mainframe 2019 contest. It has been a long 4 months and we’ve finally reached the finish line.Now let’s take some time to finish this exercise.

Originally I wrote “exercise” wrong, but then I Googled it and corrected it. JUST. FOR. YOU. Isn’t that lovely? (heart emoji thing) Also, the WordPress spelling corrector underlined that word red and it triggered me very hard. You see, UX helps!

So, just to be able to finish before the 31st of December I’ll do a minimum viable product approach. That means I’ll do the absolute minimum to pass (i hope).

Also my apologies to everyone. I have 20 to 30 comments waiting for help and a ton of e-mails still waiting for a reply. I can’t keep up with the demand! Work, holidays, family and partying is taking up most of my time. Goodluck to everyone!

Learning and using z/OS creatively

IBM Master the Mainframe Part Three – Challenge #15

Start the Final Challenge

Let’s start by getting the required data sets. We can do this by issuing tso submit ‘zos.public.jcl(p3ch15)’ from the ISPF Primary Option Menu.

The first time you do this it will allocate new data sets. The second time you do this it will delete and reset some data sets. BE WARNED!

It made the following data sets:

  • ch15.clist
  • ch15.output

It also wrote a timestamp into p3.output(#15) and created REXXJCL member in our JCL data set.

System Activity Utility

From the ISPF Command Shell Panel (=6) I’ll issue the command ex ch15(get) to execute our challenge 15 code.

I’ll enter to select ‘Report specific message identifier found in SYSLOG’.

If prompted for a message id enter ich408i.

This is the result.

Solving this challenge

Don’t take my word for it. Don’t automatically assume I’m right. I don’t exactly have an answer sheet 😉

But what needs to be done?

  • The challenge is for you to enhance a system utility which generates point-in-time system activity reports.
  • At least 1 report you write must demonstrate ability to parse SYSLOG records.
  • Information requested has options 1-6 constructed, option 7 is blank.

So does this mean that I need to make option 7? And make it output whatever I want/can? There needs to be at least 1 report that parses SYSLOG records.

Is this the absolute minimum? I assume so. Great!

Step 1: REXXJCL

I just noticed the ID needs to be filled in in our Z#####.JCL(REXXJCL). I’ll do that first. GETSTRG does not exist in my CH15.CLIST data set. Do I need to create that member? Do I even need to do this? (I didn’t)

Warning: don’t do this just because I do!

Step 2: Explore CH15.CLIST

For the most part I’ll let you figure this out yourself. I’ll only write about the most interesting parts.

These are the challenge files we’re working with.

When we do ex ch15(get) we actually execute this rexx code.

So… IBM has left us with a few options and ideas. We can just code the ones they suggest or we can invent a new option at option 7.

For the MVP principle, I’ll delete 3 options and only do one, the fourth one. As I’m part of the learner program I have about 9 months more to expand. My apologies to the people that thought I would make something impressive! 

I just want to provide an example during the last days the students have available.

Step 3: The Plan

The easiest one in my opinion is getting the TSO logons, unsuccessfull or successfull. ICH70001I is the code that gets logged when a user has logged on. Shortly after that code, the username is displayed along with some timestamps.

I just need to grab those entries and print them to the screen. I can basically use the code of report 1, remove the input prompts, sanitize the data and then it should be ok!

Let me test my theory.

My theory is correct! I’ll delete the other options and make it clear to IBM which option they need to pick.

I have removed the excess options and added the exec ch15(custom) command. Now I’ll go ahead and code my custom option. My custom option will also use the custom file in the clist data set.

Step 4: Coding

Unfortunately, I’m not allowed to share my code. But you should be fine on your own! I have used code bits from https://www.tutorialspoint.com/rexx/rexx_parsing.htm and https://www.rosettacode.org/wiki/Remove_duplicate_elements#REXX to write the solution.

My result

This is the menu that is now generated.

Then after that we get the following output:

So this is an unique list of all the users that have logged on. I’m happy with my MVP approach. I believe these are the logons from today? I’m not 100% sure.

Have I missed something? What have you come up with?

I feel like I have though. Although, I have at least 1 report that demonstrates ability to parse SYSLOG records and I have enhanced a system utility. Is this enough?

46 thoughts on “IBM MTM 2019: Part Three – Challenge #15

  1. Hello Kev,
    nice solution you had for finding the user logons. I solved that by using the JES message $HASP373 which is produced every time a JES process starts. The ICH700001 seemed a bit strange to me, since it did not always appear in the syslog when users logged in. I sorted out the TSO job names by querying only for jobs where the jobname equals a username. Do you know when they plan to publish the results?
    Fyi this was my REXX query…
    if substr(MessageArea,1,10+msglen)=”$HASP373 “||username||” ” then

    1. Hi FKFHWS

      Thanks!

      I have to admit, I did very little research for this solution as I wanted to have at least some kind of blog out before the student contest ends. I might expand later after a break.

      I believe they publish the results at the end of January or early February.

      Kind regards
      – Kevin

  2. Hi Kevin,
    You ended this campaign successfully!
    Congratulations again!
    Nice solution you made in ch15. Mine is with the 7 reports with as, da, ssi, etc. The first was tricky the rest follows …. 🙂
    Happy New Year 2020!!!
    We will keep in contact
    Georges

    1. Hi Georges!

      You wrote all the extra reports? That’s impressive! I might add more when I find the time 🙂 We have until the 9th of september 2020 afterall 🙂

      Happy new year!
      – Kevin

  3. Hi Kevin! I heard about MTM just last week and your blogs have been incredibly helpful in navigating through the challenges (since time was ticking and I had no time being stuck haha). I wouldn’t have even bothered to attempt Part 3 if it weren’t for all of these and now I’m glad I did do them because I feel like I’ve learned so much! I know these blogs must have taken forever to write but I just hope you know how much I appreciated them!

  4. Kevin,
    I saw that CMD is for issuing MVS Commands using “/” in SDSF Panel. But how can I write the result in a PDS member? Can you provide link to useful resources? I have very limited time rn.
    Thanks

    1. Hi Some2

      I also have very limited time 😉

      I would advise you to look into the other members and see if you can use some code. I don’t know in which language you’re also trying to do this.

      You could take a peak at https://github.com/KevinJDurant/master_the_mainframe_2018_final_challenge#samp4rexx and see how this Rexx says things and then writes it to ch15.output(“mbr”). This is code from last year.

      Unfortunately due to it being a very busy period right now I won’t be able to help you out much more.

      Kind regards,
      – Kevin

  5. After contest deadline some more detailed explanation would be great about this challange. It would be a big help for next year’s challenges.

    1. Hi Akos

      Yes indeed. This year’s blog post seriously lack explanations. I’ll probably do a new series of blogs apart from master the mainframe. Kind of like a programming cookbook but for mainframes.

      Kind regards,
      – Kevin

    1. Hi Mig

      “MEMBER x NOT IN DATASET” typically means that the member in the target data set doesn’t exist. CUSTOM is my own file that I have manually created inside CLIST. Did you make it?

      Kind regards,
      – Kevin

  6. Hey Kevin! Thanks so much for helping us out with this contest even though you are busy. What are your plans for the blog afterwards?
    Kind regards,
    Alex

    1. Hi Alex

      Thanks for the kind words! I’m planning on making a Mainframe Cookbook series next. Seperate blogposts about how to do something inside the mainframe, from simple things like “How to enter new lines inside SDSF editor” to “How to write data to a data set using REXX”.

      Kind regards,
      – Kevin

  7. Hi kevin!
    Hope you are well
    I am currently trying to create a dataset member that reports the Link list of active data sets using the “LNK” member that was provided by IBM. Executing IBM’s LNK member will print out all 79 rows in the LNK panel. How can i go about printing only one row of data when i input the DSNAME of the dataset in the active link list?

    1. Hi Dash

      I’m doing well, very busy though 😉 It is hard for me to help you without seeing all your code. But I can help you work out the concept.

      Essentially you loop over the data and “stream” print it to a data set. You should just break the loop after the entry you want.

      I hope this makes sense.

      Kind regards,
      – Kevin

    1. when you put “logon Z#####” from your tso, then after putting password “Check your top left corner of the screen” You will see “ICH70001I” that means it is the code that represents the tso logon, that is needed to perform.

    1. Hi Nilay

      Do you mean to ask how I only fetched the username? I just took the whole line and then took a substring of it using a defined length. Take the characters from position 1 to 7. That gave me the username.

      Kind regards,
      – Kevin

  8. Hi Kevin,

    Been following your blog since I started the Mainframe Contest. Really helpfull!
    As I’m not sure, I’d rather ask… Isn’t it necessary to report all 6 bullets given and the 7nd is for extra creativity?

    Or is there a reason you only chose one?

    1. Hi Joke Wouters

      Thanks for the kind words! I’m not sure either! But I personally believe we don’t have to code those other examples.

      Nowhere at http://mtm2019.mybluemix.net/part_three/part_three_ch15.html have they stated how many reports they want. At least one has to read the log.

      They also say: “You are not required to use the REXX code template.” Which implies you can completely ignore the provided resources. Therefor you can ignore the list.

      I think the suggestions in their list are meant to help people figure out what they could make. We didn’t have this in the 2018 edition and lots of people didn’t know what IBM expected. So I think they provided this list to avoid confusion and set a general guideline.

      I only did so little because it is what I could make in the little available time I have. It is not a very good solution, I would advise anyone to make something more complicated. But I believe something like this is enough to pass according to the requirements.

      I hope this makes sense.
      – Kevin

  9. Hey Kevin,

    Thanks for uploading ch15. I have two questions, when I enter ICH70001I, I noticed I didn’t see my own username(Z#####) in the output or in the Z#####.CH15.OUTPUT(MSGID). I was wondering when I make a new report, do I have to do anything special, if so can you point me to the right direction? Also does ICH70001I, when I enter 1 for “1. Report specific message identifier found in SYSLOG ” does it collect ALL the username for a certain time frame?

    1. Hi Alex

      That’s odd! I saw my own username in the LOG output (Z50087). Are you sure you didn’t miss it? I believe it collects entries from the current day. I have seen some code in comments where they wrote how to get it from different dates.

      Regarding the new report, you should be able to reuse the existing code that writes lines to a report file and just give it different parameters.

      It might help to review all the code the same way I did last year. See https://github.com/KevinJDurant/master_the_mainframe_2018_final_challenge. I just don’t have the time to do it at the moment.

      Kind regards,
      -Kevin

  10. hey durant need your help i wrote the code for a particular report and i have tried everything about execio but it does not write my report to ch15.output

    1. Hi Anonymous

      I personally just display the report to the screen. I did not have it write to a data set member. I’m also not allowed to help with coding the last challenge.

      I hope you find your mistake! Goodluck!

      Kind regards,
      – Kevin

      1. thanks man is just i have studied the first output and did accordingly but i havent been able to accomplish i dont really know what to do

        1. Sorry durant can you check whether your report wrote to ch15.output because from your screenshots it said File Msgout Not Freed Dataset is Open

  11. And also,
    What does “Display Command Execution” mean?
    I couldn’t find a dedicated panel to check DCE in SDSF.
    Can you help?

        1. Hi Ahmed Nasie

          It does not matter which commands, you can choose which ones you display. Scroll through the Log and see which ones you can easily find. ich408i command result when authentication has gone wrong. ICH70001I is result message when a user logged in.

          Look around and research some codes and pick the ones you can work with.

          Kind regards,
          – Kevin

          1. Kevin,
            I saw that CMD is for issuing MVS Commands using “/” in SDSF Panel. But how can I write the result in a PDS member? Can you provide link to useful resources? I have very limited time rn.
            Thanks

  12. hey Kevin,
    can you tell me how to search for two strings at the same time in syslog? I’ve tried many things but couldn’t come up with a solution
    Thanks in Advance

  13. Hi,
    Can you pleasse explain the last step where you have mentioned that “custom option will use Custom file in clist data set” because there is no file named Custom. Do we have to create a file in clist dataset?

Leave a Reply

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