58 lines
1.9 KiB
Text
58 lines
1.9 KiB
Text
set: procedure options (main);
|
|
declare text character (100) varying;
|
|
declare (fullname, favouritefruit) character (100) varying initial ('');
|
|
declare needspeeling bit (1) static initial ('0'b);
|
|
declare seedsremoved bit (1) static initial ('0'b);
|
|
declare otherfamily(10) character (100) varying;
|
|
declare (i, j) fixed binary;
|
|
declare in file;
|
|
|
|
open file (in) title ( '/RD-CON.DAT,TYPE(TEXT),RECSIZE(200)' );
|
|
|
|
on endfile (in) go to variables;
|
|
|
|
otherfamily = ''; j = 0;
|
|
|
|
do forever;
|
|
get file (in) edit (text) (L);
|
|
text = trim(text);
|
|
|
|
if length(text) = 0 then iterate;
|
|
if substr(text, 1, 1) = ';' then iterate;
|
|
if substr(text, 1, 1) = '#' then iterate;
|
|
if length(text) >= 9 then
|
|
if substr(text, 1, 9) = 'FULLNAME ' then
|
|
fullname = trim( substr(text, 9) );
|
|
if length(text) >= 15 then
|
|
if substr(text, 1, 15) = 'FAVOURITEFRUIT ' then
|
|
favouritefruit = trim( substr(text, 15) );
|
|
if length(text) >= 12 then
|
|
if text = 'NEEDSPEELING' then needspeeling = '1'b;
|
|
if length(text) >= 12 then
|
|
if text = 'SEEDSREMOVED' then seedsremoved = '1'b;
|
|
if length(text) >= 12 then
|
|
if substr(text, 1, 12) = 'OTHERFAMILY ' then
|
|
do;
|
|
text = trim(substr(text, 12) );
|
|
i = index(text, ',');
|
|
do while (i > 0);
|
|
j = j + 1;
|
|
otherfamily(j) = substr(text, 1, i-1);
|
|
text = trim(substr(text, i+1));
|
|
i = index(text, ',');
|
|
end;
|
|
j = j + 1;
|
|
otherfamily(j) = trim(text);
|
|
end;
|
|
end;
|
|
|
|
variables:
|
|
put skip data (fullname);
|
|
put skip data (favouritefruit);
|
|
put skip data (needspeeling);
|
|
put skip data (seedsremoved);
|
|
do i = 1 to j;
|
|
put skip data (otherfamily(i));
|
|
end;
|
|
|
|
end set;
|