MODEMRESP        Read modem response

Top  Previous  Next

Syntax:

MODEMRESP

[ variable ]  [ /options ]

Arguments:

[ variable ]

A variable to store characters read from the modem; if the variable does not previously exist, it is created

Options:

/flush

Flush the receive buffer before starting read

 

/length=xx

Maximum number of characters to receive; if not specified the maximum of 1020 characters is used

 

/timeout=nn

Time-out in seconds to wait for a character to be received; the default time-out is 3 seconds

 

 

This script command reads the response from a command sent to a Hayes compatible modem with the MODEMCMD script command. It is not required to read the response from the modem when a command is sent, but you may optionally use this command to confirm that a modem is present or is properly responding to commands. The /enableresp option is required on the MODEMCMD command prior to calling MODEMRESP.

 

In the following example, the variable ‘resp’ will contain the response from the modem. The response is likely to be AT which will be the modem echoing back the command.

 

       MODEMCMD "AT" /enableresp

       MODEMRESP resp

 

Typically your script should continue call MODEMRESP until the three-second time-out expires. This way you will be sure to get all of the characters of the response. So, your script might look like the following.

 

       ; send AT command to modem

       MODEMCMD "AT" /enableresp

       :resp_loop

       MODEMRESP resp

       IFERROR= $ERROR_OPTIMEDOUT GOTO end of_resp

       ; do something meaningful here with the responses...

       ; ...

       GOTO resp_loop

       : end of_resp

 

Related Command(s):        MODEMCMD, DIAL, ANSWER