!ASYNC subroutine
Syntax
CALL !ASYNC (key, line, data, count, carrier)
Description
Use the !ASYNC subroutine (or its synonym !AMLC) to send data to, and receive data from an asynchronous device.
key defines the action to be taken (1 through 5). The values for key are defined in the following list:
line is the number portion from the &DEVICE& entry TTY##, where ## represents a decimal number.
data is the data being sent to or received from the line.
count is an output variable containing the character count.
carrier is an output variable that returns a value dependent on the value of key. If key is 1, 2, or 3, carrier returns the variable specified by the user. If key has a value of 4 or 5, carrier returns 1.
You must first assign an asynchronous device using the ASSIGN command. A entry must be in the &DEVICE& file for the device to be assigned with the record ID format of TTY##, where ## represents a decimal number. The actions associated with each key value are as follows:
- key
- Action
- 1
- Inputs the number of characters indicated by the value of count.
- 2
- Inputs the number of characters indicated by the value of count or until a linefeed character is encountered.
- 3
- Outputs the number of characters indicated by the value of count.
- 4
- Returns the number of characters in the input buffer to count. On operating systems where the FIONREAD key is not supported, 0 is returned in count. When the value of key is 4, 1 is always returned to carrier.
- 5
- Returns 0 in count if there is insufficient space in the output buffer. On operating systems where the TIOCOUTQ key is not supported, 0 is returned in count. When the value of key is 5, 1 is always returned to carrier.
Example
The !ASYNC subroutine returns the first 80 characters from the device defined by ASYNC10 in the &DEVICE& file to the variable data.
data=
count= 80
carrier= 0
call !ASYNC(1,10,data,count,carrier)