External files allow programs to access files used by other languages or database and spreadsheet packages. See also Open External.
When a file is opened for external processing, Business Rules can read, write and position to any byte in the file-no matter what its structure.
Business Rules assumes very little about the structure of an external file. It treats the file as if it has no header record and as if it has no record delimiter. If these items do exist, the program and the file I/O must account for them.
Files that were originally created as internal or display files can be opened as external. If a file created as an internal file is later processed as an external file, however, the delete byte and header record must be taken into account.
Viewing the contents
The best way to see the contents of an external file is with a Business Rules to read the file and print its information in a formatted report that is visually meaningful (e.g., a new line for each record, spaces between fields, special numeric formats converted to ASCII digits, etc.).
Although it is possible to use the TYPE command to view the full contents of an external file, the output is often unreadable due to lack of record delimiters and the presence of unprintable (non-displayable) characters where special numeric formats such as packed decimal are used.
Use with SORT and INDEX
External files cannot be used as indexed files and cannot be sorted by Business Rules built-in file sort.
External files may be opened for INPUT, OUTPUT and OUTIN. Individual records or portions of individual records are easily updated by opening the file OUTIN. Sequential or relative access methods can be used.
The statements that can be used for input from external files are READ and REREAD. Output to external files is accomplished with the WRITE and REWRITE statements. The RESTORE statement can move the file pointer to the beginning of the file or to any specified record or byte. The DELETE statement cannot be used on external files.
Business Rules will transmit data to or from external files in all the same formats that it will use with internal files. However, it is the responsibility of the programmer to ensure that any data output to an external file remains in a format that is compatible with the overall intent of the file.
Whenever an external file is opened, a record length must be specified. Business Rules then treats the file as if it has that fixed record length. Every input or output operation affects the specified number of bytes. If RECL equals 50, for example, a read from byte 47 would automatically bring in bytes 47-96. The RLN function may be used to shorten the record length of an external file after it has been opened.