|
>The intent was to read a record from XXX then get all
>of the date field names from XXXFIELDS retrieving
>and analyzing the contents of each date field before
>going on to the next XXX record. Is there a way to
>get the contents of the date field using the field
>name retrieved from XXXFIELDS.
This idea may have merit: Read a record from XXXFIELDS and build a dynamic
SQL statement to fetch the actual field from the actual file like so:
d SqlStm s 512a
d FldData s 512a
c/exec sql
c+ Declare FldTest cursor for DynFldTest
c/end-exec
c eval SqlStm = 'Select ' + %trim(FldName) +
c ' from myRealFile'
c/exec sql
c+ Prepare DynFldTest from :SqlStm
c/end-exec
c/exec sql
c+ Open FldTest using :SqlStm
c/end-exec
c/exec sql
c+ Fetch next from FldTest into :FldData
c/end-exec
If you have a burning desire to make this more generic, you'll have to
interrogate SYSCOLUMNS and do your FETCH ... INTO into a matching variable.
Buck Calabro
Commsoft; Albany, NY
Visit the Midrange archives and FAQ at http://www.midrange.com
"The foolish and the dead alone never change their opinions"
-- James Russell Lowell
+---
| 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.