Previous Topic Next topic Print topic


PC_PRINTER_REDIRECTION_PROC

Registers a user function that is called when a program uses OPEN OUTPUT syntax and the ASSIGN TO PRINTER clause.

Syntax:

call "PC_PRINTER_REDIRECTION_PROC" by value flags
                                            user-func

Parameters:

  Using call prototype (see Key) Picture
flags cblt-x4-comp5 pic x(4) comp-5.
user-func cblt-ppointer usage procedure pointer.

On Entry:

flags Reserved for future use. Must be set to 0.
user-func A pointer to a procedure that will manipulate the printer.

Comments:

This routine enables you to set and manipulate fonts on the printer while using standard COBOL OPEN OUTPUT syntax and the ASSIGN TO PRINTER clause.

You must set the tunable printer-redirection in order for this call to operate correctly.

You must set the COBOL clause local-storage section in the program, to avoid run-time system error 166.

A call to PC_PRINTER_REDIRECTION_PROC registers the user function pointed to by user-func with the run-time system.

The user function should have the form:

entry "user-func" using by value printer-handle
 ...
 ...
exit program returning return-value. 

printer-handle should be defined as a pic x(4) comp-5 data item.

When an OPEN statement opens a printer the user function is called and the printer handle returned in printer-handle. The user function can then manipulate the printer using the PC_PRINTER_ library routines. The user function should return a value to the run-time system to determine the next sequence of events.

You should code your user procedure to return a return-code 0 if it is called successfully, and any other value if it is not. If your user function does return a non-zero value, the run-time system closes the printer and a file status 9/005 is returned on the OPEN OUTPUT statement that invoked the user function.

Previous Topic Next topic Print topic