The ISINTERACT() built-in functions returns true if the SQL iQuery Script is running in an interactive job, otherwise it returns false.
The ISINTERACTIVE() built-in function checks returns true if the internal iQuery variable for the job is Interactive. This internal variable is set at runtime by calling the QUSRJOBI (Retrieve Job Information) API and detecting the value of the Job
Type subfield.
This built-in function has no parameters.
eval &outq = '*JOB';
if IsInteractive();
dspWin "Select an output queue";
dspvar &outq,2,4,name(10),"Output Queue";
exfmt;
if FKey(F3);
return;
endif;
endif;
cl: ovrprtf QPRINT OUTQ(&OUTQ);
cl: call mypgm;
select * from foo;
The above script checks if running as an interactive job, and if it is, prompts the end-user for the output queue to use for the call to a user-defined program. If not, it simply uses the *JOB default output queue.