BTEQ Import Latest Flat File

Tools & Utilities

BTEQ Import Latest Flat File

Hello experts,

I am using BTEQ and need some help to create a solution to dynamically pick a pipe delimited file based on the latest time stamp. I have heard about the .OS RM command but will delete file after the processing is complete. Are there ways to pick up the latest file? If .OS RM is the only way then how to best add that to the script below with out negatively impacting the performance? Thanks for your help in advance

--===============================

.logmech LDAP

.logon tdserver/userid,userpassword

 

.IMPORT vartext '|' FILE = 'C:\Users\johndoe1\Desktop\TEST_IX_78.txt', skip = 1;

 

.PACK 100

 

.REPEAT *

USING 

(

COL1  VARCHAR(100), 

COL2  VARCHAR(100), 

COL3  VARCHAR(100),

COL4 VARCHAR(100), 

COL5  VARCHAR(100), 

COL6  VARCHAR(100)

)

INSERT INTO schema.table_name

(

:COL1, 

:COL2, 

:COL3,

:COL4, 

:COL5 , 

:COL6

);

 

.QUIT;