Thank's.
I've evaluated different ways.
1. DDM. Define a DDMPF and override original file to DDM before compilation. 
Works but somehow tricky....

2. Using API to retrieve file structure and "manually" find right field. Too 
much programming...

3. Embedded SQL seems to be the easiest one. I decided to write a program, that 
retrieves all fields with index value passed to it. And then I can call it from 
all other programs, that need to access this file. Exactly as Leonid thought, 
being compiled with one file structure and transferred to another machine with 
another file structure, it still works.
Do not know how do THEY achieve it....

Jevgeni.

> -----Original Message-----
> From: Bob Crothers [mailto:bob@xxxxxxxxxxxxxx]
> Sent: 17. juuni 2003. A. 16:56
> To: 'C programming iSeries / AS400'
> Subject: RE: [C400-L] Accessing PF with changing structure.
> 
> 
> 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.
> 
> 
> _______________________________________________
> 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.
> 
> 


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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 here. If you have questions about this, please contact [javascript protected email address].