z/OS | COBOL INMOD Routine | Teradata FastLoad - 17.10 - COBOL - FastLoad

Teradata® FastLoad Reference

Product
FastLoad
Release Number
17.10
Published
June 2021
Last Update
2021-07-01
Content Type
Programming Reference
Publication ID
B035-2411-061K
Language
English (United States)
INMOD routines written in COBOL on z/OS must:
  • Contain the entry point name BLKEXIT
  • Be stored as an z/OS load library file

Creating and Using 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 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
##