xcall MIAMEX, MX_LASTLNO, lineno
MX_LASTLNO allows you to find out the last line number executed in the current program. This is similar to the err(1) function in an error trap except it does not require that an error occur.