static void RB_ReadCsvFile(Args _args)
{
#File
IO iO;
CustAccount custAccount;
CustName custname;
CustGroupId custgroup;
CustCurrencyCode currency;
FilenameOpen filename = "c:\\Customers.csv";
Container record,c;
boolean first = true;
int len;
;
iO = new CommaTextIo(filename,#IO_Read);
//len = conLen(c);
//info(strFmt("%1",len));
if (! iO || iO.status() != IO_Status::Ok)
{
throw error("@SYS19358");
}
while (iO.status() == IO_Status::Ok)
{
record = iO.read();
if (record)
{
if (first) // to exclude the header
{
first = false;
}
else
{
custAccount = conpeek(record, 1);
custgroup = conpeek(record, 2);
currency = conPeek (record,3);
info(strfmt('%1--%2--%3',custAccount,custgroup,currency));
}
}
}
}
======================================================================
static void WriteCsvFile(Args _args)
{
CommaIo fileOut;
FileName fileName = "c:\\Customers.csv";
CustTable custTable;
;
#File
fileOut = new CommaIo(filename, #io_write);
if (fileOut)
{
while select custTable
{
fileOut.write(custTable.accountNum,
//custTable.name,
custTable.custGroup,
custTable.currency);
}
}
}
{
#File
IO iO;
CustAccount custAccount;
CustName custname;
CustGroupId custgroup;
CustCurrencyCode currency;
FilenameOpen filename = "c:\\Customers.csv";
Container record,c;
boolean first = true;
int len;
;
iO = new CommaTextIo(filename,#IO_Read);
//len = conLen(c);
//info(strFmt("%1",len));
if (! iO || iO.status() != IO_Status::Ok)
{
throw error("@SYS19358");
}
while (iO.status() == IO_Status::Ok)
{
record = iO.read();
if (record)
{
if (first) // to exclude the header
{
first = false;
}
else
{
custAccount = conpeek(record, 1);
custgroup = conpeek(record, 2);
currency = conPeek (record,3);
info(strfmt('%1--%2--%3',custAccount,custgroup,currency));
}
}
}
}
======================================================================
static void WriteCsvFile(Args _args)
{
CommaIo fileOut;
FileName fileName = "c:\\Customers.csv";
CustTable custTable;
;
#File
fileOut = new CommaIo(filename, #io_write);
if (fileOut)
{
while select custTable
{
fileOut.write(custTable.accountNum,
//custTable.name,
custTable.custGroup,
custTable.currency);
}
}
}
No comments:
Post a Comment