1

When using the Informix isql UI, if the result of a select statement exceeds the width of your display, the output displays vertically on the screen.

1st col_1
1st col_2
1st col_3

2nd col_1
2nd col_2
2nd col_3

etc

However, if the width of the display is big enough, it will display the results horizontally.

1st col_1                  1st col_2                1st col_3
2nd col_2                  2nd col_2                2nd col_3
etc.

If the same query is issued from a command line: echo "select col_1, col_2, col_3" | isql -s dbname, there doesn't seem to be a way to make it recognize that the display is wide enough to fit all the data horizontally. I believe it uses a default of 80 columns.

If anybody has this knowledge, I would like to know how to make isql from a command line recognize the full width of the screen, either automatically, by passing an argument, or perhaps in some Informix config. Using the COLUMNS environment variable doesn't help, nor does stty columns.

Thank you, Rich

a1_rich
  • 11
  • 1
  • 3

2 Answers2

1

There isn't a way to do it reliably. Actually, there really isn't a way to do it unreliably, either. I see that you've tried setting the environment variables COLUMNS and (perhaps) LINES, but isql seems to ignore them. You could try hacking your termcap or terminfo entry so it says however many columns you have, but it is far from ideal (and still might not work).

If you want uniform, predictable output, use SQLCMD from the IIUG Software Archive (which is not the Microsoft johnny-come-lately program of the same name!).

For general reference: which version of ISQL are you using, on which platform, and which version of the Informix DBMS are you working against? It is always helpful to include that information in the question. For example, "ISQL 7.50.FC3 with IDS 11.50.FC6 on Solaris 10".

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
1

I'm going to assume your'e using ISQL 7.50 or earlier on whatever platform: When you say ISQL UI, I'm also assuming the menu driven editor?.. as in 'isql dbname -qr sqlproc.sql'.

so in your sqlproc.sql, perhaps you could try playing with the OUTPUT statement or pipe your above example to a program which could provide you the desired formatting:

OUTPUT TO [PIPE program] /usr/frank/query1 [WITHOUT HEADINGS]
SELECT col_1, col_2, col_3 FROM tabname;

Since you are using ISQL, your other alternative, and probably your best option, would be to use the ACE report writer to customize the output format to your desire!

FORMAT

ON EVERY ROW

PRINT COLUMN  1, col_1,
      COLUMN 20, col_2,
      COLUMN 40, col_3
Joe R.
  • 2,032
  • 4
  • 36
  • 72
  • @Jonathan: thank you!.. although a1_rich stated he wants to control formatting from, I assume Linux command line. Perhaps he could do 'sacego aceprog params' from the commad line?.. Happy Holidays Jonathan and to all stackexchange members! – Joe R. Dec 24 '10 at 02:43