• Aucun résultat trouvé

PUT ~C%y RECORD 256%, COUNT N%

Dans le document RSTS/E Programming Manual (Page 72-77)

where N% indicates how many bytes in the buffer of channel C% are to be considered for the field declaration. Only the first two bytes in the buffer are Significant.

byte 1 (required) contains the field size and overflow handling information. The size must be between 1 and 127. Attempting to declare a size of 0 generates the ILLEGAL BYTE COUNT FOR 110 error (ERR = 31).

128 added to the field size indicates keypunch overflow handling is to be used instead of normal overflow handling.

byte 2 (optional) indicates the ASCII value of the paint character. If this byte is 0 or is not used, space is the default paint character.

byte 3 and ignored following

COUNT 1 % in the PUT statement therefore specifies that only the first byte in the buffer is to be used to declare the field. Space becomes the paint character by default. COUNT 2% indicates that the first two bytes in the buffer are to be used. Omitting the COUNT option from the PUT statement, ustngCOUNT 0% and using a COUNT value greater than 2 are equivalent to specifying COUNT 2%. In all cases, characters in the buffer beyond the second byte are ignored.

The PRINT statement can also declare a field by a method similar to that of the PUT statement. The RECORD 256% modifier in the PRINT statement indicates the field declaration. A one- or two-byte string replaces the . COUNT option to indicate field parameters. The following forms are valid.

10 PRINT

~C%y

RECORD 256%y CHR$(MX+S%);

or

10 PRINT IC%, RECORD 256%, CHR$(M%+s%)+ap.;

or

10 PRINT iC%, RECORD 256%, CHR$(M%+S%)+CHR$(P%);

S% is the field size between 1 and 127

+

concatenates the second (optional) byte P is the ASCII paint character

P% decimal code for paint character (for example, underline is CHR$(95%)) terminates the string

Usage of the PRINT statement to declare a field saves user space because the statements to define and load a buffer are eliminated.

Mter the field is declared, the system enables echoing. The de~laration makes the field active. Characters are then echoed until the field is filled. Subsequent characters are handled according to the overflow mode in effect for the

field~ When a delimiter is received (or the nth character for an n-character keypunch field is received), the field is deactivated. Echoing is again disabled. Characters typed after the field is deactivated are retained until the next field is declared.

Attempting to -declare a field when one is currently active generates the ACCOUNT OR DEVICE IN USE error (ERR

=

3) unless nothing has been entered in the active field. The SYS call to cancel type ahead deactivates an ac-tive field.

The 256% value can be used with other values in the RECORD option of the PUT or the PRINT statement for multiple terminal service operations. The ability to combine RECORD values enables the program to declare a field for either the master or a slave terminal. Fields need not be declared on all terminals, only on those terminals from which input is solicited. If the program attempts to input data without declaring a field on any terminal, the job will be locked in an input wait state. The WAIT statement may be used to recover and continue execution.

The following operations are a recommended sequence to execute when interacting with a scope terminal in echo control mode.

1. Open any terminal on a nonzero channel with MODE 8%.

2. Execute SYS call 11 to cancel type ahead. This action discards any unsolicited input which would be echoed automatically after a field is declared.

3. Position the cursor to top of screen and clear the screen.

4. Print any prompting text and display paint characters in all fields. (The program must initially display the paint characters which will be maintained by the terminal service during any deletion sequences.)

5. Position the cursor to the beginning of the first field (by direct cursor addressing).

6. Declare the field with the desired size and designate a paint character equivalent to the one displayed.

7. Execute the GET statement to retrieve input. The INPUT, INPUT LINE and MAT INPUT statements recognize only the standard BASIC-PLUS delimiters (carriage return, line feed and form feed) and should not be used for input operations. Additionally, the GET statement allows recognition of the private delimiter.

8. Extract data from the buffer and store it for processing.

9. Continue positioning the cursor, declaring fields, retrieving input, and extracting data as required.

The sequence is slightly different when working with a hard copy terminal.

1. Open the terminal on a nonzero channel with MODE 8%.

2. Execute SYS call 11 to cancel type ahead.

3. Position the paper at top of form. (If the terminal has hardware top of form, print a form feed. Otherwise, print several line feeds.)

4. Print any prompting text for the first field.

5. If the terminal can backspace, and has the underline character, paint the field with underlines and print the appropriate number of backspaces to fix the printing position at the start of the field.

6. Declare the field with the desired size and overflow handling mode. Do not declare a paint character be-cause it has no effect on a hard copy terminal.

4-10

7. Execute the GET statement to retrieve input. The INPUT, INPUT LINE and MAT INPUT statements should not be used.

8. Extract data from th~ buffer and store it for processing.

9. Positiotl the paper and printing mechanism for the next field by printing carriage return, line feeds, and spaces as required. Use only one field per line because characters removed during a deletion sequence are echoed which can cause the next intended fielc1 to be used.

10. Repeat the sequence from step 4 until all fields are satisfied.

4.4 ESCAPE SEQUENCES 4.4.1 Output Escape Sequences

When sending an escape sequence to a terminal, use the value CHR$(155) for the escape character rather than CHR$(27). The system translates CHR$(27) to CHR$(36) which is the dollar sign ($) character. The system trans-lates neither the CHR$(I 55) character nor the character following it. This process allows the terminal to interpret the e~cape sequence transmitted.

4.4.2 Input Escape Sequences

