Sample Utility Scripts

Fexp :

.ROUTE MESSAGES WITH ECHO TO FILE 'log_file' ;  
.DATEFORM ANSIDATE;  
.RUN FILE logon_file

.LOGTABLE tabnam;
.BEGIN EXPORT   
TENACITY 4  
SESSIONS 5  
SLEEP 6;  
.EXPORT OUTFILE 'outfile name and locations' MODE RECORD FORMAT TEXT;

'SQL Query .You can concatenate all fields and then cast them to particular length to avoid Junk Characters '
) X
;


.END EXPORT;  
  
.LOGOFF;
--
Fast load

dateform ANSIDATE;
errlimit 1000000;
tenacity 4;       
sessions 10;
sleep 6;
.LOGON ipaddress/logon,password;
DROP TABLE .ET_tab1 ;
DROP TABLE .UV_tab2;
DELETE FROM STG_tab3;
SET RECORD VARTEXT "|";
define
 Field1 (VARCHAR(10))
 Field2(VARCHAR(18))
 Field3 (VARCHAR(20))


 file=:CF.ImportFileName;
show;
begin loading STG_tab3 errorfiles ET_tab1, .UV_Tab2
checkpoint 25000000 ;
insert into STG_tab3 (
Filed1,
Field2,
Field3
) VALUES (
 :Field1,
 :Filed2,
 :Filed3
) ;
end loading;
logoff;
--
MLOAD

.ROUTE MESSAGES WITH ECHO TO FILE 'LoaderLog' ;
.dateform ansidate ;
.RUN FILE logon_file ( .LOGON ipaddress/logon,password;)

.logtable log_Table ;
DROP TABLE work_table;
DROP TABLE error table ;
DROP TABLE uv_table;
DELETE FROM stg_mtg_solicithist_dmce;
.begin import mload tables stg_mtg_solicithist_dmce
worktables  work_table
errortables error table
     uv_table
errlimit 0
checkpoint 100000
tenacity 10000
sessions 10
sleep 6
;
.layout InputFileLayout;
.field field1               * varchar(100) ;
.field field2                * varchar(100) ;
.field field3                   * varchar(100) ;

.dml Label tagDML ;
insert into stg_mtg_solicithist_dmce
(
field1              
,field2               
,field3                  
 
)
values
(
:field1              
,:field2               
,:field3                  
         
) ;
.import infile 'input_file_location'
layout InputFileLayout
 Format vartext' '
 Apply tagDML
;
.end mload ;
.logoff ;

Comments

Popular posts from this blog

Macro to generate Mload Script

Finding Skewed Tables in Teradata

The Secret behind A B I N I T I O.