The ons doesn't necessarily reset, instead the storage bit as JERA mentioned must be cleared. Based on your logic either the XIO switch input or the GRT instruction must have a false to true transition for the ONS to work correctly, so to conclude whenever the preceding instructions before the ONS go from false to true your ONS should work, if they don't work check to see if the XIC or the GRT are switching states, if they are not then see what makes them transition from a low to a high value for the XIC and also see what changes values to your L11:1 register.