|
Hi,
My statement looks OK, but I am getting SQL Code 501, Cursor not
open. I went through the list of things that could be wrong, but none seem
to apply. Can anyone see what I am doing wrong?
0154.00 C EVAL SelSmt =
0155.00 C 'SELECT * FROM JTD WHERE JDJBT#
= :JOBNO '
0156.00 C EVAL SqlSmt =
0157.00 C SelSmt + 'ORDER BY ' + L1Fld + ',' +
L2Fld
0158.00 C + ',' + L3Fld + ',' + 'JDPROD'
In debug, this give me SELECT * FROM JTD WHERE JDJBT# = :JOBNO ORDER BY
JDPSYS,JDBPRT,JDSSYM,JDPROD
0160.00 C******************************
0161.00 C/EXEC SQL
0162.00 C+ PREPARE STMT FROM :SQLSMT
0163.00 C/END-EXEC
0164.00 C******************************
0165.00 C/EXEC SQL
0166.00 C+ DECLARE A CURSOR FOR STMT
0167.00 C/END-EXEC
0168.00 C******************************
0169.00 C/EXEC SQL
0170.00 C+ OPEN A
0171.00 C/END-EXEC
0172.00 C******************************
0173.00 C*
0174.00 C EVAL MorJTD = 'YES'
0175.00 C*
0176.00 C DOU MorJTD = 'NO '
0177.00 C*
0178.00 C/EXEC SQL
0179.00 C+ FETCH NEXT FROM A INTO :JTDRec
0180.00 C/END-EXEC
0183.00 C IF SQLCOD <> 0
0184.00 C EVAL MorJTD = 'NO '
0185.00 C ELSE
I also tried the fetch without the next from and got the same error. After
I set on LR, I am closing A.
<===================================================>
Terri Harteau
Felker Brothers Corporation
****************
Paperwork is like kudzu. Both need to be pruned regularly. Usually, a
flamethrower is overkill. Usually.
****************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.