I've decided to start to try using SQL in my RPG programs as I'm reading that there are some advantages and I also want to broaden my skills.
I have a lot of questions and an example probably would answer most. One question is. Assuming the SELECT statement is like a READ (one record at a time) I would have to "wrap" the SELECT statement in a loop? Not sure how this would be coded. Can I do the select, dow not %eof(WMCUST), do some calcs, perform the select again, enddo
And cursors? What and how are they used.
I've read some of SQL posts in this forum but only see snippets of code and don't understand all of it. If someone could please post a small complete RPG program using embedded SQL statements that would be great.
The program that I'm trying to create as a test is a simple Customer Address Listing.
C/exec sql
C+ SELECT CustNum, CustName, CustAddr, CustCity, CustState, CustZip from CUSTMAST
C+ WHERE CustDel <> 'D' and <> 'I'
C+ ORDER BY CustNum
C/end-exec
Is as far as I got :-(
Thank you very much!
I have a lot of questions and an example probably would answer most. One question is. Assuming the SELECT statement is like a READ (one record at a time) I would have to "wrap" the SELECT statement in a loop? Not sure how this would be coded. Can I do the select, dow not %eof(WMCUST), do some calcs, perform the select again, enddo
And cursors? What and how are they used.
I've read some of SQL posts in this forum but only see snippets of code and don't understand all of it. If someone could please post a small complete RPG program using embedded SQL statements that would be great.
The program that I'm trying to create as a test is a simple Customer Address Listing.
C/exec sql
C+ SELECT CustNum, CustName, CustAddr, CustCity, CustState, CustZip from CUSTMAST
C+ WHERE CustDel <> 'D' and <> 'I'
C+ ORDER BY CustNum
C/end-exec
Is as far as I got :-(
Thank you very much!