is there any way to release locked table and delete error tables in case of failed mload script automatically using some command in same script.
You can call below bteq script before the start of your mload job.
--Check for existense of mload err tables
SELECT * FROM dbc.tablesV
WHERE databasename = '<DB_ERR>'
AND tablename in ('<tbname>_ET1','<tbname>_ET2','<tbname>_LT','<tbname>_WT');
.IF ACTIVITYCOUNT = 0 THEN .GOTO SUCCESS;
--Remove of mload err tables and release the lock
.SET ERRORLEVEL 3807 SEVERITY 0;
.SET ERRORLEVEL 2572 SEVERITY 0;
.SET ERRORLEVEL 2580 SEVERITY 0;
DROP TABLE <DB_ERR>.<tbname>_ET1;
DROP TABLE <DB_ERR>.<tbname>_ET2;
DROP TABLE <DB_ERR>.<tbname>_LT;
DROP TABLE <DB_ERR>.<tbname>_WT;
RELEASE MLOAD <DB_NAME>.<tbname>;
RELEASE MLOAD <DB_NAME>.<tbname> in apply;