Check this answer if you need a CSV file.

If you need some custom format:

// prepare statement
set st =  ##class(%SQL.Statement).%New()
set st.%SelectMode = 1 // ODBC
set sc = st.%Prepare(query)
quit:$$$ISERR(sc) sc

// execute statement
#dim result As %SQL.StatementResult
set result = st.%Execute()
quit:result.%SQLCODE'=0 $$$ERROR($$$SQLError, result.%SQLCODE, result.%Message)

// iterate metadata (for example if you need a header)
#dim metadata As SQL.StatementMetadata
set metadata = result.%GetMetadata()
set columnCount = metadata.columns.Count()

for i=1:1:columnCount {
	#dim column As %SQL.StatementColumn
	set column = metadata.columns.GetAt(i)
}

// iterate results
while result.%Next() {
	for i=1:1:columnCount {
		set value = result.%GetData(i)
	}
}

can't figure out how to check if the child process (in $zchild) is still running.  

Append 2 commands to your main command.

First one, execute before your main command to create a file with a name equal to process id.

Second one, execute after your main command. It deletes the file.

In your IRIS process check if the file exists.

Ugly but it works.