Focal Point
1 MFD 2 files. How to access both?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6801058331

April 12, 2005, 04:10 PM
Sandy Weller
1 MFD 2 files. How to access both?
In MF production we have 2 FOCUS files (A & B) both described with the same MFD - ERRORS. I want to update B with the data from A (B will have all of today's A data plus all of the prior A's for a month). I want to avoid 1) an unnecessary table file/hold to do the update or 2) the creation on a 2nd production MFD just for this step.

I could copy the MFD to a new name in a Proc step, do a MODIFY and erase it but, I'm looking for a more elegant (cooler) solution.

Any ideas? Maybe not even a MODIFY

Thanks,

Sandy
April 12, 2005, 04:37 PM
<Pietro De Santis>
The elegant way is to use the USE command.

USE CLEAR *
USE ERRORSA AS ERRORS
-RUN

TABLE FILE ERRORS
...
END

USE CLEAR *
USE ERRORSB AS ERRORS
-RUN

MODIFY FILE ERRORS
...
END
April 12, 2005, 05:33 PM
Sandy Weller
Pietro,

Thanks. I don't want to do a TABLE FILE HOLD and then MODIFY. I want to use A as the DATA FROM file.

Sandy
April 12, 2005, 05:41 PM
<Pietro De Santis>
You cannot read the data from one database to modify another database using MODIFY ... DATA ON. The input data files has to be a flat file.

If you want to update one database with data in another database, there are two methods:

The first I have already described. This is the much simpler method.

The second involves having two distinct Masters, COMBINEing the databases, and then writing a fairly complex CASE-based MODIFY to first read data in one database and update the second database.
April 12, 2005, 06:19 PM
Sandy Weller
Yeah, I know I can't actually use one database to modify another database using MODIFY ... DATA ON. I was sort of showing what I was hoping to do. We just hated the thought of what seems like an unessesary TABLEF.

Here are 2 files, exactly the same structure different record count and no way to combine them without an intermediate R/W step. seemed like it was worth asking around.

Thanks for you help. We'll go back to the TABLEF.

Sandy
April 13, 2005, 07:59 AM
HÃ¥kan
Sandy,

there's a third alternative if you've got a Maintain server:

maintain file a and b

case top
get_a_data();
update_b_data();
goto exit;
endcase

case get_a_data
for all next a.field into stk1;
endcase

case update_b_data
for all revise b.field from stk1;
endcase

end

Hakan