> File A has millions of records and File B (dependent on A) has many more related records. Based on cut-off date, I need to extract data from A and related data from B and write to a workfile.> Can someone suggest me what is the best way to achieve the sameI would suggest that you recommend to your boss that this project be outsourced. Personally, I'd have a CL doing a OPNQRYF on FILE A to select on the date range, and call an RPG with a input primary on FILE A with a SETLL/DOW/READ loop on FILEB. But that's just me. Depends on the details of the situation. Plus old habits die hard. Good Luck.