Input record exit

The line-data transform provides an exit that enables you to add, delete, or modify records in the line-data input file. The program invoked at this exit is defined by the value of the inpexit keyword of the line2afp command.

This exit is called after each record is read from the input file. The exit can request that the record be discarded, processed, or processed with control returned to the exit for the next input record. The largest record that InfoPrint Manager can process is 32756 bytes. This exit is not called when the line-data transform is processing resources from directories.

Sample input record exit C language header contains a sample C language header that describes the control block that is passed to the exit program.

Sample input record exit C language header

/* INPEXIT STRUCTURE                                                 */
typedef struct _INPEXIT_PARMS /* Parameters for input record exit    */
   char           *work;      /* Address of 16-byte static work area */
   PFATTR         *pfattr;    /* Address of print file attribute info*/
   char           *record;    /* Address of the input record         */
   unsigned short in_CCSID;   /* input CCSID for translating     @06a*/
   unsigned short out_CCSID;  /* output CCSID for translating    @06a*/
   unsigned short recordln;   /* Length of the input record          */
   unsigned short reserved2;  /* Reserved for future use             */
   char           request;    /* Add, delete, or process the record  */
   char           eof;        /* EOF indicator                       */
} INPEXIT_PARMS;                                                        

The address of the control block containing these parameters is passed to the input record exit:

work (Bytes 1–4)
A pointer to a static, 16-byte memory block. The exit program can use this parameter to save information across calls (for example, pointers to work areas). The 16-byte work area is aligned on a full word boundary and is initialized to binary zeros before the first call. The user-written exit program must provide the code required to manage this work area.
pfattr (Bytes 5–8)
A pointer to the print file attribute data structure. See Attributes of the line-data input file for more information about the format of this data structure and the information it contains.
record (Bytes 9–12)
A pointer to the first byte of the input record including the carriage control character. The record is located in a buffer that is located in storage allocated by the line-data transform but the exit program is allowed to modify the input record.
in_CCSID (Bytes 13-14)
The value from the INPCCSID parameter on the line2afp command.
out_CCSID (Bytes 15-16)
The value from the OUTCCSID parameter on the line2afp command.
recordln (Bytes 17–18)
Specifies the number of bytes (length) of the input record. If the input record is modified, this parameter must also be updated to reflect the actual length of the record. If recordln is 0 when the exit program returns, line2afp will terminate with a return code of 99.
reserved2 (Bytes 19–20)
These bytes are reserved for future use.
request (Byte 21)
Specifies how the line-data transform processes the record. On entry to the exit program, this parameter is X'00'. When the exit program returns control to line-data transform, this parameter must have the value X'00', X'01', or X'02', where:
Specifies that the line-data transform should process the record.
Specifies that the line-data transform should not process the record.
Specifies that the line-data transform should process the record and then return control to the exit program to allow it to insert the next record. The exit program can set this value to save the current record, insert a record, and then supply the saved record at the next call. After the exit inserts the last record, the exit program must reset the request byte to X'00'.

A value of X'00' on entry to the exit program specifies that the record be processed. If you want to ignore the record, change the request byte value to X'01'. If you want the record to be processed and you want to insert an additional record, change the request byte value to X'02'. Any value greater than X'02' is interpreted as X'00', and the exit processes the record.

Note: Only one record can reside in the buffer at any time.
eof (Byte 22)
An end-of-file (eof) indicator. This indicator is a one-byte character code that specifies whether an eof condition has been encountered.

When eof is signaled (eof value=‘Y’), the last record has already been presented to the input exit, and the input file has been closed. The pointer record is no longer valid. Records cannot be inserted when eof is signaled. These are the only valid values for this parameter:

Specifies that eof has been encountered.
Specifies that eof has not been encountered.

This end-of-file indicator allows the exit program to do some additional processing at the end of the file. The exit program cannot change this parameter.