33 lines
887 B
Text
33 lines
887 B
Text
rev: procedure options (main); /* 5 May 2014 */
|
|
declare (s, reverse) character (50) varying;
|
|
declare (i, j) fixed binary;
|
|
declare in file;
|
|
|
|
open file (in) title ('/REV-WRD.DAT,type(text),recsize(5> Nil) {
|
|
for(j := words->Size() - 1; j > -1; j-=1;) {
|
|
IO.Console->Print(words[j])->Print(" ");
|
|
};
|
|
};
|
|
IO.Console->PrintLine();
|
|
lines->Next();
|
|
};
|
|
}
|
|
}0)');
|
|
|
|
do j = 1 to 10;
|
|
get file (in) edit (s) (L);
|
|
put skip list (trim(s));
|
|
|
|
reverse = '';
|
|
|
|
do while (length(s) > 0);
|
|
s = trim(s);
|
|
i = index(s, ' ');
|
|
if i = 0 then
|
|
if s ^= '' then i = length(s)+1;
|
|
if i > 0 then reverse = substr(s, 1, i-1) || ' ' || reverse;
|
|
if length(s) = i then s = ''; else s = substr(s, i);
|
|
end;
|
|
put edit ('---> ', reverse) (col(40), 2 A);
|
|
end;
|
|
end rev;
|