Specifying Multiple Output Files using the ~output Option

In order to have more than one output file in a single Mentor run, you must assign a number to each output file as in:

~output second #2

In order to write to this file you must include the file number on the writecase statement as in:

writecase #2

The output files do not have to be opened consecutively or sequentially. All that is required is that there be an output file open having a number which matches the number on any writecase statements used.

The number of possible open output files is dependent upon the operating system on which one is working, and on the setting of some environment variables on each operating system. On an SCO Unix system, at least 26 output files may be open at the same time.

The only reasonable way to use multiple output files is to include a file number on every ~output statement and on every writecase statement. Nevertheless a file number is not required in all cases.

If an output file is opened without a number before any files have been opened with a number, then writecase statements that have no number will write to the unnumbered file (i.e. the unnumbered file will be treated as a different file than file #1).

If an output file is opened without a number after an output file has been opened with anumber, then any writecase statment will cause an error.

If no file number is specified on the writecase statement, then data will be written to the unnumbered output file if it is open, or to output file #1 if it is open.

A write case statement without a number will default to output file #1 if one is open, however, a writecase to file #1 will not write to an output file that has no number.

Example Spec:

~comment&output.doc>filetodb in1.asc #111111111111111111121111111111111111113111111111111111111>eof>dbtofile in1.asc in1.asc>filetodb in2.asc #122222222222222222222222222222222222223222222222222222222>eof>dbtofile in2.asc in2.asc>filetodb in3.asc #133333333333333333323333333333333333333333333333333333333>eof>dbtofile in3.asc in3.asc~INPUT in1.asc ascii=80 join=(in2.asc,in3.asc)~defproc=  {write: writecaseif [1^1] writecase #1 endifif [1^2] writecase #2 endifif [1^3] writecase #3 endif if [1^1,2] writecase #9 endif }~output outx~OUTPUT outa #1~OUTPUT outb #2~OUTPUT outd #9~OUTPUT outc #3~exc proc=write~end