COBOL Source Code Generation

Producing COBOL source code does not require hours of head down programming. Automation of the entire coding process is easily achieved. COBOL has been around for quite a number of years. Its use and popularity has given way to some of the newer languages. COBOL’s utilization is further enhanced by employing sub programming techniques that rely on the Linkage Section of COBOL.
COBOL source code generation is easily accomplished by using a symbolic stream generator with keyword replacements. To accomplish the COBOL source code generation first create an error free COBOL sub program containing the desired COBOL functionality. As an example we would have a COBOL program to operate on fixed length 80 column images. This technique is also known as Physical Sequential File Access. We then highlight various key portions of the COBOL source code so that they may be tokenized and marked for replacement by and intermediate code processor.
Typically the COBOL sub program would accommodate input as well as output thus allowing for one set of code to be used for both input and output of information.
The “RECORD CONTAINS 80 CHARACTERS” clause is changed to read “RECORD CONTAINS CHARACTERS”. The “” phrase becomes the token and by replacing it with the desired record length of 121 yields a source code program that will operate on logical records with a fixed length of 121 characters.
The FD name of the file description could be tokenized as and could be replaced with a desired descriptive name. This process is repeated for as many of the key elements of the COBOL sub program as required that yields the desired code flexibility.
Simply read the skeleton source code into memory and make the necessary replacements of the identified tokens and then save the updated source code to a unique file specification. Afterwards simply compile and link the newly created COBOL source code to yield the newly defined COBOL source code which meets the desired specifications. If the compiler resides on a remote computer simply File Transfer Protocol the source code to the target platform then proceed with the compile and link step. The majority of development is accomplished on the PC and the results are then uploaded to the mainframe for subsequent utilization.
Any processor or environment with the ability or change and replace the identified tokens can be used as the code generator.
Pascal my programming language of choice so much of the code generation work is performed on the windows platform then uploaded to the IBM Mainframe platform. Please keep in mind that I do have access to several PC based COBOL compilers.
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems authored this article.

1 comment
Leave a Reply

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