I Have 3 files. The customer file has customers who never ordered or had an invoice. We want to remove those customers from the customer file. I have 2 rpg programs one for each (orders, invoice) files. They create 2 temp outfiles which have those records that we want to Purge.

I want to merge these 2 files. There are duplicates in this sense:

Customer number     Suffix
123456              000
123456              001
123456              002
567890              000

Suffix can be there if the customer contacted us a second time, etc.

SO both outfiles can have these dupes.

I would like to have a final file that only has the customer number.

BUt I want to do this automatically, in a CL.

Can this be done in a CL, rather than a ad hoc SQL?

有帮助吗?

解决方案

Generally speaking, CL is not a database language. Put the ad hoc SQL in a source member and execute it with the CL command RUNSQLSTM. For more dynamic SQL inside a CL program, use RUNSQL.

If I recall, this application is creating some archive files and this is the final step. When you create the archive files, it would be easy to also create the 'duplicates' file. I'd consider that as a better route, because you can more easily create a report or spreadsheet or web page or some other record of the customers you are about to purge.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top