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:

IBM MTM: Part Three – Challenge #03

Hi there!

I feel like I’m progressing really fast, that’s good! I’m also very motivated because I’m expecting to get my IBM Digital Badge soon! I want the Part 3 badge really bad so I’ll do my best to solve all of its challenges. However, I guess the blog posts will slow down as the challenges get harder.

I’m lacking in humor lately, I don’t know why that is. You guys know of any good comedy movies? I need some sources of inspiration.

Also quick note, you’re now able to unsubscribe via the e-mail you receive. All your data gets removed. Good!

Sort Utility Capabilities Continued

IBM Master the Mainframe Part Three – Challenge #03

Today we got data from another company and we need to validate the data because we can’t trust that the data records are valid from the get go. I need to make another report on the data validity of the account limit and balance fields. Let’s check the data set first.

Mr. Peabody told me the SORT utility can perform a validity check on packed decimal data fields. He also asked me to observe the Account Limit packed decimal field that starts in position 9 for a length of 5 and the Account Balance packed decimal field that starts in position 14 for a length of 5.

I’m told I should use the more advanced features of SORT and ICETOOL with logical expressions. Let’s not go too deep into the theorem right now, I’ll check out the challenge assignment first.

First let’s edit Z30163.JCL and make a new member called sort003. Then copy ‘zos.public.toolbag(sort003)’ into Z30163.JCL(sort003). Same way we did last time, using the COPY primary command.

This is what I have now. Now modify the JCL job reference to ZOS.PUBLIC.BBRI.CLIENTS. Next up is to modify the ICETOOL control statement replacing both P,M,F. One for each packed decimal field with the appropriate starting position P, length M and data format F for Account Limit and Account balance.

We need to get our P,M,F from the table above. They said for each packed decimal position, we have those don’t we? Let’s just take a look at the formats and adjust the ON(P,M,F) fields.

Let’s submit and review our output, it should throw Max-RC with CC 00012.


Yup! Got the MAXCC=0012! Now let’s the system for all the information available of JOB06280 and check OUTDD. “If the Account Limit or Account Balance fields have a string of asterisks, then a bad packed decimal field was detected.”

You see those two rows of asterisks? Holy cow, asterisks is a difficult word to spell. All is ok! Now let’s check TOOLMSG and check the report. It should report invalid HEX VALUE.

Yup it reports two invalid HEX VALUES. Mr. Peabody explains knowing the specific invalid hex values found in Account Limit and Account Balance field is needed because while the business analyst or auditor did not request the specific hex values, once you find invalid hex values, they may ask you for the specific hex value to help determine the correct amount.

Let’s create the rapport for the analysts. Again, I’ll create a new JCL member called sort004COPY ‘zos.public.toolbag(sort004)’ into it and modify the JCL its client master file input.

Those are a lot of parameters! WOW! Again, I’ll change the SETVAR and modify the control statements P,M,F for each packed decimal field.

  • GOOD records uses EQ comparison operator and the AND operation for checking both Account Limit and Balance
  • BAD records uses NE comparison operator and OR operation for checking both Account Limit and Balance

So what do we actually have to change here? I guess just the PMF for both packed decimals. Actually when you look at the statements it’s pretty easy! ‘INCLUDE=(P,M,F,EQ,NUM,AND,P,M,F,EQ,NUM)’ Include everything from starting position P for a length of M that has the format F and it should EQUAL type NUM AND same thing for everything from starting position P for a length of M that has the format F and it should EQUAL type NUM.

I guess it’s just copy paste the same P,M,F from last JCL. I though we needed the position of that specific record? It doesn’t feel right to just write the same PMF as last time. I’d really like to understand what I’m doing.



