This solution has more lines that I will like, but it works.
________________________________________________________________________
/* Trabajo con SQL para conseguir numeros de Página */
address EXECSQL
EXECSQL "SET OPTION COMMIT = *NONE"
sel="select PAGN from H/PAGINA" ,
"where fdiario='"flista"' and secc='clas'"
say sel /* Para ver como está */
EXECSQL 'prepare S1 from :sel'
EXECSQL 'declare C1 cursor for S1'
EXECSQL 'open C1'
/* For diagnostics */
Say 'Archivo abierto:' sqlcode sqlstate sqlerrmc sqlerrp
do forever
EXECSQL 'fetch C1 into :pag '
if SqlCode <> 0 then leave
queue pag
end
EXECSQL 'close C1'
/* Fin del SQL, pasa a CL */
address COMMAND
_______________________________________________________________________
You can simplify the program by specifying your SQL statement directly
in the "PREPARE" instead of using a variable, and since you have only
one record, you don't need the "DO FOREVER"
Daryl Wells wrote:
>
> I am trying to use COUNT in a SQL SELECT statement using RXSQL (against
> DB2) in a REXX exec. But, I do not know where the result (number of rows)
> is located. Can anyone help? Instead of using the COUNT, I could use
> EXECIO and read in the data to get the number of rows after selecting.
> But, I would prefer to use COUNT.
>
> Thank you in advance for any help.
>
--
Raul A. Jager W.
Asuncion - Paraguay