I've recently been working with the existing EDI processes and helping to create new ones such as the 945 and 947.
This particular purge routine uses Database output to delete the selected records. The overall data selection looks to see if the record has been successfully processed. It then begins with the F47011 (Header) then calls a custom section to delete the detail (F47012) records. Following the same Database output, it then removes the F4706, F4714, F4715 associated records through conditional sections.
Database output is somewhat difficult to follow since there is no event rule logic to follow. The 856 ASN purge routine is easier since it uses the event rule logic to remove records. We based our new purge routines on this.
Hope that helps.
Mike Kissel AS400 XE SP20