IBM MTM: Part Three – Challenge #09

In this challenge I’ll be working with a COBOL program to connect and communicate with a DB2 relational database table. Again, it’s not needed to know COBOL but I bet it would help.

I’ve read that COBOL is a relatively easy language to learn and I will take a shot at it together with Java after this mainframe series. I’ve tried some courses on Udemy but, with all due respect, they are horrible. I think I refunded 4 courses in total.

However, PluralSight has a very nice course brought by Tim Slate. I’ll definitely write a blog about that course! My backup is a course at GoGoTraining but that’s a bit too expensive right now. Of course, I won’t forget about Murach’s books 😉

View COBOL compile failure related to a misspelled internal file name

IBM Master the Mainframe – Part Three – Challenge #09

Let’s get right into it! We must navigate to Z30163.SOURCE and create a new empty member using the s db2cbl primary command. Then we’ll copy ‘zos.mtm2018.public.source(db2cbl)’ into it and execute it. Easy!

That’s done!  MAXRC code was 12 so that means the compilation fails. Now where does it go wrong and how do I find the error? Well, let me tell you. Enterprise COBOL messages begin with IGY, so we can issue the find command f igy.

The first message beginning with IGYPS2122-S is a severe error indicating the real problem. The first error starts the chain reaction of errors. We know it’s a severe error as the error code ends with –S. The other errors end with a W which means they are just mere warnings. So let’s first fix the first. Uh… haha.

Study the message the text identifies and correct the code. They also gave a big hint, only 1 character is involved that creates the problem. Let’s open the code and search for every word beginning with REC and see what we find. Then fix.

