Is it possible to include the table column names in the unload dataset when executing Fast Unload?
search cancel

Is it possible to include the table column names in the unload dataset when executing Fast Unload?

book

Article ID: 35852

calendar_today

Updated On:

Products

Fast Unload for DB2 for z/OS

Issue/Introduction

Is it possible to include the Db2 table column names within the same unload dataset as the unloaded data when
executing Fast Unload for Db2 for z/OS (PFU)?

Resolution

PFU does not have a automated method to write the table column names to the unload / SYSREC dataset. 
Recommend the following method in PFU to complete this request:

The first SELECT are the column name literals and table creator.DUMMY is a stub table with 1 column and 1 row to facilitate unloading of the column name literals.
Table creator.TABLE1 is the actual table to be unloaded.

//SYSREC DD DSN=
.
.
//SYSIN DD *
FASTUNLOAD
LOAD-CONTROL NONE
OUTPUT-FORMAT COMMA-DELIMITED
SQL-ACCESS NONE
AUTO-TAG-SIZE 0
OBJ-ORDER NONE
ONE-SYSREC
INPUT-FORMAT TABLE
SHRLEVEL REFERENCE
SELECT 'COLA', 'COLB' FROM creator.DUMMY;
SELECT * FROM creator.TABLE1;