Sample INMOD Routines
Teradata FastLoad software includes two sample INMOD routines that demonstrate how to write an INMOD routine using the C programming language.
Table 19 describes these sample routines.
Routine |
Description |
BLKEXITR.C |
Retrieves records from a data source and supplies them to Teradata FastLoad. It runs continuously until it reaches EOF. Note: The BLKEXITR.C sample INMOD routine supports Teradata FastLoad restart operations. |
BLKEXIT.C |
Generates data internally and passes the records to a Teradata FastLoad job for processing. To use this sample INMOD routine, supply a Teradata FastLoad job to load the data to the Teradata Database. Note: The BLKEXIT.C sample INMOD routine does not support Teradata FastLoad restart operations. |
The next two subsections provide sample Teradata FastLoad job scripts for calling the sample Teradata FastLoad INMOD routines. As required, each job script includes a Teradata FastLoad DEFINE command that specifies the INMOD option.
These jobs can execute either interactively or in batch, as described earlier in this chapter.
For a complete listing of each sample INMOD routine, see Appendix C: “INMOD and Notify Exit Routine Examples.”
Calling BLKEXIT.C
The following Teradata FastLoad job script calls the BLKEXIT.C sample INMOD routine:
SESSIONS 1 ;
LOGON tdpid/username,password ;
DROP TABLE Fastest ;
DROP TABLE Fasterr1 ;
DROP TABLE Fasterr2 ;
CREATE TABLE FastTest
(Column1 Integer Format ’9(5)’
NOT NULL BETWEEN 1 AND 9999) UNIQUE PRIMARY INDEX
(Column1) ;
DEFINE Test(Integer) INMOD=Blkexit ;
BEGIN LOADING FastTest ERRORFILES Fasterr1, Fasterr2 ;
INSERT INTO FastTest (Column1) VALUES (:test);
END LOADING ;
LOGOFF ;
Calling BLKEXITR.C
The following Teradata FastLoad job script calls the BLKEXITR.C sample INMOD routine:
* use your own account and password here. *
LOGON sia1/weekly, weekly;
DROP TABLE Error_1;
DROP TABLE Error_2;
DROP TABLE BlkExit;
CREATE TABLE BlkExit
Counter(Integer),
c2(smallint),
c3(integer),
c4(smallint),
c5(integer)
UNIQUE PRIMARY INDEX (Counter);
BEGIN LOADING BlkExit ErrorFiles Error_1, Error_2;
DEFINE Counter(Integer),
c2(smallint),
c3(integer),
c4(smallint),
c5(integer)
INMOD = BLKEXIT;
INSERT INTO BlkExit (Counter,
c2,
c3,
c4,
c5
)
VALUES (:Counter,
:c2,
:c3,
:c4,
:c5
);
END LOADING;
LOGOFF;