There’s no BAD output I can xdc to Z30163.P3.OUTPUT(#03). Or do I literally have to check P3.OUTPUT and see if it’s there? Let’s have a look!

Yup it’s here! As I said earlier, I don’t really fully understand what I’m doing. I don’t think I can write my own ICETOOL script just yet. I might do this challenge again.

Mr. Peabody told me that another challenge is anticipated where the SORT utility and companion ICETOOL utility is the best way to complete the assignment. Next challenge is about COBOL though! Finally!

I probably won’t write my own COBOL just yet, but I’ll atleast get to smell it. Challenge #04 looks pretty easy, yay 🙂


COBOL looks really cool! I’m genuinly interested in the language. I might buy Murach’s Mainframe COBOL whenever I setup my own mainframe emulator using Hercules-390 and some open-source operating system like the MVS 3.8J Operating System.

Also… I wrote this blog after a long day at work, let the hunt for spelling mistakes begin!

On a different note, what are you genuinly interested in?

Share this:

IBM MTM: Part Three – Challenge #01-02

We’re at #01 again. It feels like I just started all over again. Anyways, these challenges will be a lot more challenging. Less handholding and a lot more work! As promised to Paul Newton from IBM I won’t be posting the solutions to these challenges. I’ll just write about my experiences running through these challenges.

I know, this possibly makes it a lot less interesting to read for you guys but I’m sure some posts will be of great help when you’re doing the challenges yourself.

I’ve also changed the way you can comment, now you don’t need to enter a name or mail address.

Getting Started

IBM Master the Mainframe Part Three – Challenge #01

Well I think it can’t hurt showing the solution to challenge #01 as there’s really not much to do.

Run tso part3. Then edit Z30163.P3.OUTPUT(#01).

This was the output, now I need to copy the lines from P2.OUTPUT(#01). That can be done using the COPY primary command. For some reason typing copy p2.output(#01) after a didn’t work, even when I wrote a on line 000001. I’m not sure what I’m doing wrong. I just used the copy tool using its ‘wizard’. I think the quick command for the copy utility is =3.3.
Deleting the line is easy, I wrote about this before. You can use the dd line command. This leaves me with only Belgium present inside the list.
This is it for the first part!

SORT Utility Capabilities

IBM Master the Mainframe Part Three – Challenge #02

This time I’m responsible for validating another company their client master file. I’m doing this with the help of Mister Peabody, a senior technician.

My company AA Global Investments periodically acquires smaller regional investment companies. This time we’re negotiating acquisition of BB Regional Investments. The acquisition includes about 45 million clients. We need to validate BBRI client records.

Let’s first study the Master File Client Record Layout.

The Unique Account Number can be used to identify duplicate records. But please note that a client may have multiple account numbers and duplicate account numbers may happen. Duplicate account numbers are not done, so we’ll need to handle that.

I’ll edit Z30163.jcl and make a new member called sort001. Primary command s sort001 does the trick, I had to use this in Part 2 once.

Now we need to copy ‘zos.public.toolbag(sort001)’ into z30163.jcl(sort001).

This got me the following JCL.

A simple modification needs to be made. The SET operation needs to reference ZOS.PUBLIC.BBRI.CLIENTS as the SORTIN data set name. JOB08137 completed! If message ICE055I is in SYSOUT then any records with duplicate unique account numbers were found and deleted. Let’s check.

Yup! A total of 4 records were deleted. I told Mr. Peabody that I’ve deleted 4 duplicate records. However he now wants a special report about the duplicate records.

The analysts want a list of client records containing duplicate unique client account numbers and a list of client records without the duplicate account numbers. Mr. Peabody told me about a tool called ICETOOL, let’s see how it can help me.

I’ll go ahead and make a new JCL member called sort002 and copy ZOS.PUBLIC.TOOLBAG(sort002) into it.

Got it! Again, change the SETVAR to ZOS.PUBLIC.BBRI.CLIENTS. Now I need to modify ICETOOL its select control statement directives. At line 9 it says ON(P,M,F) where P,M,F stand for starting position (P), length (M), and field format (F).

First I need to get the unique account number values for P,M and F from the JCL job SORT001. Luckily I have a screenshot not far above. However, splitscreen using F2 is nice to know though!

JOB08379 submitted! The report was written to Z30163.P3.OUTPUT(#02). Let’s check and then give it to Mr. Peabody.

Output looks good! What! Mr. Peabody said that this isn’t exactly what the business analysts requested? I need to adjust the ICETOOL select control statement directive to the correct report. I’ve been told to change LASTDUP. Time to read some documentation and hope everything is ok.

If found the directive needed to write all the duplicate records into the duplicate report. JOB08420 submitted!

Looks like I found all duplicates! Why did I only find four last time? Huh… wait a minute! Let’s check P3.OUTPUT(#02).

Seems more like it! It guess that’s it for today huh?

Bad news

I’ve completed part 2, but it appears that I don’t deserve a place on the wall of fame because I’m officially not a student. I don’t really see the point of not including other enthousiasts on this list, but hey who am I?

However, I just received this in my inbox:

I was afraid that I wasn’t eligible for the badges as I’m just participating in the learning course, not in the contest. But this e-mail gives me good hope!


Hi anonymous readers! I see a lot of traffic but probably nobody likes to comment. I understand! I’ve added this applause button next to the post title, click it! It’ll make someone smile! Also, you can comment anonymously now!

What made you smile lately?

Share this: