D Rec1 E DS ExtName(WMETPCPF)
D Rec2 E DS ExtName(WMETPCPF) Prefix(D1:2)
Now the fields in the file WMETPCPF are contained by name in structure REC1, and by a slightly different name in REC2. So you can refer to field TPVDRN (which is the field in REC1) or to field D1VDRN in structure REC2.
I use this to load screens from files. When you read a record from the file, its data will fill the fields in REC1. If you then do:
C Eval Rec2 = Rec1
...both structures now contain the same data. The fields on the screen match the fields from the file.
This means that you can do your new record duplication detection in one compare operation. First, the fields containing your new data are in one structure, and the fields from the database record are in another. So, just compare REC1 with REC2 and you have compared ALL the fields.
BUT, you might not want to compare ALL the fields! Some fields, like timestamps, are not relevant. So, set those to a known value before comparing the structures:
C Eval TPDATE = D1DATE C Eval TPTIME = D1TIME C Eval TPUSER = D1USER C If Rec1 <> Rec2 C Eval Rec1 = Rec2 C Write (E) TP C EndIf
================================== MORE INFORMATION ON THIS TOPIC ==================================
The Best Web Links: tips, tutorials and more.
Visit the ITKnowledge Exchange and get answers to your developing questions fast.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
This was first published in March 2005