Microsoft KB Archive/59564

Description of the COBOL BASIS Statement

PSS ID Number: Q59564 Article last modified on 03-15-1990

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

Summary: The BASIS mechanism provides a way where a program source file may be changed and tested by using a second “linked” program, without actually having to make any changes to the original source code. This information applies to Microsoft COBOL Versions 3.00 and 3.00a for MS-DOS and MS OS/2.

More Information: The BASIS control mechanism “links” a separate file to the original source file (BASIS may be thought of as specifying the BASE file from which the new file is derived). The secondary file uses BASIS to tell the compiler to include all the source code from the original COBOL program, and then to modify it as specified by the special keywords INSERT and DELETE. The original COBOL file referenced, as the source to modify, remains unchanged (the changes affect only the secondary “linked” file). Note: The resulting code file cannot be animated since there is no source file for reference. There are three special statements associated with the BASIS mechanism, as follows: BASIS - Defines the BASE file INSERT - Specifies a line to insert in the original source DELETE - Specifies a line to delete in the original source The following example demonstrates the usage of the BASIS statement: FILE1.CBL (original source file) contains the following: 000001 PROCEDURE DIVISION. 000002 DISPLAY “This is a test”. 000003 STOP RUN. FILE2.CBL (temporary edit file) contains the following: BASIS FILE1 DELETE 000003 DISPLAY “This line will be inserted at line 000003”. FILE2.CBL can be compiled and linked as follows: COBOL FILE2.CBL ; LINK FILE2 ; When run, FILE2 produces the following output: This is a test This line will be inserted at line 000003

Copyright Microsoft Corporation 1990.