Does the program have to be executed automatically as soon as the device has varied off, or do you just need to make sure the device is varied off before running the program?
If the former is true then your best option would be to either:
1) Create your own command for varying off devices. This should have the same parameters as the IBM VRYCFG command and the CPP should call the VRYCFG command and then check the device name to see if it needs to run the program which it can then execute.
2) Write a NEP (Never Ending Program) that sits in a subsystem and checks the device status at predetermined intervals. If the status changes from online to offline then it can execute your program.
If the latter is true and you only need to ensure the device is offline before executing the program then you could either add a test in the program you want to execute to check the device is offline, or vary off the device from within the program.
All the best