When ARP310 runs, it updates the last billing date (ARPPDH.LST-BIL) and effort# (ARPDH.LST-INVS) of the invoice being billed. The ARP310 select sets can then be based on the current effort number of the customer's invoice and when it was last billed. However, there are times when the ARPPDH.LST-BIL is not set during a billing run, even though the effort number may be incremented.
When the ARP310 select set is set up, you have the option of incrementing the effort number and sending a notice to the customer.
When you increment the effort number, after the billing run, the ARPPDH.LST-INVS field will reflect this. For an invoice that has never been billed, the effort number would change from blank to 1. For an invoice that has been sent effort # 1, ARP310 would increment the 1 to a 2. And so on.
When you set the Send Notice flag, ARPBHD and ARPBDT records are created, which are then used in your custom billing process that generates the actual invoice that you send to the customer. You can also bill suspend or non-pay cancel the subscription associated with the debit via the Bill Suspend? and Non-pay Cancel flags. If you do not either send notice to the customer, bill suspend, or non-pay cancel, the ARPPDH.LST-BIL is not set.
If a certain number of days must pass before you want to bill the customer again, an ELAPSED statement is used in your billing select. For instance, if you wish to pull those invoices that are on effort 1 and for which 30 days have passed since they were last billed, then your select would look something like this:
However, if when you billed the invoice for effort 1 Increment Effort was checked but the Send Notice flag was not Y, then the invoice would be on effort 1 with a blank billing date. Since the ELAPSED function cannot process blank dates, the ARP310 would error when it got to Set 20 0/0/00 in the above select.
To get around this, you will either always want to either set the Send Notice flag to Y or check for blank dates before doing your ELAPSED function: