15.00 - Designing a Sequential Producer Operator - Parallel Transporter

Teradata Parallel Transporter Operator Programmer Guide

prodname
Parallel Transporter
vrm_release
15.00
category
Programming Reference
featnum
B035-2435-034K

Designing a Sequential Producer Operator

Use the following process guidelines for implementing the Initiate, Execute, and Terminate functions for a sequential producer operator.

 

Table 6: Implementing a Sequential Producer Operator

Function

Process

Initiate

1 Use the Get Attribute function to get the path name of the sequential file.

2 Use the path name to open the file and get the file handle.

3 Use the Allocate Storage function to allocate a user area.

4 Save the file handle in the user area.

5 Use the Allocate Storage function to allocate a data buffer area big enough to hold the maximum size of a row in the sequential file.

6 Save the data buffer address and the buffer length in the user area.

7 Use the Put Attribute function to save the user area.

Execute

1 Get the output table handle.

2 Use the Get Attribute function to get the user area.

3 Get the file handle and the data buffer address from the user area.

4 Use the file handle to read the next row into the data buffer.

5 Use the Get Table Schema List function to get the output data schema.

6 If the read is successful, use the Put Row function to write the row to the output data stream and return the PXSTC_SamePhase status.

7 If the read/write is not successful, return bad status.

8 If end-of-file is encountered, return either PXSTC_EndOfData or PXSTC_EndMethod status.

Terminate

1 Use the Get Attribute function to get the user area.

2 Get the file handle from the user area.

3 Use the file handle to close the sequential file.

4 Use the Free Storage function to free the data buffer.

5 Use the Free Storage function to free the user area.