%DCL (SUBSTR,LENGTH,NEWLINE,INDEX) BUILTIN; %DCL NEATEN ENTRY; % @@NEATEN: PROC (ARG) RETURNS (CHAR); DCL (ARG,TAB_CHAR,OUTSTRING) CHAR; DCL I FIXED; /* EXTRACT MARKER (TAB) CHARACTER */ TAB_CHAR = SUBSTR (ARG, 1, 1); IF TAB_CHAR = '(' THEN DO; TAB_CHAR = SUBSTR (ARG, 2, 1); I = LENGTH(ARG) - 3; ARG = SUBSTR (ARG, 3, I); END; ELSE ARG = SUBSTR (ARG, 2); /* INITIALIZE */ OUTSTRING = ''; I = INDEX(ARG,TAB_CHAR); DO WHILE(I>0); IF I = 1 THEN OUTSTRING = OUTSTRING||NEWLINE; ELSE OUTSTRING = OUTSTRING||SUBSTR(ARG,1,I-1)||NEWLINE; IF I = LENGTH(ARG) THEN ARG = ''; ELSE ARG = SUBSTR(ARG,I+1); I = INDEX(ARG,TAB_CHAR); END; IF LENGTH(ARG) > 0 THEN OUTSTRING = OUTSTRING||ARG; RETURN (OUTSTRING); % END @@NEATEN; @@NEATEN(?THIS IS LINE1?LINE2 ?LINE 3? LINE4)