×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
I based this on some example I saw online.
Use it for column text as a CSV header row, combining rows of text into one column like customer comments or multiple email addresses assigned to a customer - typically with a pipe delimiter.
It's such a handy function.
select listagg(cast(column_text as varchar(64)), ' , ')
within group(order by ordinal_position) as coltext
from qsys2.syscolumns
where table_schema = < your lib >
and table_name = < your pf >
-----Original Message-----
From: OpenSource <opensource-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Richard Schoen
Sent: Saturday, December 4, 2021 10:08 AM
To: opensource@xxxxxxxxxxxxxxxxxx
Subject: Re: [IBMiOSS] Beginner Python Question about Db2 to Excel
Hey Roger,
Would love to see a sample of what you're describing.
Regards,
Richard Schoen
Web:
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.richardschoen.net%2F&data=04%7C01%7C%7C61a92f819fbb4954ca4308d9b75108df%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637742380953974594%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=DyYNVzxiIIPo6o6zK9bu7UCHRBGbOEQ5CrmJ9igYz40%3D&reserved=0
Email: richard@xxxxxxxxxxxxxxxxx
------------------------------
message: 4
date: Fri, 3 Dec 2021 23:47:45 +0000
from: Roger Harman <roger.harman@xxxxxxxxxxx>
subject: Re: [IBMiOSS] Beginner Python Question about Db2 to Excel
I do this all the time in DB2 SQL but I'm creating CSV's.
I use List_Agg() to get all the data from syscolumns in one CSV row. Our DB is standardized around the TEXT() info not COLHDG() but the concept would be similar.
You'll probably want to be sure to "order by ordinal_position" to get them in the right sequence.
I'll be interested in seeing the Python solution with COLHDG() and formatting them as multi-line headers in Excel.
Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power
As an Amazon Associate we earn from qualifying purchases.