November 17, 2005, 04:31 PM
dhofmanOk. That worked! Thanks Texas Stingray. However..............
I realize I need to take it a level higher than what I talked about in my original post due to requirements changes. Plus I forgot to mention a couple things.
Hold1 is still the same, however there may be duplicates. There is no way to a complety unique key because I could add records later on in my process by a different key resulting in this key being that same as something that already exists.
Hold2 is the same but there may be duplicates in the hold file.
What I need to do is match Hold2 records one at a time to the database(hold1) by the key. If I find a match, I need to set a date on the database for that record touching no other data for that record. Also, I need to delete that record from Hold2. If I find a match and there are duplicates on the database for that key, I need to keep the record on Hold2 and go to the next record on Hold2.
If I do not find a match on the database, I want to keep the record is Hold2 for later processing and go to the next record on Hold2.
Hopefully someone can help we with these changes to my dilemna. I appreciate it
Thanks.
November 23, 2005, 01:47 PM
Maintain WizardHere is the code that you need. THis compares the code in file B to the codes in file A. IF found, update the date field in file A and delete the record from file B. If not found, move to the next row of B - Mark
cssmhd: MAINTAIN FILE HOLDA AND HOLDB
MODULE IMPORT(MNTUWS)
FOR ALL NEXT HOLDB.CODE INTO STK
FOR ALL NEXT HOLDA.CODE INTO STK2
COMPUTE DATE1/A10 = TODAY2();
COMPUTE DATE2/MDYY = DATE1;
COMPUTE DATE3/YYMD = DATE2;
COMPUTE I/I3=1;
COMPUTE J/I3=1;
REPEAT STK.FOCCOUNT
COMPUTE J=1;
REPEAT STK2.FOCCOUNT
IF STK(I).CODE = STK2(J).CODE THEN BEGIN
COMPUTE STK2(J).XDATE = DATE3;
UPDATE HOLDA.XDATE FROM STK2(J);
DELETE HOLDB.CODE FROM STK(I);
GOTO EXITREPEAT
ENDBEGIN
COMPUTE J=J+1;
ENDREPEAT
COMPUTE I=I+1;
ENDREPEAT
END
November 30, 2005, 10:27 AM
dhofmanThanks! This helps tremendously and is much simpler than what I came up with.