I found the mistake, I’m not saying the mistake is on the screenshot. “IBM: Remember the big hint – removal of a single character in the COBOL will fix the problem”. Submit the code and hope you get return code 4. JOB07842 submitted! My ouput is good, now let’s copy my output to P3.OUTPUT(#09). Let’s verify!

Ouch! It’s empty! See, it’s always nice to double check! The JCL executes the COBOL code so it would read from my DB2 relational database table. But I guess it has the name wrong?

Let’s edit the DB2CBL code inside SOURCE. Look what the table name is called inside the code and make it read from my table name. Starting from line 000066 we see that it reads ACCTNO, LIMIT, BALANCE, SURNAME, … seems familiar? The change command should do the trick.

I’ll compile, then run the tso submit command. Your output should be in P3.OUTPUT(#09).

My output is what it should be! Yay! Another victory for team basement coders!

My disk space

You know, I was the kind of guy that bought an 85 cents hosting package and expects it to be enought to host a blog with already over a hundred images.

What’s your disk space status?

Share this:

IBM MTM: Part Three – Challenge #05

I just noticed that I’ve released the blog about challenge #04 at 12pm instead of 10am. Honest mistake! I have to admit, I kind of rushed that blog. Sorry about the lack of quality lately. I’ve been very busy IRL.

I’ve picked up some games again after a year long break of serious gaming. Besides that I run a Dungeons and Dragons the Curse of Strahd party as DM every two weeks. So now you know what I do besides programming 8 hours at my job, writing blogs, Master the Mainframe and going out with friends. I have to admit, I really enjoy the 15 minutes of true free time I have per day.

The badge

I’m sure you’ve noticed the featured image 🙂 I got it! The badge! IBM contacted me and informed that I’m able to accept my IBM Master the Mainframe badge at Acclaim! I’m so happy! I’m not sure if it means much for any employer but it sure is something I’ll brag with at my local nerd cafe!

Not the best picture, but hey!

Visit my Acclaim profile!

Application Development Support

IBM Master the Mainframe Part Three – Challenge #05

A developer at mycompany contacted me and said something is wrong with the BBRI client data. The developer wrote a program to read the BBRI client data. The result was a program execution abnormal end S0C7. Abend S0C7 is a well known failure related to invalid data in a numeric field.

I will recreate the problem, use SORT to remove the invalid packed decimal fields and write the output to a temporary data set. This looks like an easy assignment.

To recreate the problem I’ll create a new member called cbl0002 inside Z30163.source and copy ‘zos.mtm2018.public.source(cbl0002)’ into cbl0002. Then All that’s left is to edit Z30163.JCL(cbl0002) and run it.

Now let’s head to Z30163.JCL(CBL0002J)!

Let’s submit!


The system detected a data exception (System Completion Code=0C7).     
From compile unit CBL0002 at entry point CBL0002 at compile unit offset +000003DC at entry offset +000003DC
at address 1AC003DC.

Not good! I’ll need to use SORT to remove the invalid packed decimal fields and write the output to a temporary data set. Then pass that sorted data to the application developed by my fellow colleague.

Let’s edit Z30163.JCL(cbl0002j) and first of all delete lines 2 up to and including 8. This way we won’t recompile the program again. Deletion happens via the DD line command. Then we need to copy sort004 into cbl0002 after ‘a’. A is a label, if you don’t now then you’ll need to read more about labels here to know how to define a label.

After copying the file I need to do the following:

  1. Delete line beginning with //SORT004 JOB
  2. Delete line beginning with //BAD
  3. Delete line beginning with OUTFILE FNAMES=BAD
  4. Change //GOOD DD SYSOUT=*
  5. Change //PRTLINE DD SYSOUT=*,OUTLIM=15000

This is what I’ve got.

I’ve left out some lines on the screenshot above, I don’t want to post the exact solution. I promised Mr. Paul Newton from IBM!


Oops I guess I did something wrong! Let me check!


Hmm… Oh! I didn’t read step 3, it said ‘delete the last 3 lines’. Oopsie! JOB CBL0002J(JOB06657) SUBMITTED!

That’s the output! The challenge is complete! Ofcourse, if I was at my real job I wouldn’t just post a screenshot of acountbalances and account identifiers 😇

Wait this wasn’t about ICETOOL at all?

In my last challenge I said that the next challenge would be about ICETOOL and not COBOL… What? I’m not sure where I got that from. Next challenge is about VSAM KSDS, I double checked this time!

This challenge was REALLY easy and I believe I understood everything I did. The first thing I’ll do after this blog is read the COBOL source code from last two blogs and try to understand what’s going on.

We’ve completed one-third of #MTM part 3! I just checked some other challenges and it seems that challenge #06 will be the last small/short challenge from this series. L

Also, I have to thank all my e-mail subscribers for not unsubscribing as soon as the feature was available! Thanks for your loyalty! I’m also surprised about the amount of traffic the site gets whenever I publish a new blogpost! This is great!

What’s been great for you lately? Let me know! If not in the comments below, you can always mail at!

Share this:

IBM MTM: Part Three – Challenge #04

This is the moment! This is THE challenge! My first encounter with COBOL! YAY! I’ll leave out the intro this time boys ‘n girls. I want to start, now!

Application Development Using COBOL

IBM Master the Mainframe Part Three – Challenge #04

Common Business-Oriented Language, that’s what COBOL stands for. COBOL manages some of the most critical data and business logic in the world’s economy. Many reasons exist for why COBOL is a computer language with incredible longevity. COBOL that runs in the z/OS Environment is called Enterprise COBOL.

In this challenge I will read COBOL source code and compile it into an executable module. This particular COBOL program reads the BBRI client data set name used in the previous challenge and prints several of the fields from each record.

I need to solve the compilation error to complete the challenge. A good COBOL tutorial can be found at tutorialspoint.

I need to edit Z30163.source, create a new member cbl0001 and copy ‘zos.mtm2018.public.source(cbl0001)’ into it. Done! Let’s see…

The code is split in 4 divisions.

  • Identification
  • Environment
  • Data
  • Procedure

Lines with asterisks are treated as comment lines. Now jump back to Z30163.JCL and select member cbl0001j.

  • IGYWCL is a system JCL procedure used to Compile COBOL source code
  • //COBOL.SYSIN references the COBOL source code input that was reviewed
  • //LKED.SYSLMOD references the executable program created from the compile
  • //STEP2 EXEC PGM=CBL0001 is program execution step

Now let’s submit the JCL job! JOB CBL0001J(JOB03331) SUBMITTED!

IGYPS2072-S is a severe COBOL syntax error. The text explains what needs to be fixed. Let’s edit Z30163.source(cbl0001). It was a very simple fix. Let’s run! tso submit jcl(cbl0001j) ; =sd ; st


If the compile was successful then the output should show that the program execution failed.

IGZ0035S There was an unsuccessful OPEN or CLOSE of file ACCTREC in program CBL0001 at relative location X'1A2'.
Neither FILE STATUS nor an ERROR declarative were specified. The status code was 35.
From compile unit CBL0001 at entry point CBL0001 at compile unit offset +000001A2 at entry offset +000001A2
at address 1AC001A2.

It failed! Ya… y? Now I need to identify and fix JCL that caused the COBOL program execution to fail. Neither FILE STATUS nor an ERROR declarative were specified. Interesting! But where in the JCL do I need to declare it? I’m not really sure where I should look. Oh wait… HINT: look for ACCTREC inside the JCL 😉


Looks okay! Now I just need to XDC the output to P3.OUTPUT(#04) and I’m done!

Almost there!

I almost completed 5 Part Three challenges! That’s a small milestone! Next challenge isn’t about COBOL, but about ICETOOL. But hey! COBOL will happen later!

Are you looking forward to something?

Share this: