If this is just for a quick/dirty directory listing from terminal, you can also use !, exclamaiton mark, this runs the host OS terminal, you can then run any OS commands that you need to.
Once you are done, just type EXIT (On Windows) and you will be back to your IRIS terminal session.
This is a mix of the 2 other suggestions:
select count(*)
from Ens.MessageHeader
where TimeCreated between '2025-02-01 00:00:00' and '2025-02-28 23:59:59'
group by sessionid
All 3 options will work, always more than 1 way to skin a cat.
I would look a the SQL Show Plan to see which one is the most efficient.
I can't help with the specific error, but you can configure Caché to keep the INT for SQL Queries on this page in System Management Portal:
System > Configuration > SQL - (configuration settings)*
Look for "Retain cached query source"
And the <EXTERNAL INTERRUPT> has the following description:
This is in the docs, search for "System Error Messages" should get you there.