Jenna Poindexter · Aug 12, 2019

write #


Is there any way to control what control sequence is sent to a device when a   "write #" is executed?

I have an application that establishes a banner at the top of the terminal window and when we do a   "write #" the banner disappears.  I need to be able to recreate the banner line as part of the screen clear.



0 271
Discussion (3)2
Log in or sign up to continue

the DEFAULT function of # for a terminal window emulating a CRT ist hardcoded.

see Terminal I/O WRITE

"Issuing WRITE # to a CRT terminal clears the screen and sends the cursor to the home (0,0) position."

using a Mnemonic Definition you may supply the required escape sequence to cover your needs.

but instead of WRITE #  you may need to use  WRITE /TOP  (just as an example)

For all about Mnemonics see Controlling Devices with Mnemonic Spaces.

a simple example how it works:

I create a routine  next in my terminal

%BANNER  ;mnemonic demo
TOP      ;
         write #,%mybanner,!

next in my terminal

USER>set %mybanner="HI I'm a BANNER"_$c(13,10)_"============="

USER>use $IO::"^%BANNER"  write /TOP,"my first line",!

and that's my screen

my first line


If you work in Cache-Terminal, go to:

Select: C-Cache-Terminal, click on Edit
Go to bottom line (Caption: ZUFormFeed) and change the value from $C(27,91,72,27,91,74) to your needs.
For example, if you want to retain the first and the second lines, to: $C(27,91,51,59,48,72,27,91,74).

In case, your device type is not the Cache-Terminal, search for your device in

Select your device, for example TERM, |TNT| or whatever device type you have.
Click on edit and notice the Sub-Type.
Now, as above, go to the sub-types, and change the ZUFormFeed field.

In case, you wont find your device and/or device sub-type, there is a direct way too,
to set the desired FormFeed (i.e. write #) and the Backspace behavior:

do ##class(%Device).SetFFBS($C(27,91,51,59,48,72,27,91,74),$c(8,32,8))
The first sequence, as the method name implies, is the FormFeed sequence and
the second is the Backspace sequence