Equinox Online Help - Language Reference - A to Z

Home

ExecuteMindMeld

Applies to
SyntaxExecuteMindMeld TaskID
ActionThis command swaps local, public and system workarea values between the current task and another one identified by TaskID ( the value you get back from the Execute statement in SysResult.).
ScopeUseable anywhere
Notes

This command swaps local, public and system workarea values between the current task and another one identified by TaskHandle (which is the value you get back from the Execute statement in SysResult.). You identify the workareas to be transferred in and out in the normal way using the ExecuteSetData commands. After the ExecuteMindMeld, SysError is zero if it was successful, and SysResult contains the value of SysResult in the remote task, which allows the simplest possible mind meld to use SysResult only.

There are two new system workareas called SysTaskControl and SysTaskStatus, character length 255, which you can use however you like in your methods, however the convention is that the server remote task writes to SysTaskStatus and reads SysTaskControl, and the client task reads SysTaskStatus and writes to SysTaskControl.

You cannot currently interrogate tasks running in other clients (equinets), only ones that run on the server.

CategoryRemote task handling
See Also Execute, ExecuteFalTorPan, ExecuteGetStatus, ExecuteSetDataIn, ExecuteSetData, ExecuteSetDataOut, ExecuteSetMode, ExecuteWaitForTask
Example

This example changes the value of a local workarea called lwNumber

| ==========
| Local.jcl
| ==========
int taskid

ExecuteSetMode -1
execute method "Remote"

if SysError then
Alert "Failed to execute remote task"
exit method
end if

taskid = SysReply
Alert "Started task", taskid

repeat
ExecuteSetData lwNumber
lwNumber = 42

ExecuteMindMeld taskid
Alert "lwNumber: " & lwNumber, \
"SysResult: " & SysResult, \
"SysError: " & SysError
if SysReply < 0 then exit repeat
end repeat

SysResult = 1
ExecuteSetDataOut SysResult
ExecuteMindMeld taskid

Alert "Finishing", SysResult, SysError

repeat
ExecuteMindMeld taskid
Alert "Finished", SysResult, SysError
until SysReply < 0

| ==========
| Remote.jcl
| ==========
SysResult = 0
lwNumber = 0

while not SysResult
lwNumber += 1
print "lwNumber =", lwNnumber
Sleep 5
end while

print "Finished - SysResult =", SysResult

This example runs a database task remotely and monitors its progress via SysTaskStatus

| ======================
| InvoiceRunRemotely.jcl
| ======================
int taskid

ExecuteSetMode -1
execute method "InvoiceRun"

if SysError then
Alert "Failed to execute remote task"
exit method
end if

taskid = SysReply
Message "Running invoice task"

repeat
ExecuteSetDataIn SysTaskStatus
ExecuteMindMeld taskid

if SysError then exit repeat
Statusline SysTaskStatus

sleep 1, 10
end repeat

Message ""
Statusline ""

| =================
| InvoiceRun.jcl
| =================
subtable Customer
Setindex iCustName
FirstRecord

while not SysError
SysTaskStatus = CustName
ProcessMonthlyInvoice
NextRecord
end while
end subtable | Customer

SysTaskStatus = "Finished"
Sleep 5