Hi Alexander,

Bypass is easy, and I've already suggested it in my initial post.
As to use cases... maybe I'll describe them later. The method of journal switch detection is not critical for them.

Thank you anyway.

No, it works and all installations but yes, it needs 8 Bit  characters

It needs Unicode characters as well, otherwise it fails. Just compare 8 bit instance run: 

USER>w "IsUnicode = ",$zbitget($zversion(0),1)
IsUnicode = 0
USER>s x="f i=1:1:100 w:i#3=0 ""Fizz"" w:i#5=0 ""Buzz"" w:'$x i w ! " w $l(x)
54
USER>s xx=$zwpack(x)
 
S xx=$ZWPACK(x)
^
<WIDE CHAR>

with Unicode one:

USER>w "IsUnicode = ",$zbitget($zversion(0),1)
IsUnicode = 1
USER>s x="f i=1:1:100 w:i#3=0 ""Fizz"" w:i#5=0 ""Buzz"" w:'$x i w ! " w $l(x)
54
USER>s xx=$zwpack(x)
USER>x $zwunpack(xx)
1
2
Fizz
...

Hi James,

Agree with you, parsing terminal output is not the smartest solution. I always try to avoid it using intermediate files. E.g. (from real life):

rm -f $mydir/db_temp
NspToCheck=$nspace

csession $instance -U%SYS << EOF > /dev/null
set fn="$mydir/db_temp"
o fn:("WNS"):1 u fn
try {
  zn "$NspToCheck"
  w \$s(\$zu(5)=\$zcvt("$NspToCheck","U"):\$zutil(12,""),1:"$NspToCheck")
} catch {
  w \$p(\$ze,">")_">"
}
c fn
h
EOF

DbQms=$(cat "$mydir/db_temp")

Here the default DB of the namespace $NspToCheck (or $ZError code) is written to $mydir/db_temp file, than it goes to $DbQms shell variable and processed as needed.

Initial answer was amended.

Sorry, didn't mentioned your *new* quesion about environment variables.

After cheching my großbuch I found that I was wrong with starting version: $zf(-100) is available since 2017.2.1 (Build 801_3), while your build hasn't got this "_3" suffix.

Zdeněk,

I'm just curious: are you intentionally testing $zf() stuff on command (`pwd`) that doesn't exist in your particular OS?

Hi Murray,

Thank you for responding.

You mentioned earlier that switching to Direct I/O would slow down Caché On-line Backup; it sounded strange for me: if database I/O and journal I/O can use different strategies, why On-line Backup can't always use buffered I/O regardless of database I/O strategy?

Murray,

Do you recommend this setting (wduseasyncio=1) for production as well? If it slows down all disk i/o, what will happen with journaling?

I use the similar code for the same purpose and it works. Here is my (debug) version has been written awhile ago: 

  ; In:
  ; pFirst - 1st journal file,
  ; pLast - last journal file,
  ; pSDB - source DB directory where journals were generated,
  ; pTDB - target DB directory where journals should be applied
  ;
  ; Sample:
  ; zn "test" set target=$zu(12,""), source=target ; start in target namespace assuming source == target
  ; k ^mtempfilt ; if you injected your ZJRNFILT
  ; d jrnrest^ztestFF("20190917.001","20190919.008",source,target)
  ; zwrite ^mtempfilt
  ; 
 
jrnrest(pFirst,pLast,pSDB,pTDB)

 new (pFirst,pLast,pSDB,pTDB) ;de!!!
 new $namespace $namespace="%SYS"
pLast=$g(pLast,pFirst)
pSDB=$g(pSDB,$zu(12)_"user\")
pTDB=$g(pTDB,$zu(12)_"test\")
RestOref=##class(Journal.Restore).%New()
RestOref.FirstFile=pFirst
RestOref.LastFile=pLast
RestOref.RollBack=0 ;? default = 1
!,pFirst_" to "_pLast_"; "_pSDB_" => "_pTDB_" OK?" ans#1 ! quit:"nN"[ans
sc=RestOref.RedirectDatabase(pSDB,pTDB) if 'sc jrnbad
sc=RestOref.SelectUpdates(pSDB) if 'sc jrnbad ; all globals; need it to fire RedirectDatabase
RestOref.Filter="^ZJRNFILT1" ; means nothing as ^ZJRNFILT is always used
t0=$zh
CHATTY=0 ; has no effect
sc=RestOref.Run() if 'sc jrnbad
t1=$zh
"sc="_sc_" dt="_$fn(t1-t0,"",3),!
jrnbad
 if $g(sc)'="",'sc $system.Status.DisplayError(sc)
 quit