Forum
Gotcha! The script works as I needed!
My JOB Batch
//DSNTIST EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(4,LT)
//SYSEXEC DD DISP=SHR,DSN=SSDVI.EDUC
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSTSIN DD *
%DSNACCTB MPP
//*
(DSNACCTB this is Rexx script, MPP this is name our subsystem, DSN=SSDVI.EDUC this is path to Rexx script)
I changed your script in this line
…
do while sqlcode = 0
if OBJECTTYPE /= "ALL"
then do
/************************************/
/* Set up SQL statements to insert */
/* into table. */
/************************************/
sqlstmt2 = "INSERT INTO DSNACC.TS_GTT VALUES(?,?,?,?,?,?,?,?)"
ADDRESS DSNREXX "EXECSQL DECLARE C1 CURSOR FOR S1"
ADDRESS DSNREXX "EXECSQL PREPARE S1 FROM :SQLSTMT2"
/************************************************/
/* Extract messages from variable and insert */
/* them into the table. */
/************************************************/
ADDRESS DSNREXX "EXECSQL EXECUTE S1 USING",
":DBNAME,:NAME,:OBJECTTYPE,:IMAGECOPY,",
":RUNSTATS,:REORG,:EXTENTS,:TOTALEXTENTS"
end /* end while */
….
(DSNACC.TS_GTT VALUES this is my table for results)