IB Statements/sts
From CometWiki
(New page: '''STS function''' '''Syntax:''' STS(lun) '''Discussion:''' The STS function returns the operating status of the specified logical unit number. Return values: Console/terminals: B...) |
|||
(3 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
'''STS function''' | '''STS function''' | ||
+ | |||
'''Syntax:''' STS(lun) | '''Syntax:''' STS(lun) | ||
+ | |||
'''Discussion:''' The STS function returns the operating status of the specified logical unit number. | '''Discussion:''' The STS function returns the operating status of the specified logical unit number. | ||
- | Return values: Console/terminals: | + | |
- | Byte Description Values | + | Return values: Console/terminals: Byte Description Values |
- | 1 Device type 0 = disk file | + | 1 Device type 0 = disk file 2 = terminal 2 Terminal status 0 = inoperative 1 = operative |
- | 2 = terminal | + | 3 Read request status 0 = not pending 1 = pending |
- | 2 Terminal status 0 = inoperative | + | 4 F2 status 0 = off 1 = on |
- | 1 = operative | + | 5 Slave printer status 0 = inoperative 1 = operative |
- | 3 Read request status 0 = not pending | + | 6 Terminal type 1 = VT3 6 = VT6 |
- | 1 = pending | + | 7 Characters per line 0 = 64 characters per line 1 = 80 or 132 characters per line |
- | 4 F2 status 0 = off | + | 8 Key that caused transmit hex encoded (see INPUT and (Easy Scan) |
- | 1 = on | + | 9-10 Location of the cursor when the transmit occurred hex encoded (see INPUT) |
- | 5 Slave printer status 0 = inoperative | + | 11-14 The handle of the window that generated the read see (CreateWindowEx) and (SelectWindowEx) |
- | 1 = operative | + | 15-16 Location of the cursor when the mouse was clicked hex encoded (see Easy Scan) |
- | 6 Terminal type 1 = VT3 | + | 17 COSW major version number see example 2 below |
- | 6 = VT6 | + | 18 COSW minor version number see example 2 below |
- | 7 Characters per line 0 = 64 characters per line | + | |
- | 1 = 80 or 132 characters per line | + | |
- | 8 Key that caused transmit hex encoded (see INPUT and (Easy Scan) | + | |
- | 9-10 Location of the cursor when the transmit occurred hex encoded (see INPUT) | + | |
- | 11-14 The handle of the window that generated the read see (CreateWindowEx) and (SelectWindowEx) | + | |
- | 15-16 Location of the cursor when the mouse was clicked hex encoded (see Easy Scan) | + | |
- | 17 COSW major version number see example 2 below | + | |
- | 18 COSW minor version number see example 2 below | + | |
For devices that previously did not return STS (e.g., spoolers): | For devices that previously did not return STS (e.g., spoolers): | ||
- | Byte(s) Description | + | Byte(s) Description |
- | 1-3 Device name | + | 1-3 Device name |
- | 4 type information stored in cfg file by SYSGEN | + | 4 type information stored in cfg file by SYSGEN |
- | 5+ device-specific information | + | 5+ device-specific information |
Also see STS (Winsock gateway). | Also see STS (Winsock gateway). | ||
- | 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. | + | '''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. |
Bytes 11 through 14 were added in Comet2002 Build 306. | Bytes 11 through 14 were added in Comet2002 Build 306. | ||
- | Example 1: | + | '''Example 1:''' |
- | IF F2FLAG$ = "1" THEN GOTO BOTTOM | + | F2FLAG$ = SUB(STS(0),4,1) ! Get F2 status byte |
+ | IF F2FLAG$ = "1" THEN GOTO BOTTOM | ||
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 BOTTOM. | 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 BOTTOM. |
Latest revision as of 12:53, 22 May 2009
STS function
Syntax: STS(lun)
Discussion: The STS function returns the operating status of the specified logical unit number.
Return values: Console/terminals: 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 characters per line 8 Key that caused transmit hex encoded (see INPUT and (Easy Scan) 9-10 Location of the cursor when the transmit occurred hex encoded (see INPUT) 11-14 The handle of the window that generated the read see (CreateWindowEx) and (SelectWindowEx) 15-16 Location of the cursor when the mouse was clicked hex encoded (see Easy Scan) 17 COSW major version number see example 2 below 18 COSW minor version number see example 2 below
For devices that previously did not return STS (e.g., spoolers):
Byte(s) Description 1-3 Device name 4 type information stored in cfg file by SYSGEN 5+ device-specific information
Also see STS (Winsock gateway).
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. Bytes 11 through 14 were added in Comet2002 Build 306.
Example 1:
F2FLAG$ = SUB(STS(0),4,1) ! Get F2 status byte IF F2FLAG$ = "1" THEN GOTO BOTTOM
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 BOTTOM. Example 2: ! Byte 17 of STS(0) now returns the COSW major version number, and ! byte 18 of STS(0) now returns the COSW minor version number.
! COSW Version check Work$ = Sts(0) CoswMajVer = Asc(Sub(Work$, 17, 1)) CoswMinVer = Asc(Sub(Work$, 18, 1))
If (CoswMinVer < 19)
Print "This program uses features that require COSW version 2.19 (Comet build 309) or later." Goto Progend
EndIf
Example 3: Open (LUN) 'sp1'
Jobname$ = sub(sts(lun),5,8) + '.' + sub(sts(lun),1,3)
This example shows how to retrieve the spool job name. The STS function returns the spool name in the first 3 bytes and the spool job number (of the current job) in bytes 5 through 13. To get the full file name you must concatenate these values and add the "." between job number and the spool name.