|
If you're concerned with only one data type, this isn't too bad. You can do it with pointers, a data structure, and a based date field. The dspffd result should give you the offset of each field from the beginning of the record. In your program you can use an externally defined data structure defined by the file in question or make the file program described and read it into a data structure for which you could allocate memory at runtime. Read a record. Set a pointer to the address of the beginning of the data structure and then increment it to point to the offsets of the fields you're interested in. The date field should be based on this pointer. As you change the value of the address contained in the pointer, the based field will take on the appropriate values. I'll bet there's a slicker way to do it. If you're interested in a variety of data types, you'll need a large number of based fields. > -----Original Message----- > From: Fran Denoncourt [mailto:BobNFran@escapees.com] > Sent: Tuesday, August 07, 2001 4:07 AM > To: RPG400-L@midrange.com > Subject: Field contents by reference? > > > I have two files: The first is a data base file, XXX, with many date > fields. I would like to validate the contents of each > specific date fields. > The second file is an output file, XXXFIELDS, from a query > over a file > generated from DSPFFD. File XXXFIELDS has only four fields > (file name, > library, field name, field text). The query selects specific > date fields to > analyze. So, I would have XXX/Lib/Fld1/text; XXX/Lib/Fld2/text.....etc. > Since there will be several files to analyze - each with several date > fields - I wanted a more generic program with as little hardcoding as > possible. 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. There must be a way to reference the data. > Pointers? %ADDR? > Thanks again for your help. > Fran Denoncourt > +--- | 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.