Scenario: Exporting data in CSV format

You can use the EXPORT command to retrieve data and view it in a spreadsheet format.

About this task

Suppose that a colleague wants to know which of your sales representatives sold less than $1000 of your product so far in the third quarter. Your colleague wants the information about these sales representatives in comma-separated value (CSV) format so that the data can be viewed and manipulated in a spreadsheet program. First, you must run a query to retrieve the information. Then, you can export the data in CSV format and download the CSV file to your workstation.

Procedure

To retrieve and export the data in CSV format:

  1. From the QMF home panel, press the Query function key.
  2. Enter the following query:
    SELECT * FROM SALESTOTALS WHERE Q3 < 1000
  3. Press the Run function key.
  4. On the command line of the QMF home panel, enter the following command:
    EXPORT DATA TO Q3SALES (DATAFORMAT=CSV

    The data is exported to a data set named userid.Q3SALES.DATA.

    By default, column headings are exported along with the data. To exclude the headings, you can use the HEADER option, as in the following example:
    EXPORT DATA TO Q3SALES (DATAFORMAT=CSV HEADER=NO

Downloading the exported data

About this task

You can now download the data to your workstation in CSV format.

Procedure

To download the exported data to your Windows workstation:

  1. Open a DOS command prompt.
  2. Navigate to the directory where you want to download the file:
    cd C:\mycsv
  3. Open a connection to your z/OS® host:
    ftp host.name
  4. Enter your user name:
    User <host>: userid
  5. Enter your password:
    Password: password
  6. Transfer the file to your workstation:
    get userid.q3sales.data q3sales.csv

    The data is downloaded to your workstation as C:\mycsv\q3sales.csv.

Results

When you open the CSV file, your spreadsheet program might require you to specify the type of column separator that the file uses. The column separator that QMF uses is determined by the DECIMAL option of your QMF profile. If the DECIMAL option is set to PERIOD, the column separator is a comma. If the DECIMAL option is set to COMMA or FRENCH, the column separator is a semicolon.