INMOD routines written in PL/I must:
- Contain the entry point name DYNAMN
- Be link-edited with the PLIA load module
- Be stored as an z/OS load library file
- Include ‘OPTIONS(MAIN)’
Creating and Using a PL/I INMOD Routine on z/OS
- Prepare the INMOD routine source file.
- Compile the INMOD routine.
- Link-edit the INMOD program with the specified load module and store the results as an z/OS load library file.
- Invoke the Teradata FastLoad utility to execute the INMOD routine.
Example
The INMOD routine in the following example reads the data from the input source and presents it, as read, to the Teradata FastLoad utility. BTEQ1 creates a table on the database and BTEQ2 selects rows from the table to check for properly loaded data.
This basic program can be modified to select records that meet a specified criteria, convert certain fields, or perform other preprocessing functions.
//IEL1CL EXEC IEL1CL,MEM=MYINMOD //PLI.SYSIN DD DSN=JLH.SOURCE(&MEM),DISP=SHR //PLI.SYSPRINT DD SYSOUT=* //LKED.SYSPRINT DD SYSOUT=* //LKED.SYSLMOD DD DSN=JLH.INMOD.LOAD(&MEM),DISP=SHR //* //LINK EXEC PGM=IEWL,PARM=(LIST,LET,MAP,NORENT,NOREUS) //SYSPRINT DD SYSOUT=* //SYSLOUT DD SYSOUT=* //SYSUT1 DD UNIT=VIO,SPACE=(CYL,(1,1)) //SYSLIB DD DSN=TERADATA.APPLOAD,DISP=SHR // DD DSN=SYS1.SCEELKED,DISP=SHR // DD DSN=JLH.INMOD.LOAD,DISP=SHR //OBJLIB DD DSN=JLH.UTILS.OBJLIB,DISP=SHR //SYSLMOD DD DSN=JLH.INMOD.LOAD,DISP=SHR //SYSLIN DD * INCLUDE SYSLIB(MYINMOD) INCLUDE OBJLIB(PLIA) ENTRY DYNAMN NAME MYINMOD(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 stuff; drop table stuff_error1; drop table stuff_error2; create table stuff (t1 char(40), t2 char(40)) primary index(t1); .quit ## //* //* //FAST EXEC TDSCFAST //FASTLOAD.STEPLIBDD // DD DSN=JLH.INMOD.LOAD,DISP=SHR //FASTLOAD.SYSIN DD DSN=JLH.CNTL(JLHLOGON),DISP=SHR // DD DATA,DLM=$$ BEGIN LOADING stuff ERRORFILES stuff_error1,stuff_error2; DEFINE t1 (char(40)), t2 (char(40)) INMOD=MYINMOD; INSERT INTO stuff (:t1,:t2); END LOADING; logoff; $$ //FASTLOAD.EXPORT DD DSN=JLH.STUFF.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 stuff order by 1; .quit