Updating database file based on .csv
Posted: Tue Dec 30, 2014 1:55 pm
I am trying to update a database file based on data in a .csv file I am getting from the ifs. Below is the xml from my project. Can you tell me why my sql does not update the file? The accounts in the .csv are in the database file.
Code: Select all
<project name="Acct-REP-REP1" mainModule="Main" version="2.0" logLevel="verbose">
<description>Update sales rep and alternate rep for an account</description>
<module name="Main">
<createWorkspace version="1.0" />
<ftp label="Connect to FTP server" resourceId="iSeries" version="1.0" disabled="false">
<get label="Get CSV File" destinationDir="/updates/Account_SalesRep_AltRep/archive" whenFileExists="rename" destinationFilesVariable="csvFile">
<fileset dir="/updates/Account_SalesRep_AltRep">
<wildcardFilter>
<include pattern="*.csv" />
</wildcardFilter>
</fileset>
</get>
</ftp>
<readCSV label="Read CSV File" inputFilesVariable="${csvFile}" outputRowSetVariable="csvData" skipFirstRow="true" recordDelimiter="CRLF" version="1.0">
<data trim="both" dateFormat="MM/dd/yyyy" timeFormat="HH:mm:ss" timestampFormat="MM/dd/yyyy HH:mm:ss.SSS">
<column index="1" name="ACT" size="9" type="NUMERIC" />
<column index="2" name="REP" size="5" type="NUMERIC" />
<column index="3" name="REP1" size="5" type="NUMERIC" />
</data>
</readCSV>
<sql label="Connect to DB" resourceId="iSeriesData" autoCommit="true" user="QSECOFR" password=" " version="1.0" logLevel="normal">
<query label="Update Data" inputRowSetVariable="${csvData}">
<statement>UPDATE DASTEST.IMCUSTFL SET MCREP# = ?, MCREP1 = ? WHERE MCACT# = ?</statement>
<param index="1" mapFrom="2" />
<param index="2" mapFrom="3" />
<param index="3" mapFrom="1" />
</query>
</sql>
<delete label="Delete File from IFS" file="${csvFile}" version="1.0" disabled="true" />
<deleteWorkspace version="1.0" />
</module>
</project>