|
> Please look at the following RPG.
>
> 0004.00 C *ENTRY PLIST
> 0004.01 C PARM PRI 6
>
>
> 0005.00 C/EXEC SQL
> 0005.01 C+ DECLARE DYNFIL SCROLL CURSOR FOR DYNSTM
> 0005.02 C/END-EXEC
>
> 0011.00 C MOVEL'SELECT' WWHERE256 P
> 0012.00 C CAT '* FROM':1 WWHERE
> 0013.00 C CAT 'MCLI':1 WWHERE
> 0014.00 C CAT 'WHERE':1 WWHERE
> 0014.01 C CAT '(':1 WWHERE
> 0015.00 C CAT 'CFNUM':0 WWHERE
> 0016.00 C CAT '>=':0 WWHERE
> 0017.00 C CAT PRI:0 WWHERE
> 0022.00 C CAT ')':0 WWHERE
>
> 0030.00 C/EXEC SQL
> 0031.00 C+ PREPARE DYNSTM FROM :WWHERE
> 0032.00 C/END-EXEC
> 0033.00 *
> 0034.00 C/EXEC SQL
> 0035.00 C+ OPEN DYNFIL USING :WWHERE
> 0036.00 C/END-EXEC
> 0037.00 *
> 0038.00 * LIST FILE
> 0039.00 B1 C SQLCOD DOWNE100
> 0040.00 * read forward
> 0041.00 *
> 0042.00 C/EXEC SQL
> 0043.00 C+ FETCH NEXT FROM DYNFIL
> 0045.00 C/END-EXEC
> 0046.00 *
> 0047.00 B2 C SQLCOD IFEQ 100
>
> 0048.00 C LEAVE
> 0049.00 E2 C END
> 0050.00 *
> 0055.00 C EXCPTDET
> 0056.00 *
> 0057.00 E1 C ENDDO
>
> 0059.00 C/EXEC SQL
> 0060.00 C+ CLOSE DYNFIL
> 0061.00 C/END-EXEC
> 0062.00 *
> 0063.00 OQSYSPRT E 1 DET
> 0064.00 O CFNUM Z 7
> 0064.01 O ' '
> 0065.00 O CFNOM
>
>
>
> As this is a dynamic SQL, how can I retrieve the fields of my file (MCLI)
> in the fetch?
>
> I'd like to give the users the possibility of selecting the fields they
> want.
>
>
> Regards
> Joao Pereira
>
>
>
>
>
>
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
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.