Hi,
Is there an easy way to display/print a variable on the output of the IBM i ACS Run SQL Script screen?
For having a quick check when writing a script it would very helpful to be able to display the content of a variable.
E.g. in below script, I want to know the value of var_locks. I tried using PRINT var_locks but that does not work.
Is there an easy way to display/print a variable on the output of the IBM i ACS Run SQL Script screen?
For having a quick check when writing a script it would very helpful to be able to display the content of a variable.
E.g. in below script, I want to know the value of var_locks. I tried using PRINT var_locks but that does not work.
Code:
BEGIN -- DECLARE Variables DECLARE lib_prefix1 VARCHAR(3); DECLARE var_locks INT; DECLARE var_flag VARCHAR(10); ---------------------------- -- Check Locks SET var_locks = 0; SET var_locks = var_locks + (SELECT count(*) FROM QSYS2.OBJECT_LOCK_INFO WHERE SYSTEM_OBJECT_SCHEMA = 'LIBA' AND SYSTEM_OBJECT_NAME = 'FILE1' AND OBJECT_TYPE = '*FILE'); SET var_locks = var_locks + (SELECT count(*) FROM QSYS2.OBJECT_LOCK_INFO WHERE SYSTEM_OBJECT_SCHEMA = 'LIBB' AND SYSTEM_OBJECT_NAME = 'FILE2' AND OBJECT_TYPE = '*FILE'); SET var_locks = var_locks + (SELECT count(*) FROM QSYS2.OBJECT_LOCK_INFO WHERE SYSTEM_OBJECT_SCHEMA = 'LIBC' AND SYSTEM_OBJECT_NAME = 'FILE3' AND OBJECT_TYPE = '*FILE'); IF (var_locks > 0) THEN SET var_flag = 'LOCKS'; ELSE SET var_flag = 'NOLOCKS'; END IF; >-- Code for check var_locks contents here <-- END;
Comment