× 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.



This is the shell I start with for Q&D exports. Nothing fancy, but 90% of the time I just create my headers and query, and let it run. Indentation is significant in python, so posting on code.midrange also. https://code.midrange.com/f414e204ed.html Switching to open source list and directly copying Art since I'm not sure if he is on there or not.

#!/usr/bin/env python3

import ibm_db_dbi as db2
import xlsxwriter as xl

query = "select cusnum, lstnam, init, cdtlmt from qiws.qcustcdt where cdtlmt > 100"


conn = db2.connect()
cur = conn.cursor()
cur.execute(query)

wb = xl.Workbook('sample.xlsx')
ws = wb.add_worksheet('Uno')

# Header row
header = wb.add_format()
header.set_bold()
ws.set_row(0,None,header)
ws.write(0,0,'Account')
ws.write(0,1,'Last Name')
ws.write(0,2,'Initials')
ws.write(0,3,'Credit Limit')

for row_num, row_data in enumerate(cur):
for col_num, value in enumerate(row_data):
ws.write(row_num + 1,col_num, value)
wb.close()


On Tue, 2021-11-16 at 15:23 -0500, Art Tostaine, Jr. wrote:
If we have to add a field to an old query we don't generally rewrite the
code/technique. Any new excel spreadsheet requests are always just written
directly as a CSV from RPG/SQL or whatever language we are using to extract
the data.

I recently tried to write an XSLX natively but didn't get very far. I'd
have to search out a simple example in Python to help me get started.

On Tue, Nov 16, 2021 at 2:47 PM Rob Berendt <rob@xxxxxxxxx<mailto:rob@xxxxxxxxx>> wrote:

Time, not timestamp.

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 7310 Innovation Blvd, Suite 104
Ft. Wayne, IN 46818
Ship to: 7310 Innovation Blvd, Dock 9C
Ft. Wayne, IN 46818
http://www.dekko.com


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx<mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx>> On Behalf Of
Larry "DrFranken" Bolhuis
Sent: Tuesday, November 16, 2021 2:43 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>>;
John Yeung <gallium.arsenide@xxxxxxxxx<mailto:gallium.arsenide@xxxxxxxxx>>
Subject: Re: Query/400

CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know
the content is safe.


Cool, 86400 rows per day and I sell disk. :-)
Now, anybody need ms?
- DrF

On 11/16/2021 1:30 PM, John Yeung wrote:
On Tue, Nov 16, 2021 at 12:19 PM Rob Berendt <rob@xxxxxxxxx<mailto:rob@xxxxxxxxx>> wrote:

It's still a technique being pushed today for use everywhere and not
just Query/400.

https://db2ibmi.blogspot.com/2021/08/speed-dating-your-legacy-dates.html

Yeah. I pushed it on another thread just a few days ago.

However, OP is asking for times, not dates. You could still use the
same approach, creating a table with one row per second (given that
the field in question is 6 digits).

If this is an issue that comes up a lot, it still would be worth
considering. Doesn't introduce any new technology, and doesn't require
any learning if you've already done multifile queries before.

John Y.


--
IBM Champion for Power Systems

www.iInTheCloud.com<http://www.iInTheCloud.com> - Commercial IBM i and Power System Hosting
www.iDevCloud.com<http://www.iDevCloud.com> - Personal IBM i Hosting
www.Frankeni.com<http://www.Frankeni.com> - IBM i and Power Systems Consulting.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp]
Kevin Bucknum

Senior Programmer Analyst

MEDDATA / MEDTRON

120 Innwood Drive
Covington LA 70433
Local: 985-893-2550<tel:985-893-2550>
Toll Free: 877-893-2550<tel:877-893-2550>
https://www.medtronsoftware.com


CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.