"Unfortunately" ECP is the only method to connect remote databases. Maybe it's a license-server-problem. Could you please check that both instances are using the same license server?

Let's say, both systems are placed in a domain jetsons.com. There are two systems each of them has a Caché-instance running. System-1 is called betty and system-2 called wilma. 

So we have:
System1: betty.jetsons.com / Caché-Instance = barney
System2: wilma.jetsons.com / Caché-Instance = fred

System1: License-Port = 4001 (you may use another port instead of default), License-Server = betty.jetsons.com
System2: Same licensing-information as on System1 (betty.jetsons.com:4001 (or another port you defined there)

After doing so, restart both instances and check cconsole.log if license server was started on both systems.

And if that doesn't help then you should contact WRC.

Please keep in mind that the service ECP (Administration -> Security -> Services) must be running.

Maybe you need an upgrade of the license. I remember that we had to do it when we installed a newer version. To do so you also have to contact Intersystems-WRC

Hope, that will help you :-)

You could also use the class  %SYS.Journal.File

Example:
Set JournalFile = ##class(%SYS.Journal.File).%OpenId(EXISTING_JOURNAL_FILE)
Set JournalRecord = JournalFile.FirstRecordGet()
While (JournalRecord '= "") {
  Here you can program your search criteria example:
  If JournalRecord.%IsA("%SYS.Journal.SetKillRecord") {
   insert your code
}
}

Check documentation for further hints.
 

The documentation might be a little bit long, so I try to make it short. If you write down some kind of logic in COS and save it, then you'll get a routine. The easiest  way to create a routine is this, using a terminal session: ZR<ret><tab>WRITE $H<ret>ZS<space>MYROUTINE. (<this are the corresponding control characters>)Doing so, you'll get an INT file called MYROUTINE.INT. You can see it using %RD in a terminal session in the namespace where you saved the routine. You can run it using the command DO ^MYROUTINE or GO ^MYROUTINE

A routine may contain some labels (some name ended with a TAB) which you can use as functions or procedures. A routine is comparable with a class but you can't instanciate a routine like you can do with a class and it does not contain methods or classmethods.

Global is an array stored on disk. It is a nice datastructure to save your data. A routine can write, store or delete some data stored in Global.

Hope this helps to make the things clear to you

Hello Paras,

you can't modify $ZIO. When you create a file ABC_1.txt, $ZIO points to this file. When you create a file ABC_2.txt then $ZIO points to this file. Because Unix doesn't know version numbers, you must implement your own file version counter into your  library.
We were confronted with the same problem. We solved it by checking the existing files (doing a directory listing into a local array) estimate the highest version number and incremented 1 to that number. After getting the latest file version number we create the filename. We wrote a wrapper around the class %Library.File.

I know, that it is not perfect to browse the current directory to find all files and extract the version number out of a part of the filename. But I didn't find a better solution.

Best regards
Hans-Peter

Hello Paras,

to understand the way Caché distinguishes between the files, you can use the special variable $ZIO. This returns the full filename.

Example: SET FILE="ABC.TXT" O FILE:"N" USE FILE SET FULLFILE=$ZIO USE $PRINCIPAL WRITE $ZIO
If you run this example in two separate terminal sessions then you see, that the version number is incremented. When you do this in the same terminal session and don't close the file then the version number is NOT incremented. The fileversion will be incremented, when the file has been closed (... USE FILE SET FULLFILE=$ZIO CLOSE FILE OPEN FILE:"N" USE FILE SET FULLFILE=$ZIO...).
When you check the content of FULLFILE you'll find the full filename including the version number.

When another process does the same, another file handle is created and if you check $ZIO then you'll see, that this process is using another file version.

At first sight it might be very cool to have code for methods in a few  lines. It is the way of programming we had in the past times. I can't recommend to use this way of coding, because it makes it very hard to read and understand the logic of code. I grew up with this kind of coding so I am very familiar with this but I am happy that Caché gives me the way to code in a modern style. When I look into my old programs, which consist of this kind of coding, then I always feel to read ugly code. I would like to change it immediately. Forget it to compact the code in one line. Put it into more lines and avoid postconditionals. If-statements are more readable and you don't have to think about what the code will do.

Nice satiric article smiley

You can call methods from command line even like you call routines. Imagine you have a class Test in package TestClasses and a method printData which prints the data to your output device. Then you can call csession instance -"U" namespace "##class(Test).printData("""data""")".

Of course the methods must be ClassMethods. You must test the number of " - signs.  In PowerShell for instance I needed around 14(! sic) "-signs to send a valid command to Caché.

Here the example:

csession ${INSTANCE} -"U" ${NAMESPACE}  "##class(TestClasses.Test).printData(""""""""""""""hello"""""""""""""")"

hello