preamble
  define zsleep as a nonsimscript routine given 1
end

main
  define rc as integer variable
  define sleeptime as integer variable

for i = 1 to 20 
   write  as "__retrc ",/

  if dim.f(parm.v(*)) < 1
    call exit.r(0)
  endif
 
  write parm.v(1) as "       rc=", T *,/

  write parm.v(1) as t * using the buffer
  read rc using the buffer

  if dim.f(parm.v(*)) >= 2
    write parm.v(2) as t * using the buffer
    read sleeptime using the buffer
    write parm.v(2) as  "       sleep=", T *,/
  else
    sleeptime = 0
  endif   

  call zsleep(sleeptime)
  call exit.r(rc)

end
