CENTER: PROC(IN_STRING,OUT_STRING_LENGTH) RETURNS(CHAR(*) VARYING); /* FUNCTION RETURNS A CHARACTER STRING OF A REQUESTED LENGTH IN WHICH IN_STRING IS CENTERED. AUTHOR: AL JAWORSKI DATE: MARCH 1, 1982 */ DCL IN_STRING CHAR(*) VARYING; DCL (OUT_STRING_LENGTH,I) FIXED BINARY(31); DCL OUT_STRING CHAR(OUT_STRING_LENGTH) BASED(P); DCL P POINTER; ALLOC OUT_STRING SET(P); I=OUT_STRING_LENGTH-LENGTH(IN_STRING); IF I>=0 THEN DO; I=DIVIDE(I,2,0); OUT_STRING=COPY(' ',I)||IN_STRING||COPY(' ',I); END; ELSE OUT_STRING=IN_STRING; RETURN(OUT_STRING); END CENTER;