Comparing/passing records in 4GL/C
Posted in 1992
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Howdy, I'm interested in comparing two entire records at runtime, so I can tell if one (which started out a copy of the first) is still the same as the first: i.e., I want to detect if the record has been updated. I can't do something like if ( rec1 = rec2 ) then... or if (rec1.* = rec2.*) then... in 4GL, and I don't seem to be able to find a way to pass a pointer to a record to a C function. I can pass all the fields with call myfunc(rec1.*,rec2.*), but then I have to pop all the fields off the stack, which means I have to know all the fields in the record. What I want to do is get a pointer to the first, a pointer to the second, find the size somehow (at run time) and do a memcmp(rec1,rec2,sizeof(rec)); or something similar. The library function field_touched() almost does what I want, so there must be a way to know this information at runtime. Any ideas how I write field_changed()? Poking through the headers for 4GL didn't give me any great ideas. Thanks. Oops, we are running Online 5.0, with tools version 4.10 on a HP9000/832 with HPUX 8.0. -- Karl Brummel -- brumski+@osu.edu "Because a mind is a terrible thing." "Speed isn't everything...it's the ONLY thing." -- Karl Brummel---brumski+@osu.edu "Mr. MIPS, with the quick handspeed and the bag of tricks."