Search the web
Sign In
New User? Sign Up
rexxlist · General REXX Discussion List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
RXSQL with COUNT in SELECT statement in MVS REXX   Message List  
Reply | Forward Message #6292 of 16003 |
Re: RXSQL with COUNT in SELECT statement in MVS REXX

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



Mon Jul 10, 2000 4:54 pm

raul@...
Send Email Send Email

Forward
Message #6292 of 16003 |
Expand Messages Author Sort by Date

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....
Daryl Wells
dwwell1@...
Send Email
Jul 7, 2000
7:29 pm

I think the trick is to use SELECT COUNT(*) INTO :hostvar, so that you can control where the result of the count function is placed. I haven't done this with...
Bob Stark
bstark@...
Send Email
Jul 8, 2000
1:53 pm

This solution has more lines that I will like, but it works. ________________________________________________________________________ /* Trabajo con SQL para...
Raul Jager
raul@...
Send Email
Jul 10, 2000
4:52 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help