Programmatic Control over Printing

A program can control the handling of printer output by specifying print attributes and print modifiers. Using these attributes and modifiers, the program can control such issues as

  • The location and the device kind of the backup file

  • When the backup file is queued for printing

  • The printer used

  • The time the print request is considered for printing

  • The number of copies that are printed

  • The portions of the backup file to be printed

  • The formatting and translation of printed output

The final values of the print attributes and print modifiers for a backup file are the result of several different factors, most of which are controlled by a programmer. To begin with, each print attribute and modifier has an ultimate default value that is used if no other factor affects the value. The ultimate defaults can be overridden by process defaults. The process defaults are established by the PRINTDEFAULTS task attribute. The PRINTDEFAULTS value consists of a list of print attributes and modifiers and their associated values. The system applies these values to all backup files produced by the process, unless the values are overridden for particular backup files.

The PRINTDEFAULTS value is itself the outcome of several layers of possible assignments. The sources of these assignments include the PRINTDEFAULTS usercode attribute in the USERDATAFILE, the PRINTDEFAULTS attribute of a session, inheritance from a parent process, assignments to the object code file, run-time task equations, and assignments to an active process.

You can override the process defaults for particular backup files by assigning print attributes to the backup file. Print attributes is the name given to file attributes that are related to printing, and they are assigned in the same way as any other file attribute. Using print attributes, a process can cause each backup file to be handled differently.

Another option for printing files is to use the WFL PRINT statement. You can enter this statement in WFL jobs, in MARC or CANDE sessions, or at an ODT. The PRINT statement is used mainly to print permanent backup files that were created on an earlier occasion. The backup files remain on disk when printing is completed, so they can be reused later.

The PRINT statement can assign print attributes and modifiers for any or all of the backup files printed. These assignments override all previous assignments for the backup files.

A process can affect the print handling for another process by making assignments to the PRINTDEFAULTS task attribute of the process. Where more specific control is needed, you can use the FILECARDS task attribute to specify print attributes for each backup file.

However, the PRINTDEFAULTS and FILECARDS values that are assigned externally can be overridden internally. A process can assign a different value to its own PRINTDEFAULTS task attribute after initiation. Also, file attribute assignments made by the process outside the file declaration override any conflicting assignments made by way of the FILECARDS task attribute.