method FindAt(position As %Integer, target As %CacheString, ByRef tmpstr As %CacheString = "", caseinsensitive As %Boolean = 0) as %Integer

Find the first occurrence of target in the stream starting the search at position. It returns the position at this match starting at the beginning of the stream. If it does not find the target string then return -1. If position=-1 then start searching from the current location and just return the offset from the last search, useful for searching through the entire file. If you are doing this you should pass in tmpstr by reference in every call which is used as a temporary location to store information being read so the next call will start where the last one left off. If you pass caseinsensitive=1 then the search will be case insensitive rather than the default case sensitive search.

Copy to String may help but is limited by MAXSTRING size.
There you may use [  (=contains OPERATOR) or $FIND() function

Don't mix up SQL predicate %CONTAINS  with [  (string contains operator)

  •  

I have added a new version  for the GLOBALS contest
To take care of large Globals that may break your available memory.
The JSON Object is exported to a file. and there is also the related loader

New Version 0.1.0

USER>write ##class(dc.GblToJSON.EX).export("^dc.MultiD")
File gbl.json created

And the related loader creates the Global

USER>write ##class(dc.GblToJSON.EX).import()
Global ^dc.MultiD loaded

It is of course also available in the Online Demo facility.  
And to see the generated file there is a show() method

USER>write ##class(dc.GblToJSON.EX).show()
{"gbl":[
{"node":"^dc.MultiD","val":5},
{"node":"^dc.MultiD(1)","val":"$lb(\"Braam,Ted Q.\",51353)"},
{"node":"^dc.MultiD(1,\"mJSON\")","val":"{}"},
{"node":"^dc.MultiD(2)","val":"$lb(\"Klingman,Uma C.\",62459)"},
{"node":"^dc.MultiD(2,2,\"Multi\",\"a\")","val":1},
{"node":"^dc.MultiD(2,2,\"Multi\",\"rob\",1)","val":"rcc"},
{"node":"^dc.MultiD(2,2,\"Multi\",\"rob\",2)","val":2222},
{"node":"^dc.MultiD(2,\"Multi\",\"a\")","val":1},
{"node":"^dc.MultiD(2,\"Multi\",\"rob\",1)","val":"rcc"},
{"node":"^dc.MultiD(2,\"Multi\",\"rob\",2)","val":2222},
{"node":"^dc.MultiD(2,\"mJSON\")","val":"{\"A\":\"ahahah\",\"Rob\":\"VIP\",\"Rob2\":1111,\"Rob3\":true}"},
{"node":"^dc.MultiD(3)","val":"$lb(\"Goldman,Kenny H.\",45831)"},
{"node":"^dc.MultiD(3,\"mJSON\")","val":"{}"},
{"node":"^dc.MultiD(4)","val":"$lb(\"\",\"\")"},
{"node":"^dc.MultiD(4,\"mJSON\")","val":"{\"rcc\":122}"},
{"node":"^dc.MultiD(5)","val":"$lb(\"\",\"\")"},
{"node":"^dc.MultiD(5,\"mJSON\")","val":"{}"}
]}
***** gbl.json *****

I have added a new version  for the GLOBALS contest
To take care of large Globals that may break your available memory.
The JSON Object is exported to a file. and there is also the related loader

New Version 0.1.2

USER>write ##class(dc.GblToJSON.CX).export("^dc.MultiD")
File gbl.json created

And the related loader creates the Global

USER>write ##class(dc.GblToJSON.CX).import()
Global ^dc.MultiD loaded

It is of course also available in the Online Demo facility.

And to see the generated file there is a show() method

USER>write ##class(dc.GblToJSON.CX).show()
{"gbl":[
"^dc.MultiD=5",
"^dc.MultiD(1)=$lb(\"Braam,Ted Q.\",51353)",
"^dc.MultiD(1,\"mJSON\")=\"{}\"",
"^dc.MultiD(2)=$lb(\"Klingman,Uma C.\",62459)",
"^dc.MultiD(2,2,\"Multi\",\"a\")=1",
"^dc.MultiD(2,2,\"Multi\",\"rob\",1)=\"rcc\"",
"^dc.MultiD(2,2,\"Multi\",\"rob\",2)=2222",
"^dc.MultiD(2,\"Multi\",\"a\")=1",
"^dc.MultiD(2,\"Multi\",\"rob\",1)=\"rcc\"",
"^dc.MultiD(2,\"Multi\",\"rob\",2)=2222",
"^dc.MultiD(2,\"mJSON\")=\"{\"\"A\"\":\"\"ahahah\"\",\"\"Rob\"\":\"\"VIP\"\",\"\"Rob2\"\":1111,\"\"Rob3\"\":true}\"",
"^dc.MultiD(3)=$lb(\"Goldman,Kenny H.\",45831)",
"^dc.MultiD(3,\"mJSON\")=\"{}\"",
"^dc.MultiD(4)=$lb(\"\",\"\")",
"^dc.MultiD(4,\"mJSON\")=\"{\"\"rcc\"\":122}\"",
"^dc.MultiD(5)=$lb(\"\",\"\")",
"^dc.MultiD(5,\"mJSON\")=\"{}\""
]}
***** gbl.json *****
USER>

OK. after some detailed analysis I found these facts that I forward to WRC:

  • normal JOB command ISOS/COS
    • returns $TEST to signal success/fail
    • $ZC the id of the started job.
    • this happens after complete init of the job or eventually timed
    • is always ASYNCHRONOUS  to the background job
  • JOB command for Embedded Python if not timed
    • Hangs until AFTER completion of the started job
    • then return $TEST and $ZC which is useless as the job is gone!
    • acts SYNCHONOUS to the started job 
  • timed JOB command for Embedded Python
    • returns after the timeout with $TEST = 0  ==> FAILED
    • does not return the id of the started JOB
    • though the started Job may work fine
    • you just don't get info and may find out by other means if it is OK
  • Workaround until a fix.
    • Start a background job as ISOS/COS Class Method
    • let this class method start your method in Embedded Python.

Another reason why Embedded Python Pure is just a fiction