To learn more about command file programming, see Ken Robertson's paper "Programming the Command Interpreter" (Robelle, 1995).
:setvar myvar finfo('myfile','eof')
{save record count}
:if finfo('myfile','eof') > 0
{test record count}
The first parameter to FINFO is the filename and the second is the
attribute desired. FINFO now allows a string literal for the attribute,
instead of the hard-to-remember numeric parameter that was
originally supported. On MPE/iX you can get a list of supported FINFO
attributes by doing :help finfo
.