Building SQL queries

SQL queries are used when downloading one or more files to your PC. An SQL query allows you to select specific records, how they are sorted, and how they are grouped. You can enter the SQL query directly into the edit box or use the SQL Query Options dialog to create SQL queries.

  1. Start an iSeries Display session.
  2. Click Transfer Send/Receive.
  3. In the Host File Transfer window, click Transfer Transfer Setup.
  4. Click the SQL tab.
  5. There are two method to building SQL queries:
    • Type the SQL query directly in the SQL Query field. Click OK when finished.
    • Click Options to connect to the server and retrieve the field information for each file selected. Continue to step 6.
  6. Click Options to connect to the server.
  7. Log in to the host or click Cancel.
  8. Build your SQL Query statements in the SQL Query Options window.
    Each tab in the SQL Query Options window represents an SQL query condition:
    • Select: Determines which fields to transfer. Required.
    • Where: One or more conditions that must occur for a record to be transferred.
    • Group by: Separates the result data into more than one group.
    • Having: One or more conditions that must occur by each summary record to be transferred.
    • Order by: Specifies an order in which to return the rows.
    • Join by: Specifies how the data from multiple files is combined.
    Each clause must be on a separate line. The default SQL query of SELECT * is used when there is no custom SQL query configured. For example:
    SELECT *
    WHERE (t1.IMITM = t2.IMITM)
  9. Click OK to save and close the SQL Query Options window.
  10. Click OK to save and close the Transfer Setup window.