To append column names to a table using db2 and shell script
# Get all the columns seperated with comma.
Col_names=$(db2 -x "select colname||',' from syscat.columns where tabname = '$TABLENAME' order by colno")
#Put all the columns in a text file
echo $Col_names > columns.txt
#Export table data to csv which you want to append columns
db2 "EXPORT TO $HOME/$TABLENAME.csv OF DEL MESSAGES $HOME/$TABLENAME.txt select * from $SCHEMA.$TABLENAME"
#Append columns to Table
cat columns.txt $HOME/$TABLENAME.csv > $HOME/newfile.csv