Jevgeni, Are the files externally defined? If so, use SQL to get at them. Select FIELD0, FIELD1, FIELD2, FIELD3 from mypfile Will always get the data the way you want it. Bob > -----Original Message----- > From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l- > bounces@xxxxxxxxxxxx] On Behalf Of Jevgeni Astanovski > Sent: Tuesday, June 17, 2003 6:42 AM > To: C programming iSeries / AS400 > Subject: [C400-L] Accessing PF with changing structure. > > Can anyone advise me of how can I solve the following problem? > I have a physical file defined via DDS: > First PF1: > > A FIELD0 06A > A FIELD1 01A > A FIELD2 02A > A FIELD3 03A > K FIELD0 > > I have to read data from the file from C-program. > I declare it via #pragma mapinc.... and nicely read data using > _Rreadk for example. > Absolutely no problem - works all the time. > > The problem is, that this file is created somewhat dynamically > by another application, and sometimes it is like this, but > sometimes fields are swapped: > > For example: > A FIELD0 06A > A FIELD2 02A > A FIELD1 01A > A FIELD3 03A > K FIELD0 > > As my program needs FIELD1, it never obtains it in the second > case until I recompile it.... > > Is there a way to retrieve FIELD1 always, irrespectably of > where it is in the record. > The record size is always the same and the fields themselves > are always identical. > > Any advise will be highly appreciated..... > > Jevgeni Astanovski > IT support department manager > Sampo pank. > Tallinn, Estonia. > > > _______________________________________________ > This is the C programming iSeries / AS400 (C400-L) mailing list > To post a message email: C400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/c400-l > or email: C400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/c400-l.