My preferred approach would be to use the ZBREAK utility but you could also potentially use ^%SYS.MONLBL. You can use ZBREAK for setting breakpoints or watchpoints or tracing line-by-line execution.  You could even set it at the beginning of your ZAUTHENTICATE routine itself rather than a shell session.  There is a bug with this utility regarding the use of round-brackets for setting a group of variables to a value, which I have documented here and with WRC.

To trace every line of execution:

ZBREAK /TRACE:ALL:"/your/file/location/trace.log"

To trace when particular lines are executed

ZBREAK /TRACE:ON:"/your/file/location/trace.log"
Error^ZAUTHENTICATE:"T"
+42^ZAUTHENTICATE:"T"

To format the log file to remove blank lines for better readability.

sed  '/^$/d' /your/file/location/trace.log

I think it has something to with Unix/Linux status 0 meaning the command executed successfully. Caché ObjectScript error status 0 usually means some error has occurred. $$$LDAPSUCCESS from %syLDAP.inc is defined as 0. The LDAP Error message: LDAP error: 0 - Success is partially hard-coded. Can you verify where your code is getting into the Error label?

#define LDAPSUCCESS $zhex("00")

I am really intrigued by what this device is and what kind of data you are looking to capture...  Is your host device a member of a specific multicast group? In Unix 'netstat -g' can show the multicast forwarding cache and in Windows 'route print' can be useful but might only apply if IP Routing is enabled on your interface in the 'ipconfig /all' output.

In a lab environment, when you ping a multicast address you would expect devices registered with that multicast address to reply with a single unicast response. Routers can also use specific multicast addresses for routing protocols like EIGRP and OSPF.

I was looking for something like the Class Reference guide but for the Nodejs Caché Connector . You are right, the online book I linked Using Node.js with Caché does include the parameters for ip_address and tcp_port.It would be nice if I could somehow tell eclipse's intelli-sense that these options are available.

Can you replace the path variable in the nodeTest.js script with a remote Caché server? How would you do this?

In practice, the majority of artefacts in our Caché instances are .int files.  We have used classes for mapping globals, .NET web development and writing stored procedures. It is nice to be able to call a classmethod from within a .NET application using a tool-generated proxy class. I detest code that jumps all over the place and Xecute statements within globals. Please stop coding this madness! Let's make the world a better place...

I confess some of the .NET software we have calls a classmethod which in turn calls a legacy .int routine with a Do statement and many subsequent Do statements. Not ideal but necessary if you want to avoid re-writing everything on a massive system. You can also use ClassExplorer with your classes and the "comment-style" self-documentation for classes is useful.  Much of the code we support uses the legacy line-based syntax and there is truly no replacement for well-structured, easy-to-read code. It just makes debugging less of a headache. I love line-spacing and curly braces - the simple things you take for granted in other programming languages. I also can't see anyone doing RESTful API development without classes.

Having human-readable, intuitively named class packages rather than hundreds of obscurely named .int routines and globals makes life so much easier. Having a class in a package in a BIO namespace called BIO.Request with CRUD methods reads much better than an interactive programme invoked by do ^REQ. I also like being able to export self-contained class packages rather than trying to work out what .int files and globals I need to export from memory.

Thanks for the comments Robert. It's safe to assume there is an IF statement in each inner-for  to determine whether to do anything or not. Each object in arrayOfIds needs to be opened and a Boolean check is done against a property. I haven't had a problem with the 'N' parameter. The code appears to store 'write' records in process memory before writing everything to file after the outer-for. $ZSTORAGE has been buffed to accommodate this.

// Changes the max-limit on the process memory from the default 16384 Kilobytes
set $ZS=49152

Unique file names have been achieved using the following assumptions:

1) The process will run no more than once a day
2) Append today's date in ODBC format using $zd(+$h,3) to the end of the filename.

The 'close' statement appears after the outer-for but I'm not sure if the curly braces implicitly does it anyway.

// Null check. Close if necessary. (May be implicitly closed by outter-for loop).
if $GET(file1)'="" close file1
if $GET(file2)'="" close file2

If I am modifying a routine I didn't originally write then I tend to stick to the coding style the original author adopted - even it is using legacy syntax. It is good practice not to mix old and new constructs within the same code block ie. don't mix curly braces with line-oriented syntax.  If you are completely re-writing something or writing new code then I prefer curly braces.

I would have liked to re-factor some of my code better but I found the 'use for' construct breaks when you try that. In this pseudocode, I was using the 'write' statement to write to a file on the file system. There is a condition that is checked to determine whether it gets written to file1 or file2.

// Run an extract based on arrayOfIds
for arrayIndex=1:1:arrayOfIds.Count() 
{
       // Continue to loop through array of you detect an errorStatus
      continue:errorStatus'=1
      open file1:("WNS":::):10
      // Inner-for 1
      use file1 for testIndex=1:1:testSetObj.TestCollection.Count()
       {
       }
       open file2:("WNS":::):10
       // Inner-for 2
       use file2 for testIndex=1:1:testSetObj.TestCollection.Count()
       {
       }
// end outter-for

Yes @Eduard Lebedyuk, that is correct. I am thinking of a MVC Core .NET web application that consumes a RESTful API in Caché Objectscript. Thanks @Robert Cemper for your post.