There are two I/O operating modes which are set by the TTYSET system program: NO ESC SEQ mode and ESC SEQ mode. In NO ESC SEQ mode, an incoming ESC character - CHR$(27) - acts as a delimiter. The system echoes a CHR$(36), which is the dollar sign ($) character.

In ESC SEQ mode, however, an incoming escape character CHR$(27) merely sets a flag indicating that an escape sequence follows. No character is echoed for CHR$(27) nor are characters in the sequence other than control char-acters echoed. The charchar-acters within the escape sequence are handled as follows.

1. ASCII control characters (CHR$(O) through CHR$(31) and CHR$(I27)) are processed first. Although embedded in an escape sequence, their functions remain unchanged. (For this reason, control characters are typically not used in escape sequences.) The control character CHR$(27) itself triggers the start of a new escape sequence.

NOTE

The function of control characters DEL CHR$(127) and CTRL/U CHR$(21) do change. They are discarded and not passed to the user.

2. Any number of f11ler characters (CHR$(32) through CHR$( 47)) can follow the triggering ESC character.

3. Within an escape sequence, any normal data conversion, such as translating lower case to upper case, is not done.

4. If an escape sequence has been triggered but not terminated, the system continues to process it.

5. Mter the escape sequence is terminated, normal data conversions are done.

Escape sequences are terminated by one of the following forms:

1. Y (CHR$(89)) followed by two trailing characters

< ESC> < n f11lers > <Y > < y-addr > < x--addr >

(The modifier is any character other than a control character.) 3. No trailing characters

< ESC> < n fillers> < other character>

(Other character is any character other than a control or filler character.) Only the above listed forms or another ESC character terminates the escape sequence.

The escape sequence is passed to the program as follows:

1. The triggering ESC character is replaced by CHR$ (128) 2. The escape sequence characters with no normal data conversion.

3. CHR$ (155) indicating the termination of the escape sequence.

For example, if the escape sequence:

< ESC ></ ><0 >< A>

is received, the system passes to the program the following data:

< CHR$ (128»< / >< 0>< A><CHR$ (155) >

The ESC character is translated to CHR$ (128). The slant character is a filler and is passed to the program. The 0 character signals that one trailing character follows. Receiving the A character, which is not a control or a filler char-acter, terminates the escape sequence. The system passes the CHR$(15 5) character to the program to signal the termination of the escape sequence.

4.5 PSEUDO KEYBOARD OPERA nONS

A pseudo keyboard is a non-physical device that has the characteristics of a terminal but has no physical device associated with it. like a terminal, a pseudo keyboard has both input and output buffers to which user programs send input and from which they extract output. By using a pseudo keyboard, one job can control other jobs on the system. Pseudo keyboards are particularly useful for BATCH operations, so that a terminal need not be tied up unnecessarily.

At system generation time, the system manager sets the number of pseudo keyboards on the system. The system denotes a pseudo keyboard by a device designator of PK and associates each pseudo keyboard with a keyboard unit number (but not with a physical terminal device.) For example, the system may associate PK5: with KB8:, although no physical keyboard number 8 exists. The output buffer of the pseudo keyboard is the input buffer for the asso-ciated keyboard unit and vice versa.

Use of a pseudo keyboard involves a controlling job and a controlled job. The controlling job initiates operations by performing output to the pseudo keyboard unit. It may run LOGIN and use both RSTS/E and program commands to control the job. The controlling job uses the pseudo keyboard to perform input to and extract output from the controlled job (which runs on KBn: associated with PKm:). The controlled job does input and output operations on its own keyboard, KB:. In effect, the controlled job does not know it is using a pseudo keyboard; only the control-ling job specifically uses a pseudo keyboard. Figure 4-1 shows the interaction between the controlled and controlcontrol-ling jobs.

The system transfers data to the pseudo keyboard in full duplex mode. This mode means that strings transmitted by PUT statements are echoed in the output buffer of the associated keyboard unit. The echo is then available to the controlling job by GET, INPUT, or INPUT LINE statements. In addition, a CR character (CHR$(13)) sent to the PK input buffer returns from the KB buffer as a CR and LF -sequence.

4-12

CONTROLLING

Figure 4-1 Pseudo Keyboard Operations 4.5.1 Pseudo Keyboard I/O

DP-ll-0091

A controlling job first accesses pseudo keyboard n by the OPEN statement with the device designator PKn: as follows:

10 OPEN ·PKO:- AS FILE 1%

The OPEN statement associates pseudo keyboard unit 0 with internal channell. The system ignores specifications of FOR INPUT and FOR OUTPUT for pseudo keyboards. If the device type or the unit number specified was not configured on the system, the NOT A V ALID DEVICE error (ERR=6) is generated. If the device is assigned to or opened by another job, the DEVICE NOT AVAILABLE error (ERR = 8) occurs. Otherwise, the program can per-form GET and PUT operations on the pseudo keyboard through the I/O buffer for channell.

To obtain data output from the controlled job, the controlling program executes a Record I/O GET statement on the proper internal channel. For example, the following makes data from the pseudo keyboard available in channel 1 buffer for the controlling job.

100 GET :1:1%

The response to a GET statement is immediate. The system never stalls the controlling program pending data avail-ability. This means that when the system executes a GET statement, it returns the contents of the buffer to the controlling job. The contents of that buffer could be a single message, multiple messages, or a message fragment. If

To perform output to a pseudo keyboard, the controlling program executes a Record I/O PUT statement with a coded value in the RECORD option. For example:

Dans le document RSTS/E Programming Manual (Page 72-77)