Jacques,
Per the DCS240 manual section 5.1, changing OpSw 36 (or 37, 39, or 40) _requires_ interaction with the command station's front-panel switches. JMRI cannot do anything via a LocoNet message to get the DCS240 to do its internal housekeeping.
But, **I believe**, you can perform the OpSw change via JMRI and then manually interact with the command station front-panel switches, and you should get the desired effect. While I have not tried this, I believe it will work, but I cannot guarantee it...
Regards,
Billybob