Verify the size of a file called     input.txt     for a file in the current working directory, and another one in the file system root.




/* NetRexx */
options replace format comments java symbols binary
 
runSample(arg)
return
 
-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
method fileSize(fn) public static returns double
  ff = File(fn)
  fSize = ff.length()
  return fSize
 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) private static
  parse arg files
  if files = '' then files = 'input.txt F docs D /input.txt F /docs D'
  loop while files.length > 0
    parse files fn ft files
    select case(ft.upper())
      when 'F' then do
        ft = 'File'
        end
      when 'D' then do
        ft = 'Directory'
        end
      otherwise do
        ft = 'File'
        end
      end
    sz = fileSize(fn)
    say ft ''''fn'''' sz 'bytes.'
    end
 
  return