Evening Folks,
I am using Progress 10.1c
I am trying to bring in two text files: some products and a file with additional attributes about the products.
DEFINE STREAM s-input.
DEFINE STREAM s-input2.
Tracy,
You need to do 3 things here:
1) read the products,
2) read the attributes, and
3) associate one with the other.
You can do some optimisations but you will have to do 1 and 2 as 2 loops; unless you are assured that the order of the records is the same in both files, you will have to either read all the records into temp-tables or seek back and forth in one of the files. ABL is much better at finding/looping over temp-tables than it is in operating on files.
I would read the child records (I’m guessing it's the attributes) from their file first. That way, when you're in the parent import, you can do the association immediately after you've created the parent record:
Repeat:
Create ttAttr.
Import stream strAttr ...
End.
Repeat:
Create ttProd.
Import stream strProd ...
For each ttAttr where ...
Assign .
End.
End.
You still have 3 loops (REPEAT, REPEAT, FOR EACH) but the FOR EACH can take advantage of an index (make sure you define one on the TT), which will at least limit it to a smaller number of records.
You can play around with different approaches too, and time them. Look at the MTIME keyword; assign a start and end variable and see how long each approach takes.
HTH,
-- peter