IBM Support

Unloading Data to a PIPE Using SELECT Statement

Troubleshooting


Problem

This article describes how to unload data to a PIPE using the SQL SELECT statement .

Resolving The Problem

Q. How do I unload data to a pipe using a select statement?

A. Perform the following steps:

    1. From the command line type:

      mkfifo pipe

      Note: Use man pages to get more information about mkfifo and pipe.

    2. Use dbaccess to connect to a database and to run the select query using the following:

      DATABASE database_name;
      UNLOAD TO "pipe" SELECT * FROM table_name;

      database_name
        Database to use.
      table_name
        Table to unload.

    3. Use another terminal window to run the commands to make use of the piped information.

      Example:

      If you need to compress the output without first writing it to a file, you could use this command line to do so:

        cat pipe | compress | dd of=file.unl.Z
        file.unl.Z
          Compressed output file.

    4. Remove the pipe by using the following:

      rm pipe

Note: You can replace step 3 with other type of events.
      cat pipe > file.unl
[{"Product":{"code":"SSGU8G","label":"Informix Servers"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF025","label":"Platform Independent"},{"code":"PF008","label":"DYNIX\/ptx"},{"code":"PF010","label":"HP-UX"},{"code":"PF015","label":"IRIX"},{"code":"PF016","label":"Linux"},{"code":"PF026","label":"Reliant UNIX"},{"code":"PF027","label":"Solaris"}],"Version":"7.2;7.3;9.2;9.3;9.4;10.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

More support for:
Informix Servers

Software version:
7.2, 7.3, 9.2, 9.3, 9.4, 10.0

Operating system(s):
AIX, DYNIX/ptx, HP-UX, IRIX, Linux, Reliant UNIX, Solaris

Document number:
71439

Modified date:
16 June 2018

UID

swg21109735

Manage My Notification Subscriptions