HI,
I have a created batch job today, while running it manually it works fine but while executing it by batch i am getting following error:
Error executing code: TextIo object not initialized.
(S)\Classes\TextIo\writeExp
(S)\Classes\productMaster\run - line 48
(S)\Classes\BatchRun\runJobStatic - line 63
the code which i have is
public void run()
{
int a;
;
/* dlg = new dialog(“PRODUCT MASTER”);
dlgg = dlg.addGroup(“DISTRIBUTOR ID”);
dlgf = dlg.addField(typeid(Name),“DISTRIBUTOR ID”);
dlgf.value(“10033”); */
ltCurrentDate = today();
//dlgf = dlg.addField(TypeID(TransDate),“To Date”);
// if(dlg.run())
// {
//FileName = @“D:\SOLOMAN\SCBDTL.TXT” ;
//LT rr commented to have different path
//FileName = @“C:\Principals\Consumer\ProdMaster.csv”;
/* LT rr new added */
ltDist = ‘10033’;
ltDate = date2str(ltCurrentDate,321,
DateDay::Digits2,DateSeparator::None,
DateMonth::Digits2,DateSeparator::None,
DateYear::Digits4);
ltFileName = strfmt("%1 PRODUCTMASTER %2" ,ltDist,ltDate);
FileName = strfmt(@“U:\ADMMI\%1.tab”,ltFileName);
// FileName = strfmt( @“C:\Principals\Consumer\%1.tab”,ltFileName);
permission = new FileIOPermission(filename, #IO_Write);
permission.assert();
//FileName = @“C:\SCBDTL.TXT” ;
file = new TextIO(FileName, #io_write);
//LT rr commented
//file.outFieldDelimiter(’;’);// for semicolon seperator
//LT rr
ltHeaders = [“Distributer_ID SKU_ID GSK_Code GSK_Description UOM” ];
file.writeExp(ltHeaders);
file.outFieldDelimiter(’ ');
if (!file || file.status() != IO_Status::Ok)
{
throw error(“File cannot be opened.”);
}
while select itemTable
Where itemTable.ADMInventAgencyId == ‘A007’
{
select custVendExternalItem where custVendExternalItem.ItemId == itemTable.ItemId
&& custVendExternalItem.ModuleType == ModuleInventPurchSalesVendCustGroup::Vend;
sno++;
DistID = ‘10033’;
SKUID = StrLRTrim(itemtable.ItemId);
GSKCODE = StrLRTrim(custVendExternalItem.ExternalItemId);
SKUDESC = StrLRTrim(itemtable.ItemName);
UOM = StrLRTrim(itemtable.inventUnitId());
line = [DistID, SKUID, GSKCODE, SKUDESC, UOM];
file.writeExp(line);
}
sno = 0;
// }
}
i have highlighted the code which is causing error:
Kindly guide me further to fix it!!!