DBACCESS_COLUMNS environment variable
Posted in 2020
SangGyu Jeong asked about the undocumented DBACCESS_COLUMNS environment variable. Eric Vercelletto explained it makes dbaccess output one line per row at the given width (e.g. 1024); the limit appears to be 32768, as 32769 dumps core. Benjamin Thompson shared an alias using rlwrap, and Scott Pickett requested a docfix. The rest drifted to awk and Perl availability.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: Server Administration
Hi, The DBACCESS_COLUMNS environment variable doesn't seem to be found in the knowledge center. Does anyone know what the maximum value is? ------------------------------ SangGyu Jeong Software Engineer Infrasoft Seoul Korea, Republic of ------------------------------ #Informix
Hi SangGyu,
you are right: if you did not attend the Informix Roadshow ( Thanks Scott and Carlton for the great job!), you will never know about this simple but great feature.
For those who don't know about this new feature, it's an environment variable (export
DBACCESS_COLUMNS=1024) for instance, that display the dbaccess output in one line of (1024 screen columns here) maximum, instead of beyond 80 columns or some similar value, where the table columns value is displayed one line per column. I attach a screen dump so that you can see the result.
The limit seems to be 32768 (smallint) because at 32769 dbaccess returns a core dumped :-(
Sincerely, the code dumped is not a beautiful thing, but 32K is enough for me
------------------------------
[eric] [Vercelletto] []
[Founder]
[kandooerp.org]
[Pont l'Abbé] [France]
[+33 626 52 50 68]
Disclaimer: My own opinions are my own opinions and do not reflect on the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves.
------------------------------
Hi Eric, Thanks for the example and explanation. Before 12.10.xC9, this function was not provided, so I had to use unload, awk, and perl. (Of course I still use the old method) In fact, I think setting 1024 is enough to use. ------------------------------ SangGyu Jeong Software Engineer Infrasoft Seoul Korea, Republic of ------------------------------
Unless you have very good eyes, yes, you are right 1024 is a reasonable value About awk and perl, I was a great fan of awk in the 90's, until I discovered Perl for scripting. The great advantage of Perl is that it is 99.99% portable on different platforms, including Windows, beyond the fact it is a real language with tons of libraries(modules) I rewrote then ALL my utilities ksh/awk based to Perl. The con of Perl is that sometimes it may be somewhat difficult to read when it comes to elaborate regular expressions, but regexp are also a great value My 001 cents of contribution Eric Vercelletto Data Management Architect and Owner / Begooden IT Consulting Board of Directors, International Informix Users group IBM Champion 2013,2014,2015,2016,2017,2018,2019,2020 Tel: +33(0) 298 51 3210 Mob : +33(0)626 52 50 68 skype: begooden-it Google Hangout: eric.vercelletto@begooden-it.com Email: eric.vercelletto@begooden-it.com www : http://www.vercelletto.com www https://kandooerp.org ------Original Message------ Hi Eric, Thanks for the example and explanation. Before 12.10.xC9, this function was not provided, so I had to use unload, awk, and perl. (Of course I still use the old method) In fact, I think setting 1024 is enough to use. ------------------------------ SangGyu Jeong Software Engineer Infrasoft Seoul Korea, Republic of ------------------------------ #Informix
Not answering your question which was answered by Eric but in general usage this gives a good dbaccess experience (if using bash):
alias dbaccess=
'DBACCESS_COLUMNS=$COLUMNS rlwrap dbaccess'
If not using bash but still with Linux/Unix this may also work:
alias dbaccess=
'DBACCESS_COLUMNS=`tput cols` rlwrap dbaccess'
The use of rlwrap is not new but it may be a useful reminder it exists.
Ben.
------------------------------
Benjamin Thompson
------------------------------
Docfix has been requested and forwarded to the appropriate person. Scott Pickett IBM Informix WW Technical Sales IBM Informix WW Cloud Technical Sales IBM Informix WW Cloud Technical Sales ICIAE IBM Informix WW Informix Warehouse Accelerator Sales Boston, Massachusetts USA spickett@us.ibm.com 617-899-7549 33 Years Informix User The Informix Roadshow page is here: https://www.ibm.com/developerworks/mydeveloperworks/wikis/home?lang=en_US#/wiki/Informix%20Roadshow%20-%20Informix%20is%20Everywhere Shortcut to the Informix Roadshow Page: http://bit.ly/ifmx_roadshow All presentations and the agenda used by the Roadshow can be found there. The current ZACS Informix Page can be found here: https://w3-connections.ibm.com/wikis/home?lang=en#!/wiki/Wf58c4c538dbf_45b4_b7a7_5003d0ceb79b/page/Informix The older Internal IMAZ CTP Informix Main Page can be found here: https://w3-connections.ibm.com/wikis/home?lang=en-us#!/wiki/Info%20Mgmt%20Client%20Technical%20Professional%20Resources%20Wiki/page/Informix Website for Internet Of Things https://www.ibm.com/internet-of-things/ Website for Informix https://www.ibm.com/analytics/us/en/technology/informix/ ------Original Message------ Unless you have very good eyes, yes, you are right 1024 is a reasonable value About awk and perl, I was a great fan of awk in the 90's, until I discovered Perl for scripting. The great advantage of Perl is that it is 99.99% portable on different platforms, including Windows, beyond the fact it is a real language with tons of libraries(modules) I rewrote then ALL my utilities ksh/awk based to Perl. The con of Perl is that sometimes it may be somewhat difficult to read when it comes to elaborate regular expressions, but regexp are also a great value My 001 cents of contribution Eric Vercelletto Data Management Architect and Owner / Begooden IT Consulting Board of Directors, International Informix Users group IBM Champion 2013,2014,2015,2016,2017,2018,2019,2020 Tel: +33(0) 298 51 3210 Mob : +33(0)626 52 50 68 skype: begooden-it Google Hangout: eric.vercelletto@begooden-it.com Email: eric.vercelletto@begooden-it.com www : http://www.vercelletto.com www https://kandooerp.org #Informix
Hi Ben, Thanks for reply.
rlwrap is a really useful utility! This utility seems to have been released quite a long time ago, but I saw it for the first time today. (Lazy with new technology?)
I am used to running the command like echo "select * from customer "| dbaccess stores_demo at the OS prompt and then reusing the old commands with the j, k keys.
------------------------------
SangGyu Jeong
Software Engineer
Infrasoft
Seoul Korea, Republic of
------------------------------
@Scott Pickett that is a good news! ------------------------------ SangGyu Jeong Software Engineer Infrasoft Seoul Korea, Republic of ------------------------------
The other con for Perl is it not always available at all customers, awk/sed etc always are there Cheers Paul ------Original Message------ Unless you have very good eyes, yes, you are right 1024 is a reasonable value About awk and perl, I was a great fan of awk in the 90's, until I discovered Perl for scripting. The great advantage of Perl is that it is 99.99% portable on different platforms, including Windows, beyond the fact it is a real language with tons of libraries(modules) I rewrote then ALL my utilities ksh/awk based to Perl. The con of Perl is that sometimes it may be somewhat difficult to read when it comes to elaborate regular expressions, but regexp are also a great value My 001 cents of contribution Eric Vercelletto Data Management Architect and Owner / Begooden IT Consulting Board of Directors, International Informix Users group IBM Champion 2013,2014,2015,2016,2017,2018,2019,2020 Tel: +33(0) 298 51 3210 Mob : +33(0)626 52 50 68 skype: begooden-it Google Hangout: eric.vercelletto@begooden-it.com Email: eric.vercelletto@begooden-it.com www : http://www.vercelletto.com www https://kandooerp.org #Informix
@Paul Watson Yes. I'd like to use perl or python in the customer's production environment if possible, but most of them are not installed or have different versions. So, I tend to use the utility (awk, sed..etc) installed by default. :) Of course, the story would be different on a system that I manage myself! ------------------------------ SangGyu Jeong Software Engineer Infrasoft Seoul Korea, Republic of ------------------------------
Exactly Paul. The only problem is that there are at least five flavors of AWK with different capabilities. Just because I am bored, here is a rundown. Feel free to ignore it: AIX's awk - based on the original BSD code, this is the least capable of the awkers with some features of the awk specification that are broken. In particular the '-v var=value' option is broken. Solaris's awk - based on the original AT&T System V code, this is a bit better. mawk - a fork from an early GNU awk release. Not sure what it can and cannot do. nawk - a more advanced awker available on nearly both AIX and Solaris. Almost as good as GNU awk, but fewer extensions. GNU awk (gawk on some systems) fully functional to the System V awk specification with many many extensions. However, using the extensions makes your awk scripts less portable. GNU awk is usually installed on AIX and the native awk on Linux. On Solaris you may have to install the GNU package separately. Art Art S. Kagel, President and Principal Consultant ASK Database Management www.askdbmgt.com Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. ------Original Message------ The other con for Perl is it not always available at all customers, awk/sed etc always are there Cheers Paul #Informix
Multiple versions of sed as well, the solaris one does't support the –i option – very annoying J ------Original Message------ Exactly Paul. The only problem is that there are at least five flavors of AWK with different capabilities. Just because I am bored, here is a rundown. Feel free to ignore it: AIX's awk - based on the original BSD code, this is the least capable of the awkers with some features of the awk specification that are broken. In particular the '-v var=value' option is broken. Solaris's awk - based on the original AT&T System V code, this is a bit better. mawk - a fork from an early GNU awk release. Not sure what it can and cannot do. nawk - a more advanced awker available on nearly both AIX and Solaris. Almost as good as GNU awk, but fewer extensions. GNU awk (gawk on some systems) fully functional to the System V awk specification with many many extensions. However, using the extensions makes your awk scripts less portable. GNU awk is usually installed on AIX and the native awk on Linux. On Solaris you may have to install the GNU package separately. Art Art S. Kagel, President and Principal Consultant ASK Database Management www.askdbmgt.com Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. #Informix
@Paul Watson I may have been lucky for the 10 last years, but I NEVER had to face lack of perl on any system. The only case I had was windows, where installing Strawberry perl worked great (customer was ok with that) I did a bit everything like AIX, Solaris, Linux all flavors and hp-ux I was about to think as you did, but never had this issue. Curious to know on which platform you did nont have perl ? ------Original Message------ The other con for Perl is it not always available at all customers, awk/sed etc always are there Cheers Paul #Informix
I am not saying it doesn't exist on platforms, just that is not installed and not allowed to be installed.
OAT/InformixHQ are all great (enough), but if you are not allowed to install them then you are back to the "always there" tools, dbaccess and onstat etc
------Original Message------
The other con for Perl is it not always available at all customers, awk/sed etc always are there
Cheers
Paul
#Informix