#!/usr/bin/rexx /* rexx procedure */ input = "" parse arg input do while input = "" say "Input file ?" input parse pull input end /* end do while input = "" */ parse var input output "." . output = strip(output) || ".fic" /* opening input file */ if stream(input, 'C', 'OPEN READ') <> 'READY:' then do say "==>Error : the input file" input "can not be opened." exit end /* end if stream(input, 'C', 'OPEN READ') <> 'READY:' */ /* opening output file */ cmd = '"del' output '"' interpret cmd if stream(output, 'C', 'OPEN WRITE') <> 'READY:' then do say "==>Error : the output file" output "can not be opened." exit end /* end if stream(output, 'C', 'OPEN WRITE') <> 'READY:' */ /* reading input file */ i = 0 do while(lines(input)) i = i + 1 temp = "" temp = linein(input) if i <= 1 then RC = charout(output,temp,1) else RC = charout(output,temp) end /* end do forever */ /* closing input & output file */ rc = stream(input, 'C', 'CLOSE') say i "lines read from" input rc = stream(output, 'C', 'CLOSE') say "1 lines written to" output exit