passing parameters to mload

Tools & Utilities

passing parameters to mload

Hi guys,

I donot know the syntax for passing parameter to mload.

I am trying to pass two strings as parameter to mload script file and use these string parameters in the script.

something like mload [TableName, SOURCEFILENAME] <Path of sourcefilename.

Here is my scenario:

This is the part of mload script where i want to use the passed string(in INSERT STAMENT below). In TestTable(Teradata table) , there is a column called stream which contains the source file name from which data is loaded into TestTable in Teradata.

In this case the source file name is 'Caliente' which is entered manually in the insert statement below.

There are many source files like these from which i need to extract data from and put the corresponding source file name in Stream column. So as first step i would like to pass the source file name as parameter to mload while calling the file that contains the script.

INSERT INTO "TestTable " ( Dance_ID, Delete_Flag, Cat_ID, Non_Music,
Mark_Status, Run_Time, Daypart, Add_Date,
Add_Date_DATE, Add_Date_TIME, Del_Date,
Del_Date_DATE, Del_Date_TIME, Cat_Plays,
Lib_Plays, Old_Skips, Old_Fails,
Perf_Count, Rot_Weight, Max_Daily,
Old_Start, Old_Kill, Kill_Plays,
Simulcast, Tag_Along, Packet_ID,
Audio_Ptr, Master_Ptr, Edit_Date,
Edit_Date_DATE, Edit_Date_TIME, Move_Date,
Move_Date_DATE, Move_Date_TIME, Move_Cat,
Start_Hour, Start_Hour_DATE,
Start_Hour_TIME, Kill_Hour,
Kill_Hour_DATE, Kill_Hour_TIME, Stream )
VALUES ( :Dance_ID, :Delete_Flag, :Cat_ID, :Non_Music, :Mark_Status,
:Run_Time, :Daypart, :Add_Date, :Add_Date_DATE,
:Add_Date_TIME, :Del_Date, :Del_Date_DATE, :Del_Date_TIME,
:Cat_Plays, :Lib_Plays, :Old_Skips, :Old_Fails, :Perf_Count,
:Rot_Weight, :Max_Daily, :Old_Start, :Old_Kill, :Kill_Plays,
:Simulcast, :Tag_Along, :Packet_ID, :Audio_Ptr, :Master_Ptr,
:Edit_Date, :Edit_Date_DATE, :Edit_Date_TIME, :Move_Date,
:Move_Date_DATE, :Move_Date_TIME, :Move_Cat, :Start_Hour,
:Start_Hour_DATE, :Start_Hour_TIME, :Kill_Hour,
:Kill_Hour_DATE, :Kill_Hour_TIME, 'Caliente' ) ;

The other string parameter should be used to specify the source file name in import infile statement. In this case:(see the code below)
instead of C:\TD_ETL\ACEESS_ FILES_TEST\TestTable _Caliente.amj i should have C:\TD_ETL\ACEESS_ FILES_TEST\SOURCEFILENAME.amj where SOURCEFILENAME is other parameter passed in the mload.

.IMPORT INFILE "C:\TD_ETL\ACEESS_ FILES_TEST\TestTable_Caliente.amj"
AXSMOD Oledb_Axsmod 'noprompt'
LAYOUT Layout1
APPLY LabelA ;

Thanks in advance..
2 REPLIES

Re: passing parameters to mload

If possible try scripting this and use the script do it. I'm not really sure if you can pass parameters to mload.

Re: passing parameters to mload

Thanks for the reply..

I am trying to write windows script(not allowed to use shell scripts) to identify total number of source files and run a loop for this number.

I will use something like xxxxx in place of source file name and yyyy in place of the source file name path.

Every time this loop runs, it looks for the mload script file and replaces xxx with the source file name and yyy with source file name path. It then executes the mload script for each loop run.

I am not familiar with the scripting though. i should look for proper syntax to find the number of files in a directory, searching a file, replacing any character in specified file etc. Any suggestions will be appreciated..