COBOL Coding Strategy

Two applications should be installed for further utilization of this tutorial .  Install GnuCOBOL by clicking here.  Install OpenCobolIDE by clicking here.

The primary or main COBOL program should consist of the call verb only.  That is to say only subprogram references should be invoked from the mainline.  The mainline will consists of only calling programs.

[codesyntax lang=”cobol”]

        *
            MOVE "The Top Place." to DBUFF.
            call 'UTIL' using DBUFF;

[/codesyntax]

The called sub program will have a structure similar to the following.  As many verbs as necessary are referenced until its desired task is completed.

From any subprogram where the display verb is being used the UTIL subprogram should be invoked.

In addition to making the program as compact as possible a gain is attained by knowing the location of the invoked source code.

When modifications are required changes are made in a single sub program that propagates across the entire system.

[codesyntax lang=”cobol”]

      ******************************************************************
      * Author: Mr. Arch Brooks
      * Date: 2020-9-8 4:23:4
      * Purpose: Display Subroutine
      * Tectonics: cobc
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. 'UTIL'.
       DATA DIVISION.
       LINKAGE SECTION.
       01 DISPLAY_BUFF PIC x(80).
       PROCEDURE DIVISION USING DISPLAY_BUFF.
           DISPLAY "In Called Program".
           DISPLAY DISPLAY_BUFF.
       EXIT-PROGRAM.
       END PROGRAM UTIL.

[/codesyntax]

This approach lends itself to a highly organized approach to developing and maintaining COBOL source code.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *