Free-Form File Definition Statement

A free-form file definition statement begins with DCL-F, followed by the file name, followed by keywords, and ended with a semicolon.

If the file name is longer than 10 characters, the EXTDESC keyword must be used. See Rules for File Names for more information about how the file name is used at compile-time and run-time.

The device of a file defaults to the DISK device, with the *EXT parameter indicating that it is an externally-described file. If you want to specify a different device, or if you want to explicitly specify the DISK device, you must specify a file-device keyword as the first keyword.

If you want to define the file like another file, you must specify the LIKEFILE keyword as the first keyword.

The file is opened for input, update, output, or delete, according to the USAGE keyword.

Specify the file as a keyed file using the KEYED keyword.

The only directives that are allowed within a free-form file statement are /IF, /ELSEIF, /ELSE, and /ENDIF.

The following example shows the definition of several files.
  1. File file1a and file1b are both externally-described DISK files opened for input. The device-type and usage are determined by default for file file1a, while they are specified explicitly for file1b.
  2. File file2 is an externally-described PRINTER file opened for output. The usage is determined by default.
  3. File file3 is an externally-described SEQ file opened for input. The usage is determined by default.
  4. File file4 is an externally-described WORKSTN file opened for input and output. The usage is determined by default.
  5. File file5 is an externally-described keyed DISK file opened for input and update.

 DCL-F file1a;  1 
 DCL-F file1b DISK(*EXT) USAGE(*INPUT);

 DCL-F file2 PRINTER;  2 

 DCL-F file3 SEQ;  3 

 DCL-F file4 WORKSTN;  4 

 DCL-F file5 USAGE(*UPDATE) KEYED;  5