Introduction MTB Statements File System Compiler Applications Reference Guide Index

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

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 and XAP gateway.

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
The CONTROL statement makes coding easier for the following eComet features:

COOKIE
LOGFILE
MERGE
SEND
REDIR
TYPE
For more information about eComet and the XAP gateway, see the eComet Tutorial.
History: This statement was added to Comet98 in Build 266.
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")