RosettaCodeData/Task/Odd-word-problem/PL-I/odd-word-problem.pli
2023-07-01 13:44:08 -04:00

25 lines
741 B
Text

test: procedure options (main); /* 2 August 2014 */
declare (ch, ech) character (1);
declare odd file;
get_word: procedure recursive;
declare ch character (1);
get file (odd) edit (ch) (a(1));
if index('abcdefghijklmnopqrstuvwxyz', ch) > 0 then call get_word;
if index('abcdefghijklmnopqrstuvwxyz', ch) > 0 then
put edit (ch) (a);
else ech = ch;
end get_word;
open file (odd) input title ('/ODDWORD.DAT,TYPE(text),recsize(100)');
do forever;
do until (index('abcdefghijklmnopqrstuvwxyz', ch) = 0 );
get file (odd) edit (ch) (a(1)); put edit (ch) (a);
end;
if ch = '.' then leave;
call get_word;
put edit (ech) (a);
if ech = '.' then leave;
end;
end test;