External Files

As well as its own workfiles, Qedit recognizes “external” files of other formats (in List file, Add 5=file, Text file, etc.). When Qedit opens an external file, it determines the language of the source program in that file according to the following chart. If the file code is 1052, the file is always recognized as a COBOL-type file. Note that “file code” refers to the MPE file code. Posix files with a “.cbl,” “.cob”, “.CBL” or “.pco” extension are treated as COBOL source files. In this case, Qedit does not assume there is a sequence number in the first 6 columns; it checks the first 5 lines of the file. The .pco extension is typically used to identify Cobol source files that needs to be processed by the Oracle pre-compiler.

If the lines contain only numeric digits in these columns, Qedit assumes the file contains sequence numbers and uses them appropriately. These numbers are written back to the file when a Keep command is executed.

If the lines only contain spaces in these columns, Qedit assumes the file is unnumbered and automatically assigns numbers during the Text operation. If some of the lines have a sequence number already, this number is replaced with Qedit’s calculated number. When the file is saved, the sequence numbers are replaced by spaces.

If the first 6 columns do not contain either numeric digits or spaces, Qedit assumes the file is free-format and assigns it line numbers in the same way that numbers are assigned to Text files. The file format might change on a Keep command, depending on the Set Keep Cobfree option.

When accessing files in the Posix namespace, Qedit checks the extension of the file, if any. It then tries to determine the language based on the extension.The following languages are recognized:

Language Extensions
Cobol CBL, COB
CC H, C
CPP CPP
HTML HTM, HTML, ASP
JAVA JAVA
PASCAL P, PAS, PASCAL, MODULE, INCLUDE, FORWARD, EXTERNAL
QSL QSL
XML XML

Extensions are not case-sensitive i.e. cbl is the same as CBL.

Record Size (bytes) Leading Columns (1-6) Contain Last 8 Columns of First Line Current Language Setting* File Code / Ext. Num / Unn? LANG Used
74       both Unn COBOLX
66       both Unn COBOL
80 6 digits     both Num COBOLX
80 6 digits     not code Unn JOB
80 no digits no digits RPG   Unn RPG
80 no digits 8 digits FORTRAN   Num FTN
80 no digits 8 digits Pascal ext. Num Pascal
80 no digits 8 digits not Ftn/Pas   Num SPL*
72 6 digits       Num COBOL
72 no digits   FORTRAN   Unn FTN
72 no digits   Pascal ext. Unn Pascal
72 no digits   not Ftn/Pas   Unn SPL*
80 no digits no digits     Unn JOB
88 8 digits       Num JOB
9-264 8 digits       Num TEXT
1-256 no digits       Unn TEXT
1-256 no digits or spaces     both Unn COBFREE
1-256 no digits       Unn HTML
1-256 no digits       Unn XML
1-256 no digits       Unn JAVA
1-256 no digits       Unn QSL

* see Set FORTRAN ON.

In this table, the “File code / Ext.” column indicates how Qedit determines which language to use. Code means it uses the file code only. Ext. means it uses the file extension only. Both means it checks the file code and the file extension.

Qedit maps an ASCII external file into one of these file formats. Qedit checks the last eight columns of each of the first five lines for an ascending sequence number. If five lines with valid sequence numbers are found, the file is treated as a Numbered file. Qedit may sometimes mistake a data file for a source file with sequence numbers. If there is an ambiguity in identifying the language of an external file, you can direct Qedit to the proper choice by appending a file type to the file name in the Text, List, and Add commands. For example, /List abc,unn;Text def,pascal.

External files with 80-character records and no valid SPL sequence numbers are treated as RPG files, if the current language setting is RPG; otherwise, they are treated as JOB files.

Qedit creates workfiles with two user labels for new control information. The user labels are self-identifying and have internal version numbers. The first user label contains status fields (saved on Shut and recalled on Open). This label is identified by the string “QEDIT0″ in the first 6 bytes, followed by a word containing the binary version number. The second user label is identified as “QEDIT1″ and is reserved for future speed improvements.

If you are creating a new Qedit file by hand and you forget the user labels, Qedit will still edit your file, but will not save the context when you shut the file. If you create a new workfile with two user labels defined but NOT written, Qedit will initialize the user labels the first time that you Open the files. This is how our QOUT routines work.

User programs can create and read Qedit workfiles using the Qeditaccess routine in our QLIB.

External Files