IB Statements/control

From CometWiki

Jump to: navigation, search

CONTROL statement

Syntax: result-string = CONTROL(lun,control-string [,EXCP=statement-label])

Discussion: The CONTROL statement is a general-purpose control statement for the Winsock gateway, XAP gateway, ODBC gateway, serial gateway, and "universal gateway" (for example, the Comet fax driver).

The CONTROL statement sends the specified control-string to the specified logical unit number.

The CONTROL statement also reads the result field from the input buffer and places it in the result-string. A plus sign (+) in the first byte of the result-string indicates that the control function was performed successfully. A minus sign (-) in the first byte indicates that the control was not performed successfully. The remaining bytes of the result-string contain text describing the success or failure of the control function.

The control statement can be used in any situation where a file control results in a return code being automatically placed in the user's buffer. If a file control does not place a result code or string in the buffer, the second part of the control statement will road-block the program waiting for the next input from the driver.

For example, the CONTROL statement performs the same function as the following statements:

FILE (lun) CTL=control-string INPUT (lun) result-string


History: This statement was added to Comet98 in Build 266.

Winsock Examples:

 A$ = CONTROL(lun,"CLOSE")
 A$ = CONTROL(lun,"CONNECT server port")
 A$ = CONTROL(lun,"CRLF flag")
 A$ = CONTROL(lun,"DISCONNECT")
 A$ = CONTROL(lun,"GETERROR")
 A$ = CONTROL(lun,"LISTEN [port]")
 A$ = CONTROL(lun,"OPEN server port")
 A$ = CONTROL(lun,"QUIT")
 A$ = CONTROL(lun,"TIMEOUT value")
 A$ = CONTROL(lun,"WEOL flag")


XAP Examples:

 A$ = CONTROL(0, "COOKIE CART=EMPTY")
 A$ = CONTROL(0, "LOGFILE c:\test\cgilog.txt")
 A$ = CONTROL(0, "MERGE C:\MILLION.HTM")
 A$ = CONTROL(0, "SEND C:\SAMPLE.HTM")
 A$ = CONTROL(0, "REDIR http://www.signature.net")
 A$ = CONTROL(0, "TYPE 3")
Personal tools