17.10 - インポート タスク - MultiLoad

Teradata® MultiLoadリファレンス

Product
MultiLoad
Release Number
17.10
Release Date
2021年6月
Content Type
プログラミング リファレンス
Publication ID
B035-2409-061K-JPN
Language
日本語 (日本)
/*****************************************************************/
/*    This task will change the departments of some employees    */
/*    and delete others from the Employee table, according       */
/*    to a transaction code.  All transaction records will       */
/*    be inserted into a history table.                          */
/*****************************************************************/
.Logtable Logtable002;           /*  Connect to the Teradata DBS */
.Logon tdpx/user,pwd;            /*  identify the restart table  */
Create table History             /*  Create the history table    */
   ( TransCode char(3),
     EmpNo smallint,
     DeptNo    smallint )
     Unique Primary Index (EmpNo);
.Begin Import Mload              /*  Specify MLOAD IMPORT task   */
   tables                        /*  and identify the            */
      Employee,                  /*  target                      */
      History;                   /*  tables.                     */
.Layout Transaction;             /*  Provide layout name and     */
  .Field TransCode * Char(3);    /*  define the                  */
  .Field EmpNo     * Smallint;   /*  fields of                   */
  .Field DeptNo    * Smallint;   /*  the client record.          */
.DML Label Updates;              /*  This dml request            */
Update Employee                  /*  transfers employees         */
     set DeptNo = :DeptNo        /*  with an update              */
     where EmpNo  = :EmpNo;      /*  to change dept. number.     */
.DML Label Deletes;              /*  This dml request gets rid   */
Delete from Employee             /*  of employees by deleting    */
     where EmpNo  = :EmpNo;      /*  the employee from the table.*/
.DML Label Inserts;              /*  This dml request            */
Insert into History.*;           /*  Inserts the transaction     */
                                 /*  into the history table.     */
.Import Infile INPUT             /*  Identify import file        */
   Layout Transaction            /*  and record layout           */
   Apply Updates where           /*  condition for               */
   TransCode = 'TRA'             /*  transfer...                 */
Apply Deletes where              /*  condition                   */
   TransCode = 'BYE'             /*  for getting rid of          */
Apply Inserts;                   /*  unconditional history       */
.End Mload;                      /*  Initiate MLOAD processing   */
.Logoff;                         /*  Logoff Teradata Database    */