z/OS
Assembler
INMOD routines written in Assembler do not need to be link‑edited with other load modules.
To create and use an Assembler INMOD routine on z/OS
1 Prepare the INMOD routine source file.
2 Compile the INMOD program.
3 Invoke the Teradata FastLoad utility to execute the INMOD routine.
Example
The INMOD routine in the following example reads a record from the input data source and adds a four‑‑byte integer field to the front of the record. The new field contains a sequence record that ranges from one to the total number of input records.
//JLHFAST JOB 1,’FASTLOAD/INMOD’,MSGCLASS=A,CLASS=B,NOTIFY=JLH //
******************************************************************
//* Compile and link‑edit the INMOD *
//****************************************************************
//ASMCOMPL EXEC ASMFCL
//****************************************************************
//* The INMOD starts here *
//****************************************************************
//ASM.SYSIN DD *
<Assembler source goes here>
/*
//LKED.SYSLMOD DD DSN=JLH.INMOD.LOAD,DISP=SHR
//LKED.SYSIN DD *
NAME ASMINMOD(R)
/*
//****************************************************************
//* Execute BTEQ to create a Teradata DBS table *
//* *
//* The BTEQ statement .run ddname=logon allows the user to *
//* place sensitive logon information in a secure data set (in *
//* this case, the ddname is logon). Logging on from a data *
//* set prevents this sensitive information from appearing in *
//* the SYSIN file. *
//****************************************************************
/*
//BTEQ EXEC TDSBTEQ
//LOGON DD DSN=JLH.CNTL(JLHLOGON),DISP=SHR
//SYSIN DD DATA,DLM=##
.run ddname=logon
drop table asm_example;
drop table asm_error1;
drop table asm_error2;
create table asm_example (f1 INTEGER, f2 CHAR(80))
primary index(f1);
.quit
##
//*
//******************************************************************
//* Execute FastLoad *
//******************************************************************
//FAST EXEC TDSFAST
//FASTLOAD.STEPLIB DD
// DD DSN=JLH.INMOD.LOAD,DISP=SHR
//FASTLOAD.SYSIN DD DSN=JLH.CNTL(JLHLOGON),DISP=SHR
// DD DATA,DLM=$$
BEGIN LOADING asm_example ERRORFILES asm_error1,asm_error2;
DEFINE T1 (integer), T2 (CHAR(80)) INMOD=ASMINMOD;
INSERT asm_example (:t1,:t2);
END LOADING;
LOGOFF;
$$
//FASTLOAD.INDATA DDDSN=JLH.ASMXMPL.DATA,DISP=SHR
//****************************************************************
//* Using BTEQ, select the rows loaded by FastLoad *
//****************************************************************
//BTEQ EXEC TDSBTEQ
//LOGON DD DSN=JLH.CNTL(JLHLOGON),DISP=SHR
//SYSIN DD DATA,DLM=##
.runddname logon
select * from asm_example order by 1;
.quit
##
COBOL
INMOD routines written in COBOL on z/OS must:
To create and use a COBOL INMOD routine on z/OS
1 Prepare the INMOD routine source file.
2 Compile the INMOD routine.
3 Link‑edit the INMOD program with the specified load module and store the results as an z/OS load library file.
4 Invoke the Teradata FastLoad utility to execute the INMOD routine.
Example
The INMOD in the following example reads five 80‑byte records from the input data source and returns a single, 400‑byte record to Teradata FastLoad. BTEQ1 creates a table on the Teradata Database and BTEQ2 selects rows from the table to check for properly loaded data.
//JLHFAST JOB 1,’FASTLOAD/INMOD’,MSGCLASS=A,CLASS=B,NOTIFY=JLH
//****************************************************************
//* Compile and link‑edit the INMOD *
//****************************************************************
//COBCOMPL EXEC COBUCL
//****************************************************************
//* The INMOD starts here *
//****************************************************************
//COB.SYSIN DD *
<COBOL source goes here>
//****************************************************************
//* Link‑edit the INMOD with the Teradata‑supplied module *
//****************************************************************
/*
//LKED.SYSLIB DD DSN=SYS1.COBLIB,DISP=SHR
// DD DSN=TERADATA.APPLOAD,DISP=SHR
//LKED.SYSLMOD DD DSN=JLH.INMOD.LOAD,DISP=SHR
//LKED.SYSIN DD *
ENTRY BLKEXIT
NAME COBINMOD(R)
/*
//****************************************************************
//* Execute BTEQ to create a Teradata DBS table *
//* *
//* The BTEQ statement .run ddname=logon allows the user to *
//* place sensitive logon information in a secure data set (in *
//* this case, the ddname is logon). Logging on from a data *
//* set prevents this sensitive information from appearing in *
//* the SYSIN file. *
//****************************************************************
//BTEQ1 EXEC TDSBTEQ
//LOGON DD DSN=JLH.CNTL(JLHLOGON),DISP=SHR
//SYSIN DD DATA,DLM=##
.run ddname=logon
drop table cobol_example;
drop table example_error1;
drop table example_error2;
create table cobol_example (f1 char(10), f2 varchar(390))
primary index(f1);
.quit
##
//*
//FAST EXEC TDSFAST
//FASTLOAD.STEPLIB DD
// DD DSN=JLH.INMOD.LOAD,DISP=SHR
//FASTLOAD.SYSIN DD DSN=JLH.CNTL(JLHLOGON),DISP=SHR
// DD DATA,DLM=$$
BEGIN LOADING cobol_example,
ERRORFILES cobol_error1,cobol_error2;
DEFINE T1 (CHAR(10)) ,T2 (CHAR(390)) INMOD=COBINMOD;
INSERT cobol_example (:t1,:t2);
END LOADING;
LOGOFF;
$$
//FASTLOAD.INDATA DD DSN=JLH.COBXMPL.DATA,DISP=SHR
//*
//****************************************************************
//* Using BTEQ, select the rows loaded by FastLoad *
//****************************************************************
//*
//BTEQ2 EXEC TDSBTEQ
//LOGON DD DSN=JLH.CNTL(JLHLOGON),DISP=SHR
//SYSIN DD DATA,DLM=##
.run ddname=logon
select * from cobol_example order by 1;
.quit
##