The machine handle operator lets you specify in a convenient, readable way the target machine for a function to be executed by the Agent in a distributed testing environment. Use it to override the default machine specified for the current thread.
For more information about the SYS_File functions that work with target machines, see Functions by Programming Task and About File Handles.
There are two forms for the machine handle operator: arrow (hMachine->) and bracket ([hMachine]).
To specify a machine handle for a function with the arrow form, type:
hMachine -> distrib_func
To specify a machine handle for a function with the bracket form, type:
[hMachine] distrib_func
[ ] hMachine -> SYS_SetDir () [-] [hMachine] SYS_SetDir () [ ] [-] for each sMachine in lsMachine [ ] [sMachine] TextEditor.Search.Find.Pick [ ] [ ] ARRAY[20] of STRING machArray [ ] // Initialize array [ ] ... [-] for INTEGER I = 2 to 5 [ ] [machArray[i]] TextEditor.Search.Find.Pick
[-] for each sMachine in lsMachine [ ] spawn // start thread for each sMachine [ ] SetMachine (sMachine) [ ] // ... code executed on sMachine [ ] [ ] ["server"]doThis() // code executed on "server" [ ] [ ] // ... continue with code for sMachine [ ] rendezvous
The bracket form has the advantage over the arrow form because it allows any expression to supply the machine handle. The arrow form requires the machine handle to be addressable.
Type casting is valid within the machine operator. This means you can specify the string form of the machine name instead of the handle form. Thus the following four statements accomplish the same thing if hMachine is the handle returned by Connect ("MyMachine"):
hMachine -> SYS_SetDir () [hMachine] SYS_SetDir () "MyMachine" -> SYS_SetDir () ["MyMachine"] SYS_SetDir ()