M-load Error while executing script

Teradata Applications
Enthusiast

M-load Error while executing script

Hi All,

 

When executing the below script for MLOADm getting the below error:

 

output:

$ ./multiload.sh

./multiload.sh: .LOGTABLE:  not found.

./multiload.sh[2]: .logon:  not found.

./multiload.sh[4]: .begin:  not found.

./multiload.sh[5]: .layout:  not found.

./multiload.sh[6]: 0403-057 Syntax error at line 6 : `(' is not expected.

 

======= Script Starts Here===============

Multiload.sh:

 

.logtable ETLT5.INFA_SOURCE12_LOG

.logon ttdbia/a0c9sx,blue@126;

drop table ETLT5.INFA_SOURCE12_ET

 drop table ETLT5.INFA_SOURCE12_UT

 drop table ETLT5.INFA_SOURCE12_UV

 drop table ETLT5.INFA_SOURCE12_WT

.begin import mload tables ETLT5.INFA_SOURCE12 SESSIONS 20;

.layout InputFile_layout;

 .field id * varchar(10);

 .field Name * varchar(20);

 .field country * varchar(30);

.dml label Table_InsertDML;

.insert into ETLT5.INFA_SOURCE12

 (

id

 ,Name

 ,country 

 )

 values

 (

:id

 :,Name

 :,country 

 );

.import infile /nas/infred/data/SrcFiles/fastload.txt

 format vartext  ','

 display errors

 nostop

 layout InputFile_Layout

 apply Table_InsertDML;

.end mload;

 .logoff;

 

Please help me in this .Thanks in Advance :)

 

Tags (1)
9 REPLIES
Enthusiast

Re: M-load Error while executing script

Please help me guys !!

Senior Apprentice

Re: M-load Error while executing script

Each MLoad command must be preceded by a period and must end with a semicolon.

Each Teradata SQL command must not be preceded by a period and must end with a semicolon.

Enthusiast

Re: M-load Error while executing script

Thanx Dnoeth,

changed my script according to what you have mentioned but stiil facing the same errors.

Senior Apprentice

Re: M-load Error while executing script

Show your exact script and how you call it on command line.

Enthusiast

Re: M-load Error while executing script

Here my MLOAD Script (mulitload.sh):

.LOGTABLE ETLT5.LOG_INFA;

.logon ttdbia/a0c9sx,blue@126;

.begin import mload tables ETLT5.INFA_SOURCE12 ;

.layout InputFile_layout;

.field id * varchar(10);

.field Name * varchar(20);

.field country * varchar(30);

.dml label Table_InsertDML;

insert into ETLT5.INFA_SOURCE12

(

id

,Name

,country

 

)

values

(

:id

:,Name

:,country

);

.import infile /nas/infred/data/SrcFiles/fastload.txt

format vartext ','

display errors

nostop

layout InputFile_Layout

apply Table_InsertDML;

.end mload;

.logoff;

 

How i'm Calling:

$ ./multiload.sh

 

Output:



./multiload.sh: .LOGTABLE:  not found.

./multiload.sh[2]: .logon:  not found.

./multiload.sh[4]: .begin:  not found.

./multiload.sh[5]: .layout:  not found.

./multiload.sh[6]: 0403-057 Syntax error at line 6 : `(' is not expected.

 

 

Senior Apprentice

Re: M-load Error while executing script

That's a shell script, but not an MLoad script, the Unix shell complains about missing commands like ".LOGTABLE"

If you don't use shell features you run it using

mload < multiload.sh

If you want to run it standalone ("./multiload.sh") you must use Unix inline redirection:

mload << EOF

all your existing code here

EOF
Enthusiast

Re: M-load Error while executing script

IT WORKED !!!

Thanx  a lot  Dieter i tried with the second option given by you .

(mload<multiload.sh ) what this thing exactly means?

Senior Apprentice

Re: M-load Error while executing script

That's the standard way to pass a script to a command line utility in Unix/Linux/Windows.

https://en.wikipedia.org/wiki/Redirection_(computing)

Enthusiast

Re: M-load Error while executing script

Thanx Dieter :)