Trapping % sign in Natural

We have a search field variable where a user can enter anything. However, if the user enters ‘%’ as a prefix, the program abends because it recognizes it as a terminal command.

Is there anyway for us to catch this?

The two simple options:

  • change the terminal character to something else (profile parameter CF), or set it to OFF (at least for “normal” users)
  • use the profile parameter ESCAPE=OFF to prevent the terminal character to be intercepted

Thanks Wolfgang. I guess there’s no way to catch it within the program itself? We don’t really want to require users to have to change profile parameters every time they do a search.

No, there is no way of intercepting & ignoring the terminal command character, I’m afraid.

If you can’t change the CF parameter possible workarounds depend on where you need to intercept / ignore it, is the search field in a window only, or on every screen ?

Hi Wolfgang, I think I found the solution. I coded SET GLOBALS CF=| within the program and it worked in trapping the % (not really a solution because now, we have a problem with |).

I wanted to try ESCAPE but can’t seem to make it work. Do you know the correct syntax? These don’t seem to work:


Nevermind. I realized that ESCAPE isn’t a session parameter. It’s a dynamic parameter and cannot be coded within the program. But how exactly do you set dynamic parameters?

Thanks for your help, though, Wolfgang. Appreciate it.

To turn it off programmatically you would use



Terminal commands issued with SET CONTROL, however, will still work, so in case you have windowing commands, %H or the like assigned to PF keys that won’t break !