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



Noob with SPL
CONNECT supports a variable name. But I wonder if that is only when within a HLL.
I cannot get a CONNECT TO within SPL to support either a column name or a variable.
The create or replace works.
Call fails with
[SQL0950] Relational database V_SYSTEM_NAME not in relational database directory
Which leads me to believe that it thinks it is neither a variable nor column name but the actual database name.
Do I need to prefix the variable or column like I do with embedded sql? If so, what?

CREATE or replace PROCEDURE BACKUP_STATUS
LANGUAGE SQL MODIFIES SQL DATA
P1: BEGIN
DECLARE COMMAND CHAR(200); -- Ensure this is large enough.
DECLARE V_SYSTEM_NAME CHAR(25);
FOR V1 AS
C1 CURSOR FOR
select x.* from table(
values('RACK1HST'), ('GDWEB'), ('GDIHQ1'), ('GDISYS1'), ('MAIL1'),
('RACK2HST'), ('GDWEB2'), ('GDIHQ2'), ('GDISYS2'), ('MAILTWO'),
('RACK3HST'), ('MAIL3'), ('GDI'), ('DOMTEST'), ('MAIL4')) as x (SYSTEM_NAME)
DO
SET V_SYSTEM_NAME = SYSTEM_NAME;
connect to v_system_name;
-- do some stuff there
disconnect v_system_name;
set command = 'SNDMSG MSG(' CONCAT system_name CONCAT ') TOUSR(ROB)';
CALL QSYS2.QCMDEXC(COMMAND);
END FOR;
END P1
;

CALL BACKUP_STATUS;

Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1
Group Dekko
Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.