This example allows you to output any return parameters in the ACS message list at the bottom of the Run SQL Statements screen.
--Sample Stored Procedure
CREATE OR REPLACE PROCEDURE
QGPL.SpOpPgmMsg
(
OUT msgvar varchar(255)
)
LANGUAGE SQL
MODIFIES SQL DATA
BEGIN
--DECLARE msgvar varchar(255);
set msgvar = 'I am a test message';
END
;
--Call sproc with ? for output parameter
call QGPL/SpOpPgmMsg(?);
--This is what ACS shows
Return Code = 0
Output Parameter #1 (MSGVAR) = I am a test message
Statement ran successfully (152 ms)
Regards,
Richard Schoen
Web:
http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx
------------------------------
message: 3
date: Thu, 12 Aug 2021 12:59:28 +0000
from: Matt Olson via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx>
subject: RE: Printing messages in a DB2 for IBMi stored procedure
Yeah I ended up using this approach. Seems to work well, just doesn't output to the bottom of the ACS query results window like I wanted.
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Birgitta Hauser
Sent: Thursday, August 12, 2021 1:12 AM
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Printing messages in a DB2 for IBMi stored procedure
CAUTION: This email originated from outside of the ARRT. Do not click links or open attachments unless you recognize the sender and know the content is safe.
There is meanwhile an easier way to write messages into the joblog, by using the LPRINTF stored procedure in the SYSTOOLS library.
https://www.ibm.com/docs/en/i/7.4?topic=services-lprintf-procedure
Mit freundlichen Gr??en / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown) "If you think education is expensive, try ignorance." (Derek Bok) "What is worse than training your staff and losing them? Not training them and keeping them!"
?Train people well enough so they can leave, treat them well enough so they don't want to.? (Richard Branson)
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Mark Waterbury
Sent: Mittwoch, 11. August 2021 21:43
To: Matt Olson via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Printing messages in a DB2 for IBMi stored procedure
Matt,
Where do you want those messages to appear? In the job log? See:
https://www.mcpressonline.com/programming/rpg/job-logging-from-rpg-ivthe-easy-way
HTH,
As an Amazon Associate we earn from qualifying purchases.