Debugging Business Operations
Often we need to debug a Business Operation. Tracing and logging work but sometimes you want to work with a BO as with your local terminal session.
Here's how you can do that on any operating system.
Windows has a great tool for debugging Business Operations - Foreground mode. In that mode Windows launches a local terminal with operation job.
Note that there's an issue with some InterSystems IRIS versions (older than 2021.1) which caused cterm launch instead of iristerm. To fix that you can either install Caché/Ensemble/HealthShare on a same server or run this reg file:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\cterm] "URL Protocol"="" "(default)"="URL:cterm" [HKEY_CLASSES_ROOT\cterm\DefaultIcon] @="\"C:\\Program Files (x86)\\Common Files\\InterSystems\\IRIS\\bin\\iristerm.exe,1\"" [HKEY_CLASSES_ROOT\cterm\shell] [HKEY_CLASSES_ROOT\cterm\shell\open] [HKEY_CLASSES_ROOT\cterm\shell\open\command] @="\"C:\\Program Files (x86)\\Common Files\\InterSystems\\IRIS\\bin\\iristerm.exe\" %1"
Replacing the path to iristerm.exe with a locally correct one.
Linux does not have official Foreground mode but here's a workaround (at your own risk).
1. Start the Operation with PoolSize=1 and NOT in Foreground mode.
2. Find PID for this BO (Jobs tab).
3. Start new irissession and type:
Do $system.Process.Terminate(<BO JOB>) Do ##class(Ens.Job).Start("BO CONFIGNAME", 1)
And your terminal becomes an Interoperability BO.