Attachmate Worldwide  |   Contact Us  |   The Attachmate Group
Extend. Manage. Secure. More than 30 years in the business. Over 65,000 customers.

Technical Notes

Sending RB Commands from a Host Program
Technical Note 1279
Last Reviewed 15-Nov-2011
Applies To
Reflection for UNIX and OpenVMS 2011
Reflection for UNIX and OpenVMS 2008
Reflection for UNIX and OpenVMS version 14.x
Reflection Standard Suite 2011
Reflection Standard Suite 2008
Reflection for HP version 14.x
Reflection for ReGIS Graphics version 14.x
Summary

Reflection can execute Reflection Basic (RB) commands sent from a host program. This technical note describes the syntax used in the host program and explains how to effectively use completion codes returned by Reflection.

For an overview of how host-initiated programs work with Reflection, refer to Technical Note 1223.

For information about executing host-initiated Reflection Basic commands using VBA, see Technical Note 2148.

Sending Commands to Reflection

RB is the recommended language for writing host-initiated programs that perform complex procedures or use OLE (object linking and embedding) technology. To send a single command from a host program to Reflection, you may want to use the Reflection Command Language (RCL) instead. See Technical Note 1278 for details.

RB commands are procedural and can extend over multiple lines. An RB script contains multiple commands, beginning with Sub Main and ending with End Sub.

To send an RB script from a host program to Reflection, place the entire script within the following elements for your emulation type. Note that individual commands within the script are separated by a carriage return.

HP Emulation

Syntax

<ESC>&o<tag>t<term>G<RB script><ESC>&oH

Example

<ESC>&o1GSub Main
    Dim c As Integer
    c = Val(InputBox$("Enter the sales amount:"))
    MsgBox "Your commission is: " & c
End Sub<ESC>&oH


<ESC> is described in Generating Special Characters below.

<tag>t is an optional tag used to associate a return value with a host-initiated command.

<term> specifies whether or not reflection returns a completion code to the host program. See Specifying Completion Codes below for acceptable values.

VT Emulation

Syntax

<DCS>2000;<term>;<tag>{<commands><ST>

Example

<DCS>2000;1{ Sub Main
    Dim c As Integer
    c = Val(InputBox$("Enter the sales amount:"))
    MsgBox "Your commission is: " & DisplayCommission(c)
End Sub <ST>

<DCS> and <ST> are described in Generating Special Characters below.

<term> specifies whether or not reflection returns a completion code to the host program. See Specifying Completion Codes below for acceptable values.

<tag>t is an optional tag used to associate a return value with a host-initiated command.

Wyse Emulation

Syntax

<esc>\01772000;{

Example

#!/bin/sh
echo "\033\01772000;{"
echo "Sub Main"
echo "dim ie as object"
echo 'set ie = CreateObject("InternetExplorer.Application")'
echo 'ie.Navigate "http://www.attachmate.com"'
echo "ie.Visible = true"
echo "End Sub"
echo "\033\\"

Generating Special Characters

Use the values and key combinations below to properly generate the following special characters in your host programming language.

ASCII and 7-Bit Values

Special characters
Decimal
Hexadecimal
Octal
7-bit
<CR>
13
0D
15
-
<ESC>
27
1B
33
-
<DCS>
144
90
220
<ESC>+P
<ST>
156
9C
234
<ESC>+\

Specifying Completion Codes

Although many choices are available, we recommend that you use one of the following values for <term>. Other options are described in your Reflection documentation.

1
Always return a completion code
2
Never return a completion code

How Completion Codes are Returned

Reflection returns completion codes to the host program in the following format:

!RB!snnnnnn;<CR>

where

!RB!
identifies the completion code as coming from Reflection.
s
is either a minus sign (-) for a negative number or a zero (0) for a positive number.
nnnnn
represents a Reflection-trappable error code.
<CR>
signifies the end of the completion code. (In most cases, this is stripped out by the host when the completion code is read.)

Examples of Reflection Error Codes

A complete list of error codes returned by Reflection is included in the online help provided with the Reflection Basic Editor. The table below lists only the most common error codes.


Error Code
Symbolic Error Name
Meaning
10005
rcErrTimeout
Method timed out.
10009
rcErrOperationFailed
The Reflection API call failed.
10066
rcErrAlreadyConnected
A connection is currently active.
10067
rcErrConnectionError
General connection error.
10069
rcErrReflectionBusy
Reflection is busy.
Related Technical Notes
1223 How to Send Reflection Commands from the Host
1278 Sending RCL Commands to Reflection from a Host Program
1280 Host Programs that Initiate File Transfers with Reflection
2148 Executing Host-Initiated Reflection Basic Commands through VBA

horizontal line

Did this technical note answer your question?

           


Need further help? For technical support, please contact Support.