Rethinking the use of COBOLCHECK

I had discovered something about GnuCOBOL: it has its own testing mechanism . It looked promising for simplifying the existing tests and getting better error notifications. However after doing a POC I’m now less sure.

At this point I’m not using autoconf tools, but just setting up a test and then using COPY to load the student’s solution in at compilation.

FRAME.COB:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. frame.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-ARGUMENT PIC XXX VALUE "FOO".
       01 WS-RESULT   PIC XXX.
       PROCEDURE DIVISION.
           CALL "source" USING WS-ARGUMENT  WS-RESULT.
           IF WS-RESULT NOT = "OOF"
             DISPLAY "FAIL"
           ELSE
             DISPLAY "PASS"
           END-IF.
           STOP RUN.
 
       COPY "source.cob".
       END PROGRAM frame.

SOURCE.COB (the student’s solution)

       IDENTIFICATION DIVISION.
       PROGRAM-ID. source.
       DATA DIVISION.
       LINKAGE SECTION.
       01 LS-RESULT PIC XXX.
       01 LS-ARGUMENT PIC XXX.
       PROCEDURE DIVISION USING LS-ARGUMENT LS-RESULT.
           MOVE FUNCTION REVERSE(LS-ARGUMENT) TO LS-RESULT.
       END PROGRAM source.

To pursue this line of attack has some advantages and disadvantages. A considerable simplification of the testing framework is possible. But against that is that the students are now doing something quite different to the current regime. The current regime has the student write a standalone program which is absorbed into a larger test.cob by COBOLCHECK which handles all the testing. With the “simpler” approach the student now has to write a module with red-tape for being CALLed, e.g. USING on PROCEDURE DIVISION and LINKAGE SECTION etc.

I don’t have any COBOL industry experience. I learned COBOL in 1983 and loved it but never got to do anything constructive with it until I helped get the COBOL track here going. What’s the usual deal out there in the “real world”? Do people write standalones or do they learn early how to write callables? What should we be teaching?

This depends a lot on what you want to test.
COBOL Check is designed to test individual paragraphs or sections, your approach is leaning towards testing the entire program.
At the moment I see COBOL Check as the best fit, to testing in exercism, as the concepts are easy to understand from someone who knows Jest or another popular testing framework.

If the goal of exercism is to teach all of COBOL, what should be written in the linkage section, what in the working storage section, file division and so on, including how to write specific code, then I think there would be a need for several different test engines.
COBOL Check, your example, and one where the input/output is files, and the program being tested is complete.