I suggest the following strategy:

  • Read line
  • If $Length(line,"""")#2=1 then you have a complete CSV line (an even number of doublequotes)
  • Otherwise read line2 and append it to line. Repeat this until $Length(line2,"""")#2=1. If you reach the end of the file before this happens, the CSV source is malformed.

In the above algorithm you may want to cater for the case where concatenation of consecutive lines would exceed the maximum local string length.

My proposal:


USER>w csv
ABC Company,"123 Main St, Ste 102","Anytown, DC",10001,234-567-8901
USER>s i=0
 
USER>f  s i=$f(csv,",",i) q:'i  i $l($e(csv,1,i-2),"""")#2 s $e(csv,i-1)=$c(9)
 
USER>w csv
ABC Company     "123 Main St, Ste 102"  "Anytown, DC"   10001   234-567-8901
USER>
Without abbreviations:

USER>write csv
ABC Company,"123 Main St, Ste 102","Anytown, DC",10001,234-567-8901
USER>set i=0
 
USER>for  set i=$find(csv,",",i) quit:'i  if $length($extract(csv,1,i-2),"""")#2 set $extract(csv,i-1)=$char(9)
 
USER>write csv
ABC Company     "123 Main St, Ste 102"  "Anytown, DC"   10001   234-567-8901
USER>

How about this?

SAMPLES>s sc=$system.OBJ.Export("/csp/samples/*.csp","c:\s\junk.xml","/recursive=1")
 
Exporting to XML started on 10/29/2018 09:36:31
Exporting CSP/CSR or file: /csp/samples/basic.csp
Exporting CSP/CSR or file: /csp/samples/cinema/Cinema.csp
Exporting CSP/CSR or file: /csp/samples/cinema/Film.csp
Exporting CSP/CSR or file: /csp/samples/cinema/LoadData.csp
Exporting CSP/CSR or file: /csp/samples/cinema/Order.csp
Exporting CSP/CSR or file: /csp/samples/cinema/Search.csp
Exporting CSP/CSR or file: /csp/samples/cinema/SearchResults.csp
Exporting CSP/CSR or file: /csp/samples/cinema/ShowTimes.csp
Exporting CSP/CSR or file: /csp/samples/cinema/TopPicks.csp
Exporting CSP/CSR or file: /csp/samples/context.csp
Exporting CSP/CSR or file: /csp/samples/cookie.csp
Exporting CSP/CSR or file: /csp/samples/custom.csp
Exporting CSP/CSR or file: /csp/samples/error.csp
Exporting CSP/CSR or file: /csp/samples/expires.csp
Exporting CSP/CSR or file: /csp/samples/form.csp
Exporting CSP/CSR or file: /csp/samples/formsubmit.csp
Exporting CSP/CSR or file: /csp/samples/include.csp
Exporting CSP/CSR or file: /csp/samples/includedpage.csp
Exporting CSP/CSR or file: /csp/samples/inspector.csp
Exporting CSP/CSR or file: /csp/samples/iterate.csp
Exporting CSP/CSR or file: /csp/samples/language.csp
Exporting CSP/CSR or file: /csp/samples/logerror.csp
Exporting CSP/CSR or file: /csp/samples/loop.csp
Exporting CSP/CSR or file: /csp/samples/lottery.csp
Exporting CSP/CSR or file: /csp/samples/lotteryend.csp
Exporting CSP/CSR or file: /csp/samples/lotteryhistory.csp
Exporting CSP/CSR or file: /csp/samples/lotteryjoin.csp
Exporting CSP/CSR or file: /csp/samples/lotterymain.csp
Exporting CSP/CSR or file: /csp/samples/lotterymenu.csp
Exporting CSP/CSR or file: /csp/samples/menu.csp
Exporting CSP/CSR or file: /csp/samples/object.csp
Exporting CSP/CSR or file: /csp/samples/popform.csp
Exporting CSP/CSR or file: /csp/samples/private.csp
Exporting CSP/CSR or file: /csp/samples/protected.csp
Exporting CSP/CSR or file: /csp/samples/protectedentry.csp
Exporting CSP/CSR or file: /csp/samples/query.csp
Exporting CSP/CSR or file: /csp/samples/redirect.csp
Exporting CSP/CSR or file: /csp/samples/rulemgr.csp
Exporting CSP/CSR or file: /csp/samples/serversideredirect.csp
Exporting CSP/CSR or file: /csp/samples/sessionevents.csp
Exporting CSP/CSR or file: /csp/samples/showsource.csp
Exporting CSP/CSR or file: /csp/samples/soapdemo.csp
Exporting CSP/CSR or file: /csp/samples/staticsql.csp
Exporting CSP/CSR or file: /csp/samples/streamserve.csp
Exporting CSP/CSR or file: /csp/samples/submit.csp
Exporting CSP/CSR or file: /csp/samples/svgdemo.csp
Exporting CSP/CSR or file: /csp/samples/testerror.csp
Exporting CSP/CSR or file: /csp/samples/textinclude.csp
Exporting CSP/CSR or file: /csp/samples/upload.csp
Exporting CSP/CSR or file: /csp/samples/wapzipcode.csp
Exporting CSP/CSR or file: /csp/samples/while.csp
Exporting CSP/CSR or file: /csp/samples/xmlclasses.csp
Exporting CSP/CSR or file: /csp/samples/xmlclasseserror.csp
Exporting CSP/CSR or file: /csp/samples/xmlclassesresult.csp
Exporting CSP/CSR or file: /csp/samples/xmlimport.csp
Exporting CSP/CSR or file: /csp/samples/xmlquery.csp
Exporting CSP/CSR or file: /csp/samples/xmlqueryresult.csp
Exporting CSP/CSR or file: /csp/samples/zipcode.csp
Export finished successfully.
 
SAMPLES>

I don't believe it's possible for the CACHESYS database (the one that sits behind the %SYS namespace) to be added to the mirror, because each member of the mirror needs to store instance-specific data there.

I've seen sites write their own scripts to export users, roles etc periodically from the master instance into files and import them into the other(s). For example, the Export method of Security.Users

But it's long puzzled me that InterSystems doesn't seem to have done this job for us all. Or perhaps they have, and I haven't yet heard about it.

Daniel, if your team benefits from working in a shared namespace but you'd still like source control, please consider using Deltanji from George James Software. This is a powerful and mature tool which runs natively within Caché / Ensemble / IRIS environments and integrates with Atelier, Studio and Portal editors.  It is extensively used around the world, including at NHS sites.

A couple of years after my original post, we at George James Software got inspired to have another look at Visual Studio Code. And at Global Summit this week we premiered our upcoming extensions.

You can watch a video of my flash talk here. 

https://youtu.be/1146vFuHoI8?t=1263

If you want to be notified when it is available  please email your request to info@georgejames.com

When the Terminal shortcut connects to your local Cache instance it does so directly and doesn't use telnet. The presence of TRM in the window title confirms that you're connecting that way, so you're not using the telnet service.

Since you're able to use Portal, please go to System Administration > Security > Auditing. If auditing isn't already turned on, do that, then repeat the failed connect. Back in Portal use the audit viewer to see if there are any clues.

In Portal's Security section, check that your %Service_Console service is enabled.

What authentication methods does it accept?

The fact that your Terminal doesn't prompt for Username makes me think the service doesn't allow Unauthenticated. That's fair enough. But given that you used to be able to connect and now you can't, it looks like something changed on the config or the status of this Cache instance.