title: import/export CSV in IBM i (AS400) DB2
body: <p>I'm preparing for an upcoming integration project where I need to import/export some data to/from our ERP into the File System. We run JD Edwards World 9.2 on an IBM iSeries/AS400 V6R1 machine.</p>
  
  <p>The software we are integrating with, requires that we integrate using CSV files  that are exported/imported on a schedule and accessible via SFTP. </p>
  
  <p>I have zend server (apache) installed and am happy using Apache, PHP and SQL but have virtually zero knowledge of CL and RPG programming (but willing to learn). We have no WebQuery either. The files exported require data between tables to be joined and filtered, so will need SQL or similar, so not a straight CPYTOIMPF i expect.</p>
  
  <p>As a very rough outline I was thinking I could write a quick php file that would run an sql query to parse the results to a csv in IFS and vice-versa, loaded by a cron'd wget (or ibm equivalent). </p>
  
  <p>Before I start, I want to see if anyone could recommend a better approach</p>
  
  <p>What strategies and/or links you would you recommend? What are the cron and wget equivalents?</p>