In COBOL -85 there is no TRIM function. Below are the best methods to track spaces in input strings. Delimiter is one of the best method to remove spaces.

String FIRST-STRING DELIMITED BY SPACES
       ' ' DELIMITED BY SIZE
       SECOND-STRING DELIMITED BY SIZE
       INTO OUTPUT-STRING

Keep Reading