File Names Starting With a Hyphen

File names that start with a hyphen are treated specially. The hyphen and the following character are removed, as are any spaces following that character. The rest of the name is interpreted depending on the character after the hyphen as follows:

  1. If the character is an F, then the name is treated as a normal file name. This differs from the default handling only in that the name is not further translated (i.e., no further searching in the environment and no application of the FILE_PREFIX or FILE_SUFFIX). This is useful if you want to ensure that a file name is placed in the current directory or remains untranslated.
  2. If the character is a D, then the name is treated as the name of a device. This is treated no differently than the case for F above, except that file locking rules are slightly changed for devices. Devices may be assigned only to SEQUENTIAL files.
  3. If the character is a P, then the name is treated as the name of a program to run. On UNIX systems, a pipe is created between runcbl and the named program. This program will then either receive data written to the file or provide the data read from the file.

    On Windows and VMS systems this is handled somewhat differently. The translation of the name must contain at least two space-separated words. The first word is treated as the name of a file to write or read. This name is not further translated and is handled as a standard SEQUENTIAL file. The second and following words are treated as the program to run. If the file is being opened for input, the program is run first and then the named file is opened. If the file is being opened for output, then the named file is first opened normally; when this file is finally closed, the named program is run. Typically the program should either create or read the named file as is appropriate.

    On Windows and VMS systems you have the option of using the phrase %TMP% in place of a file name. In this case a unique name is created for you, and that same name is substituted for %TMP% every place on the line that the phrase is found. It is advisable to finish with (or rename) the file within 19 days, to avoid the possibility of name conflicts with names generated in the future. (See the examples below.)

    If you use the %TMP% option to assign a file to a simulated pipe (by using P in the assign name), you can specify where the temporary file will reside. This is done with the TEMP_DIR configuration entry. It acts just like the SORT_DIR entry, except that it applies only to %TMP% files.

    On Windows systems, if you append an ampersand (&) character to the command line, the program will run asynchronously. This should not be done for programs providing input files, but is often useful for programs processing output files. For example:

        assign to output "-P %TMP% cmd /c edit %TMP% &"

    Program files may be assigned only to SEQUENTIAL files and may not be opened for I/O or EXTEND.