So  %SYS>d ^TRACE might be a useful start

This utility traces the execution of a process.  Traced processes write events
to a trace file with details about the routine line where the event occurred
and, if applicable, the global reference.  The events available for tracing
correspond to the metrics availabe in performance monitoring tools (PERFMON,
%SYS.MONLBL etc).  Raw data is written to iristrace_<pid>.txt in the
configured directory, and is then parsed and displayed by this utility.
 
 
Trace file directory:   not set
Trace file size limit: unlimited
Trace events selected:  RtnLoad, GloRef, BlockWait, NCacheMiss, DirBlkRd
   UpntBlkRd, BpntBlkRd, DataBlkRd, BdataBlkRd, MapBlkRd, OthBlkRd
 
1) Configure Trace
2) Trace Process (Foreground)
3) Start Background Trace
4) Stop Background Trace
5) Display Trace Files
6) Delete All Trace Files
 
Option?

It might be great to remove the related refences also
from official documentation
Py
https://docs.intersystems.com/components/csp/docbook/Python-Native/v1.0.0/irisnative.iris.html#irisnative.iris.function

Nodes.js
https://docs.intersystems.com/components/csp/docbook/NodeJS-Native/v2019.2/external-_intersystems-iris-native_.Iris.html

Java
https://docs.intersystems.com/iris20201/csp/docbook/DocBook.UI.Page.cls?KEY=BJAVNAT_call#BJAVNAT_call_function

.NET
https://docs.intersystems.com/iris20201/csp/docbook/DocBook.UI.Page.cls?KEY=BNETNAT_call#BNETNAT_call_function

Also Class reference for 2025.1
https://docs.intersystems.com/iris20251/csp/documatic/%25CSP.Documatic.cls?LIBRARY=%25SYS&CLASSNAME=%25Net.DB.Iris#Function

like this:
Calls a function (label^routine), passing zero or more arguments and returning the function's return value. Trailing arguments may be omitted, causing default values to be used for those arguments.

This method throws an exception when an error condition is encountered.

routineName

input

The name of the routine that implements the function to be called.

functionName

input

The name of the function to be invoked.

args

input...

The arguments to be passed to the method.

 

return

The value returned by the functionName function.


  • Such a misleading documentation roughly 1.5 years behind reality is not so impressive
  • It took days to find this out.  😖

>> Naming in ObjectScript has a historic background 
In the beginning, the grand-grandfather of IRIS was a full-stack operating system
And it was running on machines with only 64 KBytes of memory
So saving space in memory was the highest virtue of a developer then.
Consequently, all names were as short as short could be.
Typically using single-character named variables.
And A was different from a to widen the available scope
Over the years, this was kept for backward compatibility and to decrease the fear of upgrades
And I have seen customers running 40+ year old code also in IRIS without any bit changed.

In your screenshot, I see 

$('<div>') simpledialog2(

But W3Schools says:
https://www.w3schools.com/Jquery/jquery_syntax.asp

Basic syntax is: $(selector).action()
  • A $ sign to define/access jQuery
  • A (selector) to "query (or find)" HTML elements
  • A jQuery action() to be performed on the element(s)

I didn't write JavaScript for decades, and I'm not an expert.
BUT: I fail to detect the point after the closing bracket
It was just my Studio that marked it as an error.

created with NPI

you could try to set your terminator to null String "". 
it is optional accordig to docs
https://docs.intersystems.com/iris20251/csp/docbook/DocBook.UI.Page.cls?KEY=GIOD_tcp#GIOD_tcp_open

  • terminators

Optional — A list of up to eight user terminator characters that will terminate reads on the TCP binding device. If you specify both T mode and terminators at the same time, T mode is ignored.

I wonder how you expect to know that your input is complete without any terminator.
And according to your example, you also don't have a fixed length:
Withoit an clear signal timeout seems to be the only way to know you are complete.

You may read input character by character without guarantee  
how do decide for 1 or 10 or 100 or 1000  ?
Some ending character (eg. not numeric) or a fixed length is required