12.4 Merge Commands ↑
12.4.3 output command
This command names and opens the output file, where the results of the template merge will be stored. The first (or sometimes only) operand is the name of the output file.
An optional second operand may specify ifnew
, meaning “only write the output file if it is new” (in other words, if a file with the same name and in the same location doesn’t already exist). This could be used, for example, in conjunction with the display-css
Merge Template System Variable, to create a new CSS file if one does not already exist, but to avoid overwriting one that does exist.
The output
command would normally be the first line in your template file. Subsequent template records will be written to the output file.
Note, however, that the filename can contain a Merge Variable. In this case, the output command would follow the nextrec command, and a new output file would be opened for each row input.
Next: nextrec command