I don't find the past perfect to be idiomatic here:

> I **had been** working in the office when 9/11 happened.

The simple past continuous would be idiomatic there as the ongoing work in the office  was interrupted by what happened at a particular moment on the morning of 9/11:

> I was working in the office when the attack on 9/11 took place.

Consider:

> I had been working in that office *for only three weeks* when the attack on the morning of 9/11 took place.

There, the past perfect continuous is used *in combination with a time phrase that gives the inchoate time-span definition*, and that definition establishes a terminus that precedes the attack that **took place**.


With **he will have been exercising**, his exercise will have come to an end either coincident with, or immediately before, their arrival. **will be exercising** would be used to indicate that the exercise will be ongoing when they arrive.