Here is the simplified version of the LIKE operator with SQL Procedure

Stored procedure

/// add multiple parameters depends on needs
Query NAMEINLIKE(p1 As %String = "", p2 As %String = "") As %Library.SQLQuery [ SqlProc ]
{
    SELECT  Name,Age FROM Sample.Person 
    WHERE Name like :p1 or Name like :p2
}

 SQL query

select * FROM SAMPLE.PERSON_NAMEINLIKE('%Eisenstien%','Xenia%')
ClassMethod INLIKE(pSQLColumnValue, pSearchValues...) As %Boolean [ SqlProc ]
{
    Set rtn=0
    For i=1:1:$O(pSearchValues(""),-1) {
        Set data = pSearchValues(i)
        If $E(data,1)="%"&&($E(data,*)="%") {
            Set data = $TR(data,"%")
            If pSQLColumnValue[data s rtn=1
        }
        ElseIf $E(data)="%" {
            Set data = $TR(data,"%")
            Set pat = ".ANPC1"""_data_""".ANPC"
            If pSQLColumnValue?@pat Set rtn = 1
        }
        ElseIf $E(data,*)="%" {
            Set data = $TR(data,"%")
            Set pat = "1"""_data_""".ANPC"
            If pSQLColumnValue?@pat Set rtn = 1
        } 
    }
    quit rtn
}

SQL Query

SELECT * FROM SAMPLE.PERSON
WHERE 1=SAMPLE.PERSON_INLIKE(FirstName,'%vid','Zelda%') 

Hello @Evgeny Shvarov 

We can define the global name using either a compile-time class parameter or a runtime expression (COSEXPRESSION):

  • Compile-time:
    Parameter GlobalName = {$NA(^AGlobal)};
  • Runtime (COSEXPRESSION):
    Parameter GlobalName As COSEXPRESSION = "$NA(^AGlobal)";

Instead of assigning just the global name to the parameter and then later generating the full reference using $NAME, you can directly assign the full $NA(^AGlobal) expression to the parameter.

This eliminates the need to do something like:
set gn = $name(..#GlobalName)

Parameter GlobalName As COSEXPRESSION = "$NA(^AGlobal)";

Parameter GlobalName1 = {$NA(^AGlobal)};

ClassMethod SetGbl()
{
	Set @..#GlobalName1("test")=112
	zw @..#GlobalName
}

You can delete the application error logs for all days by executing the below code for specific namespace 

ClassMethod DeleteAppErrorLog(Namespace As %String = {$Namespace}) As %Status
{
    New $Namespace
    Set $Namespace = "%SYS"
    Return ##class(SYS.ApplicationError).DeleteByNamespace(Namespace)
}

Delete by date

ClassMethod DeleteAppErrorLogByDT(pNamespace As %String = {$Namespace},pDate ={$ZD(+$H)}) As %Status
{
    New $Namespace
    Set $Namespace = "%SYS"
    Return ##class(SYS.ApplicationError).DeleteByDate(pNamespace,pDate)
}

As always there is a possibility to get <INVALID OREF> while direct access of objects. So, we can use responseData.items.%Get(0).titles.%Get(0).value.%Get("en_US") with some additional checks like below.

If $IsObject(responseData.items) && (responseData.items.%Size()) {
    dao1 =responseData.items.%Get(0) 
    If $IsObject(dao1.titles) {
        dao1.titles.%Get(0).value.%Get("en_US")
    }
}

I modified the post slightly. I ran a routine via the terminal, and as expected, it threw a <SYNTAX> error because the variable x is undefined. Then I continued the program, and now both the single-line if statement and the block if statement (with braces) set all the global variable. I thought that block of code wouldn’t be executed

 if $D(@x@(a,b,c)) s ^zz1=1,^x=1,^y=2,^xx=1
 ;
 ;
 if $D(@x@(a,b,c)) {
     set ^zz1=1212
     set ^dd=1
     set ^fg=2
 }

Maybe can you try to wrap the HL7 message like below format and set the ContentType As "application/xml"  in additional setting in the Business operation "EnsLib.HL7.Operation.HTTPOperation" and check for the response headers as well if required.

<?xml version="1.0" encoding="UTF-8"?>
<HL7Message>
<![CDATA[
MSH|^~\&|... your message ...
PID|... etc ...
]]>
</HL7Message>

We can use the %IsDefined method  to check the key is defined, and %Size() to determine the number of the elements in an Object or Array. These methods help to prevent from the <INVALID OREF> and <UNDEFINED>

// verify the "items" is present and it has values
If responseData.%IsDefined("items")&&(responseData.items.%Size()) {
    Set item1 = responseData.items.%Get(0)
    If $IsObject(item1) {
        Write item1.portalUrl
    }
    /*another*/
    If $IsObject(item1)&&(item1.%IsDefined("portalUrl")) {
        Write item1.portalUrl
    }
}

The %GetTypeOf method is used to determine the type of a key, and it returns 'unassigned' if the key does not exist

If responseData.%GetTypeOf("items")="array" {
    Set item1 = responseData.items.%Get(0)
    If $IsObject(item1) {
        Write item1.portalUrl
    }
}

We can use the %SYS.LockQuery class and its List query function to check whether the global is already locked. If it is, we can skip attempting to acquire the lock.

Check for the specific process

ClassMethod LOCK(Lock, Mode)
{
    If '..IsLocked("^A","X") {
        Lock +^A
    }
    Else {
        Write "Locked"
    }
}
// X - Exclusive
// S - Shared
ClassMethod IsLocked(Global As %String, Mode As %String)
{
    #dim status = 0
    Set tResult = ##class(%SYS.LockQuery).ListFunc($J)
    While tResult.%Next() {
        If tResult.Mode=Mode&&(tResult.LockString=Global) Set status= 1
    }
    Return status
}

However, the above code only checks for a specific process and does not account for other processes with Xclusive or Shared locks. The sample below checks for all acquired locks, returning their status and lock type.

ClassMethod IsLocked(Global As %String, Mode As %String)
{
	#dim status = 0
	Set tResult = ##class(%SYS.LockQuery).ListFunc()
	While tResult.%Next() {
		If tResult.LockString=Global {
			If tResult.Mode?1(1"X",1"S") Set status= 1_","_tResult.Mode
		}
	}
	Return status #; status be like "1,S" or "1,X"
}