Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 259537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:16:20+00:00 2026-05-11T22:16:20+00:00

I am attempting to run the following command in KornShell (ksh): set -A INDEXES

  • 0

I am attempting to run the following command in KornShell (ksh):

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

What I am 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 it is returning data. Obviously without the awk I am 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:16:20+00:00Added an answer on May 11, 2026 at 10:16 pm

    In this case, when the DB2 CLP says that it’s not connected to the database, it’s because the shell has opened up a sub-process that requires its own dedicated db2bp backend process, which cannot access the connection opened by the original shell process. It’s not that something is becoming disconnected, it’s that a newly created shell process (and its accompanying db2bp process) are being created but aren’t being told to connect to a database.
    One way to remedy this is to explicitly connect (or re-connect) to the database when you know you’re in one of those situations.

    set -A INDEXES `db2 connect to watevrDB >/dev/null;db2 -x describe indexes for table ${TABSCHEMA}.${TABNAME} show detail | awk {'print $1"."$2'}`
    

    I realize that this question is more about scripting and awk with DB2 than about the system catalog, or else I would have recommended some straightforward catalog queries to produce the same result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 252k
  • Answers 252k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer M-x replace-regexp invokes the function to replace with regular expressions.… May 13, 2026 at 9:41 am
  • Editorial Team
    Editorial Team added an answer There aren't really any. Everything is torn down on termination,… May 13, 2026 at 9:41 am
  • Editorial Team
    Editorial Team added an answer First, I'd recommend to upgrade to Scipy svn if possible… May 13, 2026 at 9:41 am

Related Questions

I am attempting to a get a isolated build environment setup in my dev
I am on a Windows Vista 64-bit Enterprise machine with Subsystem for Unix Applications
The following code implements a simple singleton that ensures only 1 instance of my
I work for a company that offers webhosting and DNS services. We are trying

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.