Unfortunately this is not possible with Informix.
But it should be easy to implement, at least if you are working
on a Unix platform. Here is a sample shellscript which
simulates this behaviour.
However you might need to include more error checking functionality.
If you are not on a Unix based platform, it's time to change....
#!/usr/bin/ksh
if [ $# != 2 ]
then
echo "Usage: $0 <db_name> <tab_name>"
exit 1
fi
export DBACCNOIGN=1
DB_NAME=$1
TAB_NAME=$2
DATA_FILE="$DB_NAME.$TAB_NAME.dat"
HEADER_FILE="$DB_NAME.$TAB_NAME.hdr"
UNLOAD_FILE="$DB_NAME.$TAB_NAME.unl"
dbaccess -e $DB_NAME <<EOF
unload to $DATA_FILE
select * from $TAB_NAME;
unload to $HEADER_FILE
select sc.colname
from syscolumns sc, systables st
where sc.tabid = st.tabid
and st.tabname = "$TAB_NAME";
EOF
COL_HEADER="#"
for COL_NAME in $(cat $HEADER_FILE)
do
COL_HEADER="${COL_HEADER}${COL_NAME}"
done
echo $COL_HEADER > $UNLOAD_FILE
cat $DATA_FILE >> $UNLOAD_FILE
rm -f $DATA_FILE $HEADER_FILE > /dev/null 2>&1
echo "Database [$DB_NAME], Table [$TAB_NAME] unloaded to [$UNLOAD_FILE]"
exit 0