Data editing > Writing out data > Defining the file type
 
Defining the file type
Quick reference
To define a report file, type:
filedef filename[=pathname] report [len=rec_len]
To define a data file, type:
filedef filename[=pathname] data [len=rec_len]
To define a print file, type:
filedef filename[=pathname] print [mpa][mpd][mpe][len=n][norule][noser][$text$]
mpa, mpd and mpe indicate that multipunches should be printed across the page, down the page, or as an asterisk and then listed below the record.
More information
All files named on write and report statements must be defined by a filedef statement before they are used. This tells Quantum whether the file is a report, print or data file, and defines more specifically how the output should be written. So that you can be sure that all filenames will be recognized, you are advised to place all filedef statement at the beginning of the edit.
For report files, the definition is:
filedef filename[=pathname] report [len=rec_len]
filename is the name of the report file and report is a mandatory keyword indicating that the file is a report file.
Note If you are writing out more than 200 characters to a report file, you need to set len= on the filedef statement to more than 200 to ensure that no lines are truncated.
Quantum normally creates report files in the main project directory. If you want the report file to be created in a different directory, follow the filename with =pathname. When specifying a pathname, the filename acts as a shorthand reference (tag). This means that you still have to tell Quantum the filename by appending it to the pathname.
For example, to declare a report file called repfile1 that is to be created in the directory /home/ben, you would write:
filedef repfile1=/home/ben/repfile1 report
Note The maximum length for filename is set at 31 characters.
For data files, the file definition statement is:
filedef filename[=pathname] data [len=rec_len]
filename is the name of the output file and data is a mandatory keyword indicating that the named file is a data file. As with report files you can use the optional =pathname parameter to name the directory in which the data file should be created.
All records written to data files are as long as the record length defined with reclen on the struct statement. If you want to change this, add the option len=reclen to the filedef statement, thus:
filedef newdat1 data len=80
This example says that records written to the data file newdat1 must be 80 columns long.
The file definition statement for print files is:
filedef filename[=pathname] print options
filename is the name of the print file with an optional pathname, print is a mandatory keyword indicating that the file is a printout file, and options is a list of optional keywords defining more specifically how the records should be written. Filename lengths are as described above for data files.
Options
len=n
Length of output record if different from reclen= on the struct statement.
$text$
Heading text to be printed at the top of each page.
mpa
Prints the codes in a multicode across the page enclosed in curly brackets. For example:
000401 635495{134}45111
This example has a multicode of ‘134’. The ruler is of little use when multicodes are printed in this manner, so you might prefer to suppress it with the option norule.
mpd
Prints the codes in a multicode down the page, thus:
----+----1----+----2
000401 635495145111
             3
             4
mpe
Prints multicodes as an asterisk, but lists the individual codes within each multicode beneath the record. For example:
----+----1----+----2
000401 635495*45111
 Column  14 contains codes 134
norule
Turns off the ruler.
noser
Prevents the messages ‘Record nnn’ and ‘n in File’ from being printed.
Output file
The default output file is a print file called out2, and the default output style is as described above. To change the output style for this (for example, to suppress the ruler or print multicodes in a different format), use a filedef statement naming this file and giving the appropriate options from the list above:
filedef out2 print norule mpe
See also
Writing out data