TTFLGS

Set terminal‑oriented flags

 

 

USupported on UNIX
VSupported on OpenVMS
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, and they return the corresponding sequence code. (The escape character is not considered a valid terminator for READS.) 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 a VT220 keyboard.

Return Codes for VT220 Keys

Key group

Key name

Code

VT200

VT100

Keypad keys

pf1

256

pf1

pf1

pf2

257

pf2

pf2

pf3

258

pf3

pf3

pf4

259

pf4

pf4

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

enter (return)

270

enter

enter

minus (–)

271

comma (,)

272

,

 

period (.)

273

.

.

Cursor positioning keys

up

274

up arrow

up arrow

down

275

down arrow

down arrow

left

276

left arrow

left arrow

right

277

right arrow

right arrow

Function keys

f6

286

f6

 

f7

287

f7

 

f8

288

f8.

 

f9

289

f9

 

f10

290

f10

 

f11

291

f11

 

f12

292

f12

 

f13

293

f13

 

f14

294

f14

 

help

295

help

 

do

296

do

 

f17

297

f17

 

f18

298

f18

 

f19

299

f19

 

f20

300

f20

 

Editing keys

home/find

311

find

 

insert_here

312

insert here

 

remove

313

remove

 

end/select

314

select

 

prev_screen

315

prev screen

 

next_screen

316

next screen

 

Other

unknown

511

 

 

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:

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)