Previous Page | Next Page

File Access

Using the FILE Statement

The FILE statement is used to refer to an external file. If you have values stored in matrices, you can write these values to a file. Just as with the INFILE statement, you need a fileref to point to the file you want to write to. You use a FILE statement to indicate that you want to write to rather than read from a file.

For example, if you want to output to the file USER.TEXT.NEWCLASS, you can specify the file with a quoted literal pathname. Here is the statement:

   > file 'user.text.newclass';

Otherwise, you can first establish a fileref and then refer to the file by its fileref, as follows:

   > filename outclass 'user.text.class';
   > file outclass;

There are two options you can use in the FILE statement:

RECFM=N

specifies that the file is to be written as a pure binary file without record-separator characters.

LRECL=operand

specifies the size of the buffer to hold the records.

The FILE statement opens a file for output or, if the file is already open, makes it the current output file so that subsequent PUT statements write to the file. The FILE statement is similar in syntax and operation to the INFILE statement.

Previous Page | Next Page | Top of Page