Thank you for that...it works fine for a single execution. If you try and run it again it reports that the object '#Temp' already exists in the database.
The identifier linking the POD with the CDI (Collection/Delivery Instruction) is the Package Number (2nd Field). In the example the POD is present (twice) but I...