Application Development Using COBOL
Part Three - Challenge #04

Background:

COBOL manages some of the most critical data and business logic in the world's economy.

COBOL programming language, COBOL compiler optimization, and COBOL runtime performance have over 50 years of technology advancements that contribute to the foundation of world's economy. The core business logic of many large enterprises has decades of business improvement and tuning embedded in COBOL programs.

The point is - whatever you read or hear about COBOL, be very skeptical. If you have the opportunity to work directly with someone involved in writing or maintaining critical business logic using COBOL, you will learn about the operation of the core business. Business managers, business analysts, and decision makers come and go. The sum of all good business decisions can frequently be found in the decades of changes implemented in COBOL programs. The answer to "How does this business actually work?" can be found in COBOL programs.

Add the following to your awareness of COBOL. It is an absolute myth that you must be at least 50 years old to be good with COBOL. COBOL is incredibly easy to learn and understand. One of the many reasons financial institutions like COBOL, is the fact that it is not necessary to be a programmer to read and understand the logic. This is important because critical business logic code is subject to audit. Auditors are not programmers. However, auditors are responsible for insuring the business financial statements are presented fairly. It is COBOL processing that frequently result in the business ledger updates and subsequent financial statements.

Now for a real world lesson. A comment recently made in a well known business journal by someone with a suspect agenda was quoted as saying, "COBOL is a computing language used in business and finance. It was first designed in 1959 and is pretty old and slow." A highly experienced business technology person knows the only true part of that last sentence was that COBOL was first designed in 1959.

It's no secret that lots of banks still run millions of lines of COBOL on mainframes. They probably want to replace that at some point. So why haven't they? Most banks have been around long enough to still feel the pain from the ~1960's Software Crisis. After spending enormous amounts of money, and time, on developing their computer systems, they finally ended up with a fully functional, well-tested, stable COBOL core system.

Speaking with people that have actually worked on such systems, nowadays they have Java front ends and wrappers which add functionality or more modern interfaces, they run the application on virtualized replicated servers, but in the end, everything runs through that single core logic. And that core logic is rarely touched or changed, unless absolutely necessary.

From a software engineering perspective, that even makes sense. Rewrites are always more expensive than planned, and always take longer than planned (ok, probably not always. But often.). Never change a running system etc.., unless very good technical and business reasons exist.

That is real world!

While Part 2 exposed you to COBOL, this challenge will reenforce awareness of COBOL that could prove valuable during your career.

COBOL that runs in the z/OS Environment is called Enterprise COBOL.

The challenge involves 3 COBOL programs with COBOL syntax constructs used by experienced COBOL programmers. Remember the Flour, Sugar, Oil Company? Each of the 3 COBOL programs read 565 Flour, Sugar, Oil Company client profile records. The program objective is to read a different input source that has only the unique customer number and locate the matching detail record from the 565 client profile records.

The 1st COBOL program reads a single customer number, then begins reading the 565 client profile records until finding a match on the customer number. The 2nd COBOL program reads the 565 client profile records and writes all 565 records into an in memory table where each record can be repeatedly searched. The 3rd COBOL program is designed for online interaction to accept a customer's number and return customer details.

The challenge will be to fix a COBOL construct syntax problem in each program and display requested information from the client profile record.

Challenge:

Enter the following to copy the 3 COBOL programs to hlq.SOURCE:
tso submit 'zos.public.jcl(p3ch4)'

Take a few minutes and quickly browse these excellent URLs to help with this challenge

1st COBOL program, FSOC050

Edit hlq.SOURCE member name FSOC050 and observe the following:

  • COBOL program is input to JCL stream that compiles and executes program
  • FILE CONTROL and FILE SECTION describes the program input
  • WORKING-STORAGE describes program variables
  • PROCEDURE DIVISION is the execution logic
  • ACCEPT is a COBOL read statement
  • DISPLAY is a COBOL write statement
  • PERFORM is the COBOL construct for statement sequencing and optionally loop logic
  • READ is the COBOL statement for reading records described by FILE CONTROL and FILE SECTION
  • IF is one of numerous COBOL selection statements
While in edit on hlq.SOURCE(FSOC050), enter the following:
sub; =sd; st

  1. View FSOC050 output
  2. Identify compile problem
  3. Edit hlq.SOURCE(FSOC050)
  4. Correct COBOL syntax problem
  5. Submit
  6. Validate COBOL syntax problem is resolved

2nd COBOL program, FSOC051

Edit hlq.SOURCE member name FSOC051 and observe the following:

  • Review COBOL syntax structure under comment 'CREATE TABLE AND LOAD IN MEMORY'
  • Review COBOL syntax structure under comment 'SEARCH TABLE FOR SPECIFIC CLIENT NUMBER'
      Observe the SET and SEARCH COBOL statements
      Observe ENTRIES variable described in WORKING-STORAGE SECTION
While in edit on hlq.SOURCE(FSOC051), enter the following:
sub; =sd; st

  1. View FSOC051 output
  2. Identify compile problem
  3. Edit hlq.SOURCE(FSOC051)
  4. Correct COBOL syntax problem
  5. Submit
  6. Validate COBOL syntax problem is resolved

After successfully fixing the COBOL syntax problem, then modify the FSOC051 COBOL program to display the following fields from the table for each customer number input. Display the fields in the order listed.

CUSTOMER NUMBER =
CUSTOMER NAME =
CREDIT CARD TYPE =
CREDIT CARD EXPIRATION MONTH =
CREDIT CARD EXPIRATION YEAR =

3rd COBOL program, FSOC052

Edit hlq.SOURCE member name FSOC052 and observe the following:

  • Observe statements under PERFORM UNTIL CUST-NO-SRCH = 'QUIT' loop logic that enable interactive conversation
While in edit on hlq.SOURCE(FSOC052), enter the following:
sub; =sd; st

  1. View FSOC052 output
  2. Identify compile problem
  3. Edit hlq.SOURCE(FSOC052)
  4. Correct COBOL syntax problem
  5. Submit
  6. Validate COBOL syntax problem is resolved

You can validate FSOC052 successful interactive conversation execution as follows:

  1. Jump to ISPF Command Shell panel, =6
  2. Enter ALLOC DA('FSO.CLIENT.PROFILE') FILE(CUSTPROF) SHR REUSE
  3. Enter call load(fsoc052)
  4. Enter 6 digit customer number from 000001 to 000565

After successfully fixing the COBOL syntax problem, then modify the FSOC052 COBOL program to display the following fields from the table for each customer number input. Display the fields in the order listed.

CUSTOMER NAME =

Once the 3 COBOL programs successfully execute with requested modifications, then enter:
tso submit 'zos.public.jcl(p3ch4c)'

If the 3 COBOL programs successfully execute with the requested modifications, then the JCL job, p3ch4c, write output from the execution of the 3 COBOL programs into hlq.P3.OUTPUT(#04)

Next: Challenge #05