Introduction MTB Statements File System Compiler Applications Reference Guide Index

Language Structure Data Division I/O Format Division Procedure Division Mnemonics

STS function

Syntax: STS(lun)
Discussion: The STS function returns the operating status of the specified logical unit number.
Return values:
Byte    Description                Values
=============================================================
1       Device type                0 = disk file
                                   2 = terminal
2       Terminal status            0 = inoperative
                                   1 = operative
3       Read request status        0 = not pending
                                   1 = pending
4       F2 status                  0 = off
                                   1 = on
5       Slave printer status       0 = inoperative
                                   1 = operative
6       Terminal type              1 = VT3
                                   6 = VT6
7       Characters per line        0 = 64 characters per line
                                   1 = 80 or 132 char. per line
8 *     Key that caused transmit   hex encoded
                                   (see INPUT and (Easy Scan))

9-10 *  Location of the cursor     hex encoded (see INPUT)
        when the transmit 
        occurred

15-16 * Location of the cursor     hex encoded (see Easy Scan)
        when the mouse was
        clicked
* History: Bytes 8, 9, and 10 were added to the STS function in Comet version 504.208 in order to enhance the INPUT statement and as part of the (Easy Scan) mnemonic.
Example:
F2FLAG$ = SUB(STS(0),4,1)          ! Get F2 status byte
IF F2FLAG$ = "1" THEN GOTO 5000
This example shows how to test for the F2 key. First, the STS function is executed for logical unit number 0, the controlling terminal. The fourth byte of the return value is the F2 status byte -- this is derived with the SUB function. If this byte equals "1" -- indicating that F2 is on -- the program branches to statement label 5000.