By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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.
Dig Deeper on Data backup, storage and retrieval on iSeries
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ...continue reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ...continue reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.