Awk appears to disconnect my DB2 session when piping
I'm attempting to run the following command in Korn Shell (ksh):

    set -A INDEXES `db2 "describe indexes for table ${TABSCHEMA}.${TABNAME} show detail" | awk '{print $1"."$2}'`

What I'm attempting to achieve is place a list of the indexes over a particular table into an array which I can later iterate through.

The problem is, when I run the above command the contents of the array starts with the error message of 'SQL1024N' (which is telling me that the database connection does not exist).

However, if I remove the 'awk' at the end of the statement as so:

    set -A INDEXES `db2 "describe indexes for table ${TABSCHEMA}.${TABNAME} show detail"`

it works just fine (well, to the extent its returning data. Obviously without the awk I'm not capturing the correct data).

Does anyone know why the awk is having this affect?

I appreciate there is more than one way to get this data, but it baffles me as to why this is happening.

Thanks in advance.

Greg.
Awk appears to disconnect my DB2 session when piping
===

I'm attempting to run the following command in Korn Shell (ksh):

    set -A INDEXES `db2 "describe indexes for table ${TABSCHEMA}.${TABNAME} show detail" | awk '{print $1"."$2}'`

What I'm attempting to achieve is place a list of the indexes over a particular table into an array which I can later iterate through.

The problem is, when I run the above command the contents of the array starts with the error message of 'SQL1024N' (which is telling me that the database connection does not exist).

However, if I remove the 'awk' at the end of the statement as so:

    set -A INDEXES `db2 "describe indexes for table ${TABSCHEMA}.${TABNAME} show detail"`

it works just fine (well, to the extent its returning data. Obviously without the awk I'm not capturing the correct data).

Does anyone know why the awk is having this affect?

I appreciate there is more than one way to get this data, but it baffles me as to why this is happening.

Thanks in advance.

Greg.