This sort of layout comes from the 'old days'
before relational database technology. In
Pascal, you used to use a variant record, in C
it was a union, in COBOL redefines, in FORTRAN
named common.
For the nested rules, use a union in a union
( or whatever is appropriate ).
Data alignment can be a problem in record
definitions like this, so be carful of how
the data is packed and unpacked.
HTH
--
"I speak for myself and all of the lawyers of the world"
If I say something dumb, then they will have to sue themselves.
> Reposting article removed by rogue canceller.
> Hi,
> I would like to come up an efficient way to extract certain fields
> from a binary record:
> This record has 700 possible layouts, each layout has a structure code.
> The record's average size is 130 bytes.
> Each record can have different number of fields, it is decided by its
> layout.
> Also, some layouts are decided by a nested if-else-then rules.
> Does anyone have any similar experience to deal with this records?
> How to make the lookup part of extraction efficient?
> Any help or pointer will be appreciated!
> Thanks,
> -Pei