//
on <> ip proc-1  ip proc-2  ip proc-3;
on <?> ip procX-1; //ip procX-2 ip procX-3;
on <!> ip procD-1; //ip procD-2 ip procD-3;
on GR  3 ip procGR-1 ip procGR-2;
on GR  4 ip procGR-1 ip procGR-2;
on GR  5 ip procGR-1 ip procGR-2;
on GR  6 ip procGR-1 ip procGR-2;
on GR  7 ip procGR-1 ip procGR-2;
on GR  8 ip procGR-1 ip procGR-2;
on GR  9 ip procGR-1 ip procGR-2;
on GR 10 ip procGR-1 ip procGR-2;
on GR 11 ip procGR-1 ip procGR-2;
on GR 12 ip procGR-1 ip procGR-2;
on GR 13 ip procGR-1 ip procGR-2;
on GR 14 ip procGR-1 ip procGR-2;
on GR 15 ip procGR-1 ip procGR-2;
on GR 16 ip procGR-1 ip procGR-2;
on GR 3 ip procGR-1 ip procGR-2;
define array a 17;
proc main;
	try;
		fp = 0;
		if %1;
			$1 = %1;
		elseif %2;
			if (fp = fopen(%2));
				fpstat(fp,a);
print a[8];
				$1 = FELREAD1(fp,1,a[8]);
			else;
				return ERROR;
			end if;
		end if;
		print $1;
		exec ep 'inputXML' $1;
	catch;
//		print EXCEPTION ERRNO ERRMSG;
	finally;
		print EXCEPTION ERRNO ERRMSG;
		if (fp); fclose(fp); endif;
	end try;
	return ERROR;
end proc;

proc proc-1;
	print 'proc-1' %0;
//	sleep 0;
	exec ip print1;
	return ERROR;
end proc;

proc proc-2;
	print 'proc-2' %0;
//	sleep 0;
	exec ip print1;
	return ERROR;
end proc;

proc proc-3;
	print 'proc-3' %0;
//	sleep 0;
	exec ip print1;
	return ERROR;
end proc;

proc procX-1;
	print 'procX-1' %0;
//	sleep 0;
	exec ip print1;
	return ERROR;
end proc;
/*
proc procX-2;
	print 'procX-2' %0;
//	sleep 0;
	exec ip print1;
	return ERROR;
end proc;

proc procX-3;
	print 'procX-3' %0;
//	sleep 0;
	exec ip print1;
	return ERROR;
end proc;
*/
proc procD-1;
	print 'procD-1' %0;
//	sleep 0;
	exec ip print1;
	return ERROR;
end proc;
/*
proc procD-2;
	print 'procD-2' %0;
//	sleep 0;
	exec ip print1;
	return ERROR;
end proc;

proc procD-3;
	print 'procD-3' %0;
//	sleep 0;
	exec ip print1;
	return ERROR;
end proc;
*/
proc print1;
	$i = 1;
	loop %0;
		$x = %$i;
		if is($x,'N');
			felwrite(STDOUT,',',concat($x,''));
		else;
			felwrite(STDOUT,',"',$x,'"');
		end if;
		$i++;
	end loop;
	felwrite(SYSOUT,'\n');
	return ERROR;
end proc;
