TTFLGS

Set terminal-oriented flags

 

USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
xcall TTFLGS(flags[, control])

Arguments

flags

The terminal-oriented flags. Each flag is a single digit, and the digit positions are assigned ordinal numbers from right to left. Thus, the low-order digit is digit number one. Synergy DBL examines the flags value digit by digit to determine which flags are set, and hence, which functions are to be performed. For optimal performance, flags should be a zoned decimal field or literal. The Discussion contains a detailed description of the flags and their meanings. (n)

control

(optional) A value that controls how the individual digit positions in the flag specification value are interpreted. If control is not specified, each digit in flags is interpreted as follows: (n)

0

Reset the associated flag.

1

Set the associated flag.

n

Leave the associated flag unmodified, where n is any other decimal number.

We recommend that you use the control value when setting and resetting your flags values. If control is present, its value is interpreted as follows:

0

Reset all flags whose corresponding digit position contains a nonzero number. Leave all other flags unmodified.

1

Set all flags whose corresponding digit position contains a nonzero number. Leave all other flags unmodified.

2

Set the flags variable to a value that reflects the current settings of zero if the associated flag is currently reset or to one if the flag is set. If the length of the variable is less than four characters, the settings are returned as in a decimal-to-decimal assignment. (See Moving decimal/packed data to a decimal/packed destination for more information about decimal-to-decimal assignments.)

Discussion

The TTFLGS subroutine sets terminal-oriented flags.

When program execution begins, all program-controlled flags are normally reset, and the program can alter them as needed. The flag settings are not preserved across program chaining. In effect, the STOP statement resets all of the flags as its last action, even if another program is being started. The flag settings in one program do not affect the settings in a program that is running concurrently from another terminal.

Synergy DBL interprets the flags argument as if it were storing it to a d4 variable. All rules that apply when storing to a decimal variable apply here. For example, if you specify

xcall ttflgs(01)

Synergy DBL interprets your argument as 0001. (All flags corresponding to these zeros are cleared.)

Remember that the rightmost digit in the flag specification string corresponds to flag number one, as shown in the figure below. You don’t have to specify a flag if that flag and all flags to its left have a value of zero.

1. TTFLGS runtime option flags.

A more detailed description of the flags is provided below.

Flags for TTFLGS

Flag

Behavior when set

1

(OpenVMS) The terminal driver does not perform data interpretation or formatting on data output by a DISPLAY, WRITES, or FORMS statement to the terminal. When flag 1 is reset, data interpretation and formatting do occur.

2

(OpenVMS) If Ctrl+O is in effect, it is disabled before a DISPLAY, WRITES, or FORMS statement to the terminal is performed. When flag 2 is reset, Ctrl+O is enabled.

3

(OpenVMS) The type-ahead buffer is purged before a READS or ACCEPT statement from the terminal is performed. When flag 3 is reset, the type-ahead buffer is not purged.

4

Valid ANSI escape sequences are recognized as terminators for READS or ACCEPT, and they return the corresponding sequence code. (The escape character is not considered a valid terminator for READS or ACCEPT.) When flag 4 is reset, ANSI escape sequences are not recognized. Flag 4 also understands the SS3 (143) and CSI (155) form of escape keys.

The table below specifies the return code number corresponding to each key on various keyboards.

Return Codes Keyboard Keys

Key group

Key name

Code

VT200

VT100

Standard

Keypad keys

PF1

256

PF1

PF1

F1

PF2

257

PF2

PF2

F2

PF3

258

PF3

PF3

F3

PF4

259

PF4

PF4

F4

KP0 (0)

260

0

0

 

KP1 (1)

261

1

1

 

KP2 (2)

262

2

2

 

KP3 (3)

263

3

3

 

KP4 (4)

264

4

4

 

KP5 (5)

265

5

5

 

KP6 (6)

266

6

6

 

KP7 (7)

267

7

7

 

KP8 (8)

268

8

8

 

KP9 (9)

269

9

9

 

KPEnter

270

Enter

Enter

 

KPMinus (-)

271

 

KPComma (,)

272

,

 

 

KPPeriod (.)

273

.

.

 

Cursor positioning keys

Up

274

Up Arrow

Up Arrow

Up Arrow, numpad 8*

Down

275

Down Arrow

Down Arrow

Down Arrow, numpad 2

Left

276

Left Arrow

Left Arrow

Left Arrow, numpad 4

Right

277

Right Arrow

Right Arrow

Right Arrow, numpad 7

Function keys

Break/F5

284

Break

 

F5
F6 286 F6   F6

F7

287

F7

 

F7

F8

288

F8

 

F8

F9

289

F9

 

F9

F10

290

F10

 

F10

F11

291

F11

 

 

F12

292

F12

 

F12

F13

293

F13

 

 

F14

294

F14

 

 

Help/F15

295

Help

 

F15

Do/F16

296

Do

 

F16

F17

297

F17

 

 

F18

298

F18

 

 

F19

299

F19

 

 

F20

300

F20

 

 

Editing keys

Find/Home

311

Find

 

Home

Insert_Here

312

Insert Here

 

Insert

Remove

313

Remove

 

Delete

Select/End

314

Select

 

End

Prev_Screen

315

Prev

 

Page Up, numpad 9

Next_Screen

316

Next

 

Page Down, numpad 3

Other

Unknown

511

 

 

Escape, numpad 1, 5, and 7

*All numpad keys are with Num Lock off.

On OpenVMS, terminal I/O is implemented using the OpenVMS $QIO System Service. You can find additional information on the use of the flags set by TTFLGS in your OpenVMS I/O User’s Reference Manual. The set flags modify the I/O function code passed to the $QIO service as follows:

Note

On .NET, TTFLGS only works for terminal applications.

Examples

In the following example, the ACCEPT statement accepts either a normal key or a function key. For example, if the user presses the A key, code will contain a decimal 65 (the ASCII code for “A”). If the user presses the Up Arrow key, code will contain a decimal 275 (the code for an Up Arrow).

record
    code        ,d3
proc
    open(1, i, "TT:")
    xcall ttflgs(1000)          ;Turn on esc seq processing
    accept(1, code)

In the example below, the ACCEPT statement accepts either a normal key or a function key. However, since achar cannot hold the code for a function key, an escape character is returned to achar. The RSTATD subroutine is then called to retrieve the code for the function key. A single escape character is not a valid escape sequence and is not accepted when escape sequence processing is enabled.

record
    size        ,d1
    code        ,d3
    achar       ,a1

proc
    open(1, i, "TT:")
    xcall ttflgs(1000)          ;Turn on esc seq processing
    xcall rstatd(size, code)

In the following example, READS accepts a string of characters (up to the size of buffer). The string can be terminated by one of the normal terminator keys (return, line feed, form feed, or vertical tab), by filling the buffer (if the appropriate FLAGS digit is set), or by a function key. The RSTATD subroutine is then called to retrieve the code for the terminator. Code contains either the decimal code for one of the normal terminator keys or a function key code.

record
    size        ,d2
    code        ,d3
    buffer      ,a20
proc
    open(1, i, "TT:")
    xcall ttflgs(1000)
    reads(1, buffer)            ;Turn on esc seq processing
    xcall rstatd(size, code)