Considerations for Report/Update Options ($SPOOL) and @RPTOPT

PROIV is coded to look for certain values in the Report Device Name field before printing the report. These values are CRT, AP, and LP0 to LP9.

If the Report Device is CRT or AP, PROIV sends the report output to the screen or attached printer accordingly, even if the Device Type defined in @RPTOPT has been defined to send the print output to a queue or file called CRT or AP. This is because any Device Type set in @RPTOPT is ignored.

If the Report Device is a Logical Device i.e. LP0-LP9, PROIV references the virtual spooler table to resolve the Report Device. The printer output is then sent to the Report Device assigned to the Logical Device. Any Device Type value specified in @RPTOPT is ignored, as internally, this is set to the value defined for the Logical Device. 

The checking of the above values in the Report Device name in the Report/Update options and @RPTOPT is not case sensitive as PROIV converts the Report Device name to upper case before it does the check.  Thus it would not be possible to send a report output to a Report Device called lp1 using @RPTOPT unless lp1 was also defined as the Report Device in Logical Device LP1 in the Virtual spooler table.

If CRT, AP or a Logical Device name, i.e. LP0 to LP9 is defined for a report in the Report/Update options screen, all the options switches that derive the Printer Type i.e. Spool, Que Name, File Name, etc. are deliberately skipped as Printer Type will be set dynamically.

NOTE: It is good coding practice to minimize the modifications required if the valid report devices or queues change. For example, if an application is ported to another machine, it is recommended that Logical Device names be used in Report/Update Options ($SPOOL) and @RPTOPT where possible.

SET_RPTOPT

The Logic Verb SET_RPTOPT may be used to dynamically modify the spooler device at execution. SET_RPTOPT can be used in any function/logic and is used by the next Report function that executes. The Function In logic of the Report is the only place where it can be used where it applies to that function, anywhere else and it applies to the next Report function (assuming it is not overridden by another SET_RPTOPT statement).

Comment on this topic

Topic ID: 730041