IBM Support

Calling a module from another module in Robot scripts

Troubleshooting


Problem

This technote illustrates how to call a subroutine or function from a library in IBM® Rational® Robot. In some cases users want to call a subroutine or function from another library, or a library calls something from another library.

Resolving The Problem

All call scripts must include declarations of header file.The library file declares subroutine in itself. Then you can make functional calls in the same way like other subroutine calls.

In this example the first library LibTest1 calls the subroutine SubTest2 in library LibTest2. The libraries can be either .rec files or .sbl files.

' Library name: LibTest1
'$Include: "global.sbh"
Declare Sub SubTest1
Sub Main
    Dim Result As Integer

    SubTest1
    SubTest2

End Sub


Sub SubTest1
      MsgBox "LibTest1"
End Sub


' Library name: LibTest2
Declare Sub SubTest2
Sub Main
     Dim Result As Integer

     SubTest2

End Sub


Sub SubTest2
     MsgBox "LibTest2"
End Sub

' Header: global.sbh
Declare Sub SubTest2   BasicLib "LibTest2"

Note: The header global.sbh declares SubTest2 in LibTest1.


Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Scripting","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2003.06.00;2003.06.10;2003.06.12;2003.06.13;2003.06.14;2003.06.15;2003.06.16;7.0;7.0.0.1;7.0.1;7.0.0.3;7.0.1.2;7.0.0.4;7.0.1.3;7.0.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21281444