The input data user-exit program

The InfoPrint Manager input data user-exit program can be used to:

  • Monitor the incoming print data stream to InfoPrint Manager
  • Discard an input record before it is processed
  • Replace an existing input record with one or more records (which might include the original record or a modified version of the original record)
  • Continue processing with the input record unchanged
This exit can be called for all parts of the job (see Sequence of user-exit programs for InfoPrint Manager).
Note: The input data user-exit program only processes MO:DCA data.

If you are using the exit to insert extra input records, the original input record that is passed to the exit can be processed before or after the extra input records. This means that the extra input records can be inserted before or after the current structured field depending on where the current structured field is placed in the list of structured fields to insert.

Important considerations

  • Code processing becomes an integral part of PSF and can affect performance and reliability.
  • User-exits should be coded by experienced programmers who are aware of overall system implications.
  • Any delays caused by this exit will translate into a PSF processing delay and could affect printer performance.
  • This exit is not passed any structured fields that are contained in resources that are processed. This includes: form definitions, overlays, page segments, fonts, data object resources, internal medium maps, and data object fonts.
  • Code processing must be able to handle PSF repositioning.
Repositioning can occur as a result of errors or operator commands. PSF can reposition items forward into the print job, skip structured fields, or reposition items back into previously processed data. If PSF repositions back into the print file, it is the responsibility of the exit to return the same data in the same sequence to PSF, just as it did when the structured field was originally passed to the exit.

Because of the constraints outlined above, you should first consider using the transform subsystem to process data, because the transform subsystem does not have these limitations. For example, a transform object would have access to all of the input data (no restrictions) and could add, delete, and modify both resources and pages. In addition, the transform subsystem processing is done before printing begins, so it would have no impact on printer performance or behavior.

The input data user-exit is not capable of identifying individual document boundaries in a data stream. For example, your job might have 5 separate documents that each contain 10 pages of data. This is viewed by the exit as 50 pages of data, not 5 units of 10. The transform subsystem does not have this limitation.

The PSF Input Record Exit is responsible for managing any memory it allocates. It can reuse the memory across calls through the use of a work area pointer provided in ainuexit.h. PSF does not free any memory that might be pointed to by fields in either the INDATA_EXITDATA structure or the PSFINSERTRECS structure. The exit can point to memory that it has defined or allocated. The exit can reuse allocated memory or free memory when it is appropriate. PSF might run out of memory if the PSF Input Record Exit mismanages memory.

The source code (in the C programming language) for the sample input data user-exit program listed on page What sample user-exit programs are available? is in the /usr/lpp/psf/exits/ainuxind.c file. This sample program consists of a return code and performs no function.

The data structures for the input data user-exit program are included with the source code in the /usr/lpp/psf/exits/ainuexit.h file.

The declaration of this exit is:

void INDATA (INDATA_EXITDATA *exitdata)

The INDATA_EXITDATA input/output parameter contains all of the input and output data needed to communicate between InfoPrint Manager and the user-exit program.

These fields are also found in the input data user-exit:

version
This variable was formerly called reserved1. It is designed for use as a migration aid for future variants of this exit. It contains a version identifier for this structure:
  • X'00'= previous version (before August, 2005)
  • X'01'= August, 2005 version adding support for deletion and insertion of input records
Copy
Indicates which copy is associated with this call to the exit. Initially set to 1, it increments by one each time the exit is called.
DataSize
Contains the length of the input data record
DataPointer
Points to the input data record to be processed.
DataType
Always set to 0 (AFP; MO:DCA data only).