Guru: How To Use Global Variables In SQL Scripts
January 23, 2017 Michael Sansoterra
Hey, Mike:
I’m writing SQL scripts to do some administrative work. These scripts are run in iNavigator’s RunSQL scripts utility and use the special CL: directive to execute an IBM i command. I stumbled across the CREATE VARIABLE statement and wondered if I could use an SQL variable to substitute a library name within the OS commands.
For example, if I define something like the following in iNavigator:
CREATE OR REPLACE VARIABLE QGPL/LIB CHAR(10) DEFAULT 'JOE';
Can I then use the LIB variable in a CL: command as follows?
CL: DSPLIB LIB(LIB) OUTPUT(*PRINT);
–Guru Reader
Unfortunately, GLOBAL VARIABLES cannot …
Read more