Custom Search

Sunday, May 9, 2010

COBOL Sub Programming Strategy

Software shops that employ COBOL but do not employ object-oriented COBOL development techniques are required to produce considerable amounts of COBOL source code. For each function COBOL code must be edited, created, maintained, and compiled for usage.

In the early to mid seventies I discovered a way to subrogate monolithic COBOL code segments into COBOL sub programs. First I had to understand that each sub program needed to be linked with the ncal, let and list options so they would reside the Load Partition Data Set (LPDS) properly. These sub programs may be used in an unlimited number of end user COBOL applications. Their existence lends itself to re usability of COBOL code.

The ncal option told the linkage editor that this program was never to be called as you would call a stand alone COBOL program. The let option told the linkage editor that external reference errors were permitted in this particular scenario. The list object produced the symbols list of the subprogram which would be require to debug the resulting application.

Without this approach all COBOL source code is compiled and the compiled results would be stored in an Object Partitioned Data Set (OPDS). The resulting objects would then be used as input to the linkage editor. The Load Partitioned Data Set (LPDS) is still required to house the end resulting executable COBOL code. This approach eliminated the need for an Object Partitioned Data Set (OPDS).

The second revelation was that the master or driver program which would be responsible for accessing the associated sub program source codes. This was accomplished via a call statement in the procedure division. Also any associated data as well as the calling protocol structure would be defined in the linkage section of the COBOL program. The linkage section allows for successful passing of data to and from the main program.

This driver program serves the function of a digital traffic cop for the application. When it is prepared for execution all external references (calls to sub programs) are resolved and errors other than warnings are not tolerated. Those external references are the aforementioned members of the Load Partitioned Data Set (LPDS). Upon successful linkage editing of the main and sub programs the end resulting program is ready for production.

No comments:

Post a Comment