If you use the runs SQL scripts option in ACS you can save your results directly as a XLSX sheet.

Gary Kaplan

On 8/11/2022 12:01 PM, Stephen Landess wrote:
On the subject of file transfers, this is what I have been doing for a while now.

I use SEU to create SQL scripts in source members (old-fashioned, you know), and then run them with RUNSQLSTM.

1. Use SQL to create a work file in QTEMP.
2. Use CPYTOIMPF to copy the work file to a CSV file in the IFS.
3. use SNDSMTPEMM to send the CSV file to my company email address.

Example script:
==============

--
-- Show accounting dates for CO's in JE batches.
--
CREATE OR REPLACE VARIABLE SJL.$$EDTN1 CHAR(20) DEFAULT( '00251249');
CREATE OR REPLACE VARIABLE SJL.$$EDTN2 CHAR(20) DEFAULT( 'xxxxxxxx');
CREATE OR REPLACE VARIABLE SJL.$$EDTN3 CHAR(20) DEFAULT( 'xxxxxxxx');
CREATE OR REPLACE VARIABLE SJL.$$EDTN4 CHAR(20) DEFAULT( 'xxxxxxxx');
--
DROP TABLE QTEMP/CO_BEGFYPD ;

CREATE TABLE QTEMP/CO_BEGFYPD
( XXCO , CCDFYJ , CCPNC , GLDATE )
AS (
SELECT DISTINCT
VNCO
, CCDFYJ , CCPNC
, JDEDATE( CCDFYJ )
FROM F0911Z1

JOIN F0010
ON VNCO = CCCO

WHERE VNEDTN in ( SJL.$$EDTN1
, SJL.$$EDTN2
, SJL.$$EDTN3
, SJL.$$EDTN4
)
Order by 1

) with data ;
--
-- Copy to IFS
--
CL: ?CPYTOIMPF ??FROMFILE(QTEMP/CO_BEGFYPD)
??TOSTMF('/HOME/SLANDESS/JE/CO_BEGFYPD.CSV')
??MBROPT(*REPLACE)
??STMFCCSID(1208)
??STMFAUT(*INDIRFILE)
??RCDDLM(*CRLF)
??STRDLM(*NONE)
??RMVBLANK(*TRAILING)
??ADDCOLNAM(*SYS);

--
-- E-mail the files:
--
CL: ?QSYS/SNDSMTPEMM ??RCP((SLANDESS@xxxxxxx))
??SUBJECT('CO Beginning FY and Period')
??NOTE('CO_BEGFYPD = CO Beg FY and Current Period ')
??ATTACH(('/home/SLANDESS/JE/CO_BEGFYPD.CSV'));


Regards,
Steve Landess
(512) 289-0387



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.