Undefined variable and the variable contains "" (null) is two different situations, e.g. (see $DATA):

kill myObj
write $data(myObj),! ; -> 0
set myObj=$$$NULLOREF
write $data(myObj),! ; -> 1

In your case it would be better to use $IsObject:

kill myObj
write $IsObject(myObj),! ; -> 0
set d=$$$NULLOREF
write $IsObject(myObj),! ; -> 0
set myObj={}
write $IsObject(myObj),! ; -> 1

Accordingly, should be do $$$AssertTrue('$IsObject(myObj), "myObj is null")

You are right, the macro $$$NULL present only in %sqlMigration.inc and this is not the file that developers often include to its project.
I prefer to use the macro $$$NULLOREF/$$$NULLOID from %occExtent.inc, which is available by default in the class that inherits from %Library.Base, and for routines is enough to include %systemInclude.inc.

Why so difficult?
This similarly following condition:

WHERE 
(
year(current_date) - year(DOB)
) >= 13

It Besides above was already indicated, why does not follow to use such a code, for example:

select datediff(year,
todate(to_char({'1990-12-31'},'YYYY')||':1','YYYY:MM'), -- birthday
todate(to_char({'2003-01-01'},'YYYY')||':1','YYYY:MM') -- report date
)

This gives an incorrect result - 13, although it should be 12.

Then this:

Include Child

Class Macro.Child Extends Macro.Parent
{

ClassMethod first()
{
  #include Child
}

ClassMethod Test() [ PlaceAfter = first ]
{
  write "Class: " $classname() , ! , "Value: " $$$name
}

}

or this:

ClassMethod Test()
{
  #include Child
  write "Class: " $classname() , ! , "Value: " $$$name
}

Macro.Parent.cls:

Include Parent

Class Macro.Parent
{

ClassMethod Test()
{
  write "Class: " $classname() , ! , "Value: " $$$name 
}

}

Macro.Child.cls:

Include Child

Class Macro.Child Extends Macro.Parent
{

ClassMethod Test()
{
  write "Class: " $classname() , ! , "Value: " $$$name 
}

}

Parent.inc:

#ifndef name
  #define name "Parent"
#endif name

Child.inc:

#define name "Child"

Result:

>do ##class(Macro.Parent).Test()
Class: Macro.Parent
Value: Parent
>do ##class(Macro.Child).Test()
Class: Macro.Child
Value: Child

For better performance you should make a few changes:

  1. add an index on DOB field
  2. rebuild the index and run TuneTable
  3. modify the query
    select DOB from HSAA.Patient
    where
    dob<=dateadd('yy',-13,current_date)
    or dob between
          todate((year(current_date)-13)||'0101','yyyymmdd')
      and todate((year(current_date)-13)||'1231','yyyymmdd')

The result will pleasantly surprise you.

Hi Marco.

CSVTOCLASS creates a new class if it doesn't already exist and then it calls the Import method.

Since you already have created the class, it is not created, but there is no Import method, so nothing works.

Solution:

  1. delete all previously created classes: ZenImport.Country, TestCsv.Csv, etc.
  2. run in terminal:
    USER>set rowtype "Code VARCHAR(2),Name VARCHAR(9)"
    USER>set filename "c:\temp\Country.csv"
    USER>do ##class(%SQL.Util.Procedures).CSVTOCLASS(2, .rowtypefilename,";",,,"Test.CSV")
    
  3. run in Portal:
    select * from Test.CSV

    open and see the class "Test.CSV". Profit!!!

See Sample.Person in "SAMPLES".

/// Person's age.<br>
/// This is a calculated field whose value is derived from <property>DOB</property>.
Property Age As %Integer CalculatedSqlComputeCode = { Set {Age}=##class(Sample.Person).CurrentAge({DOB})}, SqlComputedSqlComputeOnChange = DOB ];

/// This class method calculates a current age given a date of birth <var>date</var>.
ClassMethod CurrentAge(date As %Date ""As %Integer CodeMode = expression ]
{
$Select(date="":"",1:($ZD($H,8)-$ZD(date,8)\10000))
}