Microsoft KB Archive/32954

Definition and Declaration of External Files in Version 3.0

PSS ID Number: Q32954 Article last modified on 04-21-1993

3.00 | 3.00 MS-DOS | OS/2

Summary: The ANSI ’85 feature for “external” files allows a file to be shared among independent program modules. The ANSI ’74 COBOL standard does not support external files. The ANSI ’74 standard states that the module that opens a file is the only module that can access the file (unless it is closed and reopened in the proper module). With ANSI ’85 external files, you can open the file in one module, declare the file as external, then access the file in all modules that also declare the file as external. The external-file handler can be called. The primary use is in other (non-COBOL) language-file support.

More Information: The following are examples of declaring external files: Program 1: FD file-name is EXTERNAL. (The “EXTERNAL” clause identifies the file as an external, shareable file.) Program 2: FD file-name is EXTERNAL. The SELECT clause in Program 2 must be identical to the SELECT clause in Program 1. This program must not issue another “OPEN” statement unless it first closes the external file. Please note that using the “CALLFH” compiler directive is analogous to FD file-name IS EXTERNAL. When using the “CALLFH” directive, you would not use the “IS EXTERNAL” clause on the FD statement.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.